gleynn Posted August 26, 2013 Posted August 26, 2013 (edited) can somebody please show me a sample script that has countdown, the script flow will be like this. when player A click the npc the countdown starts. (ex. 20 sec countdown) after 20 secs, the npc will announce "player A wins" BUT if player B clicks the npc,while the countdown for player A is still on going, the countdown will reset, and after 20 secs that no one clicks the npc the npc will announce "player B wins" Edited August 26, 2013 by gleynn Quote
GmOcean Posted August 26, 2013 Posted August 26, 2013 (edited) Here you go. prontera,180,150,4 script Countdown -1,{ set .name$,strcharinfo(0); set .acctid,getcharid(3); initnpctimer; end; OnTimer20000: mapannounce strnpcinfo(4),"The winner is: "+ .name$ +"",0; stopnpctimer; end; } Edited August 26, 2013 by Lionhardt 1 Quote
gleynn Posted August 27, 2013 Author Posted August 27, 2013 (edited) Here you go. prontera,180,150,4 script Countdown -1,{ set .name$,strcharinfo(0); set .acctid,getcharid(3); initnpctimer; end; OnTimer20000: mapannounce strnpcinfo(4),"The winner is: "+ .name$ +"",0; stopnpctimer; end; } i add your script to my script and it works but i didn't include set .acctid,getcharid(3); may i ask? what does this line do? thanks by the way Edited August 27, 2013 by gleynn Quote
GmOcean Posted August 28, 2013 Posted August 28, 2013 That sets the variable .acctid to the account ID of the player. Just incase, you wanted to give them some sort of item or whatever, after the 20seconds. Quote
gleynn Posted August 28, 2013 Author Posted August 28, 2013 That sets the variable .acctid to the account ID of the player. Just incase, you wanted to give them some sort of item or whatever, after the 20seconds. i see, thanks again Quote
Question
gleynn
can somebody please show me a sample script that has countdown,
the script flow will be like this.
when player A click the npc the countdown starts. (ex. 20 sec countdown)
after 20 secs, the npc will announce "player A wins"
BUT if player B clicks the npc,while the countdown for player A is still on going,
the countdown will reset, and after 20 secs that no one clicks the npc
the npc will announce "player B wins"
Edited by gleynn4 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.