Bisuke Posted April 19, 2017 Posted April 19, 2017 Is there a way where I can script my event where it detects if the players inside the map "guild_vs1" are still alive every x number of seconds? Quote
0 Cyro Posted April 19, 2017 Posted April 19, 2017 (edited) set map1,getmapusers("guildvs3"); OnMinute01: OnMinute02: OnMinute05: OnMinute10: OnMinute15: OnMinute20: OnMinute25: OnMinute30: OnMinute35: OnMinute40: OnMinute45: OnMinute50: OnMinute55: OnMinute00: announce "Total of "+.@map1+" Players in this Map.",0; if(map1 >= 0); mes "All ther players in map is dead!"; end; Edited April 19, 2017 by Cyro Quote
0 crazyarashi Posted April 19, 2017 Posted April 19, 2017 22 minutes ago, Bisuke said: Is there a way where I can script my event where it detects if the players inside the map "guild_vs1" are still alive every x number of seconds? I dont know what event is that but you can use getmapuser to get the number of players inside :)) and if someone die just use OnPCDieEvent to warp them out :)) Quote
0 Bisuke Posted April 19, 2017 Author Posted April 19, 2017 17 minutes ago, crazyarashi said: I dont know what event is that but you can use getmapuser to get the number of players inside :)) and if someone die just use OnPCDieEvent to warp them out :)) The Thing is, I don't want to warp them out of the map. It's a survival event, and players are allowed to resurrect other players. However, I want to create a script that will active as soon as all the players are dead, the event will be closed and all the dead players will be warped out. Quote
0 Cyro Posted April 19, 2017 Posted April 19, 2017 8 minutes ago, Bisuke said: The Thing is, I don't want to warp them out of the map. It's a survival event, and players are allowed to resurrect other players. However, I want to create a script that will active as soon as all the players are dead, the event will be closed and all the dead players will be warped out. isnt it working? Quote
0 Technoken Posted April 19, 2017 Posted April 19, 2017 (edited) Try - script tesqweqweast -1,{ OnInit: initnpctimer; end; OnTimer5000: stopnpctimer; deletearray .players; addrid(5,1,"guild_vs1"); .players[getarraysize(.players)] = getcharid(3); detachrid; while( .@i < getarraysize(.players) ){ if( attachrid( .players[.@i] ) ) if( HP && compare( strcharinfo(3),"guild_vs1" ) ) .@alive++; .@i++; } if( .@alive ){ initnpctimer; end; } deletearray .players; announce "Players are all the dead",0; mapwarp "guild_vs1","prontera",155,181; end; } Edited April 19, 2017 by Technoken 1 Quote
0 Bisuke Posted April 20, 2017 Author Posted April 20, 2017 23 hours ago, Technoken said: Try - script tesqweqweast -1,{ OnInit: initnpctimer; end; OnTimer5000: stopnpctimer; deletearray .players; addrid(5,1,"guild_vs1"); .players[getarraysize(.players)] = getcharid(3); detachrid; while( .@i < getarraysize(.players) ){ if( attachrid( .players[.@i] ) ) if( HP && compare( strcharinfo(3),"guild_vs1" ) ) .@alive++; .@i++; } if( .@alive ){ initnpctimer; end; } deletearray .players; announce "Players are all the dead",0; mapwarp "guild_vs1","prontera",155,181; end; } Thank you for this reply, but I tried this code and it seems that the code is not working. Quote
0 Technoken Posted April 20, 2017 Posted April 20, 2017 15 minutes ago, Bisuke said: Thank you for this reply, but I tried this code and it seems that the code is not working. I just test the script and it's working fine with me. However, it only run once. If you are going to insert the code inside your custom npc you should have a script that executed initnpctimer whenever the event starts. Also maybe increase the Timer to 30000(30 secs), so it won't be checking too fast. Quote
0 Stolao Posted April 20, 2017 Posted April 20, 2017 You could instead run a while loop using addrid(1) and check if HP > 0 Quote
0 Bisuke Posted April 21, 2017 Author Posted April 21, 2017 Oh, I see, Thank you again, @Technoken and @Stolao This weekend, I will try again your codes, I haven't had the time to test it properly because of my schedule. I'll let you know the results. Quote
Question
Bisuke
Is there a way where I can script my event where it detects if the players inside the map "guild_vs1" are still alive every x number of seconds?
9 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.