Jump to content
  • 0

Remove effect when leaving the map


Question

Posted

Hi,
I need help with this script:

-	script	redfog	-1,{
OnPCLoadMapEvent:
set .map$, "abbey03";
		getmapxy(@map$, @xb, @yb, 0 );
		if (@map$ != .map$) {
				atcommand "@refresh";
                dispbottom "You have left "+.map$+".";
                end;
        }
	specialeffect2 592;// effect centered on the invoking character's sprite
	end;
}
abbey03	mapflag	loadevent


Currently when leaving/changing the map  the message "You have left the map" keeps repeating.
I just want the effect to end when the player leaves the map. 

7 answers to this question

Recommended Posts

  • 0
Posted
-	script	redfog	-1,{
    OnPCLoadMapEvent:
        getmapxy(@map$, @xb, @yb);
        if(@map$ == "abbey03") {
            addtimer 1000, strnpcinfo(3) + "::On1sec";
            specialeffect2 592;// effect centered on the invoking character's sprite
        }
    end;

    On1sec:
        getmapxy(@map$, @xb, @yb);
        if(@map$ != "abbey03") {
            dispbottom "abbey left refreshing";
            atcommand "@refresh";
            deltimer strnpcinfo(3) + "::On1sec";
        } else {
            addtimer 5000, strnpcinfo(3) + "::On1sec";
        }
    end;
}
abbey03	mapflag	loadevent

 

  • 0
Posted (edited)
-	script	redfog	-1,{
    OnPCLoadMapEvent:
        addtimer 1000, strnpcinfo(3) + "::On1sec";
        specialeffect2 592;// effect centered on the invoking character's sprite
    end;

    On1sec:
        getmapxy(@map$, @xb, @yb);
        if(@map$ != "abbey03") {
            dispbottom "abbey left refreshing";
            atcommand "@refresh";
        } else {
            addtimer 5000, strnpcinfo(3) + "::On1sec";
        }
    end;
}
abbey03	mapflag	loadevent

 

Not sure that getmapxy will work in this case, can't test it ?

Edited by Sanasol
  • Love 1
  • 0
Posted
20 hours ago, Sanasol said:

-	script	redfog	-1,{
    OnPCLoadMapEvent:
        addtimer 1000, strnpcinfo(3) + "::On1sec";
        specialeffect2 592;// effect centered on the invoking character's sprite
    end;

    On1sec:
        getmapxy(@map$, @xb, @yb);
        if(@map$ != "abbey03") {
            dispbottom "abbey left refreshing";
            atcommand "@refresh";
        } else {
            addtimer 5000, strnpcinfo(3) + "::On1sec";
        }
    end;
}
abbey03	mapflag	loadevent

 

Not sure that getmapxy will work in this case, can't test it ?

I tried it, but got the same result I got from my script. Except yours made the character refresh 3 times after exiting the map.

  • 0
Posted
3 hours ago, Sanasol said:

-	script	redfog	-1,{
    OnPCLoadMapEvent:
        getmapxy(@map$, @xb, @yb);
        if(@map$ == "abbey03") {
            addtimer 1000, strnpcinfo(3) + "::On1sec";
            specialeffect2 592;// effect centered on the invoking character's sprite
        }
    end;

    On1sec:
        getmapxy(@map$, @xb, @yb);
        if(@map$ != "abbey03") {
            dispbottom "abbey left refreshing";
            atcommand "@refresh";
            deltimer strnpcinfo(3) + "::On1sec";
        } else {
            addtimer 5000, strnpcinfo(3) + "::On1sec";
        }
    end;
}
abbey03	mapflag	loadevent

 

It errors here.
 

    parse_callfunc: not enough arguments, expected ','
    62 : {
    63 :        OnPCLoadMapEvent:
*   64 :                getmapxy(@map$, @xb, @yb')';
    65 :         if(@map$ == "abbey03") {
    66 :             addtimer 1000, strnpcinfo(3) + "::On1sec";
    67 :             specialeffect2 592;// effect centered on the invoking character's sprite
    68 :         }

Shouldn't it be like this?: getmapxy(@map$, @xb, @yb, 0 );

  • 0
Posted

Not sure, try it, but default value is player i.e. 0, so no need to specify each time.

Also these lines worked before as you said:

On1sec:
        getmapxy(@map$, @xb, @yb);

 

  • 0
Posted (edited)

Here is the script currently:
 

-	script	redfog	-1,{
	OnPCLoadMapEvent:
		getmapxy(@map$, @xb, @yb, 0 );
        if(@map$ == "abbey03") {
            addtimer 1000, strnpcinfo(3) + "::On1sec";
            specialeffect2 592;// effect centered on the invoking character's sprite
        }
    end;

    On1sec:
        getmapxy(@map$, @xb, @yb, 0 );
        if(@map$ != "abbey03") {
            dispbottom "abbey left refreshing";
            atcommand "@refresh";
            deltimer strnpcinfo(3) + "::On1sec";
        } else {
            addtimer 5000, strnpcinfo(3) + "::On1sec";
        }
    end;
}
abbey03	mapflag	loadevent


So it worked this time, except one issue. The effect doesn't trigger when the character enters abbey03 again, after leaving the map the first time.

Edit: No sorry, it didn't work. I will update soon.

Edited by Yuna

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...