cincalok Posted June 5, 2016 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 05/13/16 Last Seen: February 3 Share Posted June 5, 2016 Hi all, Currently working on Novice vs Zombie script, and I can't get the onPCLogoutEvent to work. Script as below: OnPCLogoutEvent:if ( .@mapnvz$ == "quiz_01" && getmapusers("quiz_01") == 1 ) {killmonsterall "quiz_01";mapannounce "quiz_01","You have won, please approach to Prize NPC.",0;enablenpc "Prize";set $@NvZCounter,0;stopnpctimer;end;} Encountered the same issue when I am working with Devil Square, but i ignored it as it won't cause the event to be stucked. Is there anything wrong with the keyword? Players will be stuck now if someone logs out and number of players left is 1. Thank you in advance. Quote Link to comment Share on other sites More sharing options...
0 Moriarty Posted June 5, 2016 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Share Posted June 5, 2016 I think your .@mapnvz$ isn't being setted, as it is as temporary variable, show the whole code. Quote Link to comment Share on other sites More sharing options...
0 cincalok Posted June 5, 2016 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 05/13/16 Last Seen: February 3 Author Share Posted June 5, 2016 Hi Moriarty, I switched the code up a little but it still doesn't work. http://upaste.me/aae2268811d0aac81 This is my whole script. Thanks for your advice. Quote Link to comment Share on other sites More sharing options...
0 Technoken Posted June 5, 2016 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 505 Reputation: 127 Joined: 04/04/16 Last Seen: April 13 Share Posted June 5, 2016 (edited) Maybe when the player logged out the script "getmapusers("quiz_01") == 1" is read first before the character is logged out. Maybe try to add sleep? OnPCLogoutEvent: if ( strcharinfo(3) != "quiz_01" )end; sleep2 1000; if( getmapusers("quiz_01") == 1 ) { killmonsterall "quiz_01"; mapannounce "quiz_01","You have won, please approach to Prize NPC.",0; enablenpc "Prize"; set $@NvZCounter,0; stopnpctimer; end; } I didn't test the script. Edited June 5, 2016 by Technoken Quote Link to comment Share on other sites More sharing options...
0 cincalok Posted June 5, 2016 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 05/13/16 Last Seen: February 3 Author Share Posted June 5, 2016 Hi Technoken, Unfortunately it is not working after I add sleep in. Thank you. Quote Link to comment Share on other sites More sharing options...
0 Technoken Posted June 6, 2016 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 505 Reputation: 127 Joined: 04/04/16 Last Seen: April 13 Share Posted June 6, 2016 Are you sure there's only one player left inside the map? Maybe the gm account is still there. Try to do some checking and see if there's only 1 player left. OnPCLogoutEvent: if ( strcharinfo(3) != "quiz_01" )end; mapannounce "quiz_01",getmapusers("quiz_01")+" player left.",0; end; } Quote Link to comment Share on other sites More sharing options...
0 cincalok Posted June 6, 2016 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 05/13/16 Last Seen: February 3 Author Share Posted June 6, 2016 Hi Technoken, Yes I am very sure. I am suspecting there is something wrong with my onPCLogoutEvent function itself. Is there any updates where I can patch to solve this problem? Thank you. Quote Link to comment Share on other sites More sharing options...
0 Moriarty Posted June 7, 2016 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 135 Reputation: 13 Joined: 06/20/12 Last Seen: April 14, 2018 Share Posted June 7, 2016 Add this: announce "There are "+getmapusers("quiz_01")+" players on the map",8; after the OnPcLogoutEvent ( before the if ). Log double account and see what number appears on the announce after loggin out. If it's 1, then it's weird. As an alternative you can create a timer, that checks every 1 minute if there is only one player in the map, then you don't have to use OnLougoutEvent. ( Event start would initnpctimer, and OnTimer60000: would reset the timer if the event is still going on ). Quote Link to comment Share on other sites More sharing options...
0 cincalok Posted June 7, 2016 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 05/13/16 Last Seen: February 3 Author Share Posted June 7, 2016 Hi Moriarty, Thanks for the suggestion. I did as you said, I added it before the if, and also when the event started, using 2 accounts, 1 gm account and 1 normal account. When the event starts, it gives me 2 players. When I logout, it gives me 2 players as well. Well at least now i know it is not function problem, but why is it returning 2 players ?! Quote Link to comment Share on other sites More sharing options...
0 Secrets Posted June 7, 2016 Group: Developer Topic Count: 36 Topics Per Day: 0.01 Content Count: 588 Reputation: 438 Joined: 01/26/16 Last Seen: April 16 Share Posted June 7, 2016 but why is it returning 2 players ?! Because the label is being ran before the player is actually removed from the map. Quote Link to comment Share on other sites More sharing options...
0 cincalok Posted June 7, 2016 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 05/13/16 Last Seen: February 3 Author Share Posted June 7, 2016 Hi Secrets, Thank you for the heads up. Added a sleep before the checking and it works fine now. Thanks for all your assistance. Quote Link to comment Share on other sites More sharing options...
Question
cincalok
Hi all,
Currently working on Novice vs Zombie script, and I can't get the onPCLogoutEvent to work.
Script as below:
if ( .@mapnvz$ == "quiz_01" && getmapusers("quiz_01") == 1 ) {
killmonsterall "quiz_01";mapannounce "quiz_01","You have won, please approach to Prize NPC.",0;
enablenpc "Prize";set $@NvZCounter,0;
stopnpctimer;end;
}Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.