Jump to content
  • 0

Remove effect when leaving the map


Yuna

Question


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

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. 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  185
  • Reputation:   53
  • Joined:  01/04/12
  • Last Seen:  

-	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

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  185
  • Reputation:   53
  • Joined:  01/04/12
  • Last Seen:  

-	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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

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 );

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  185
  • Reputation:   53
  • Joined:  01/04/12
  • Last Seen:  

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);

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

It is working well. /ok
Thank you @Sanasol/kis

Link to comment
Share on other sites

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.

×
×
  • Create New...