PandaLovesHamster Posted June 8, 2015 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 452 Reputation: 35 Joined: 12/18/14 Last Seen: May 30, 2016 Share Posted June 8, 2015 I'd like to request an npc where it would give you points every hour as long as the player remains inside the map.Warping out will cause the timer to reset back to 0, character select or disconnection results to timer reset as well.Thank you sirs. Quote Link to comment Share on other sites More sharing options...
0 Kurofly Posted June 9, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted June 9, 2015 (edited) Do you want it to prevent 'reloadscript' from reseting the timer? - script hour_points -1,{ function AddPlayer; OnInit: setarray .maps$ , "morocc"; //maps where the system is active .points = 1; //number of points get after one hour for (.@i = 0 ; .@i < getarraysize(.maps$) ; .@i++) if (!getmapflag(.maps$[.@i],mf_loadevent)) setmapflag .maps$[.@i],mf_loadevent; initnpctimer; end; OnPCLoadMapEvent: for (.@i = 0 ; .@i < getarraysize(.maps$) ; .@i++) { if (.maps$[.@i] == strcharinfo(3)) { dispbottom "You entered a special zone and will now receive points every hour you spend there."; dispbottom "Please note that warping out of the map will reset your timer."; AddPlayer(strcharinfo(0),strnpcinfo(0)); } } end; OnTimer1000: //will check very second if player is still on the map for (.@i = 0 ; .@i < .player_amount ; .@i += 3) { if (!attachrid(getcharid(3,.players$[.@i])) || strcharinfo(3) != .players$[.@i+1]) { deletearray .players$[.@i],3 ; .player_amount -= 3; } } for (.@i = 0 ; .@i < .player_amount ; .@i += 3) { setarray .players$[.@i+2] , ""+(atoi(.players$[.@i+2]) + 1)+""; if (atoi(.players$[.@i+2]) >= 10 && attachrid(getcharid(3,.players$[.@i]))) { MapPoints += .points; dispbottom "You stayed one hour in this map and so earned "+.points+" map point"+(.points>1?"s":"")+"."; dispbottom "Your total points : "+MapPoints; setarray .players$[.@i+2] , "0"; } } initnpctimer; function AddPlayer { //player name , npc name for (.@i = 0 ; .@i < getvariableofnpc(.player_amount,getarg(1)) ; .@i += 3) if (getvariableofnpc(.players$[.@i],getarg(1)) == getarg(0)) return; setarray getvariableofnpc(.players$[getvariableofnpc(.player_amount,getarg(1))],getarg(1)) , getarg(0) , strcharinfo(3) , "0"; set getvariableofnpc(.player_amount,getarg(1)) , getvariableofnpc(.player_amount,getarg(1)) + 3; return; } } this one doesn't support reloadscript and will reset all timers, it also won't start them back if players doesn't warp in the map again. don't forget to edit these: setarray .maps$ , "morocc"; //maps where the system is active .points = 1; //number of points get after one hour Edited June 9, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
0 Azeroth Posted December 4, 2015 Group: Members Topic Count: 36 Topics Per Day: 0.01 Content Count: 383 Reputation: 121 Joined: 03/31/12 Last Seen: January 29, 2023 Share Posted December 4, 2015 Do you want it to prevent 'reloadscript' from reseting the timer? - script hour_points -1,{ function AddPlayer; OnInit: setarray .maps$ , "morocc"; //maps where the system is active .points = 1; //number of points get after one hour for (.@i = 0 ; .@i < getarraysize(.maps$) ; .@i++) if (!getmapflag(.maps$[.@i],mf_loadevent)) setmapflag .maps$[.@i],mf_loadevent; initnpctimer; end; OnPCLoadMapEvent: for (.@i = 0 ; .@i < getarraysize(.maps$) ; .@i++) { if (.maps$[.@i] == strcharinfo(3)) { dispbottom "You entered a special zone and will now receive points every hour you spend there."; dispbottom "Please note that warping out of the map will reset your timer."; AddPlayer(strcharinfo(0),strnpcinfo(0)); } } end; OnTimer1000: //will check very second if player is still on the map for (.@i = 0 ; .@i < .player_amount ; .@i += 3) { if (!attachrid(getcharid(3,.players$[.@i])) || strcharinfo(3) != .players$[.@i+1]) { deletearray .players$[.@i],3 ; .player_amount -= 3; } } for (.@i = 0 ; .@i < .player_amount ; .@i += 3) { setarray .players$[.@i+2] , ""+(atoi(.players$[.@i+2]) + 1)+""; if (atoi(.players$[.@i+2]) >= 10 && attachrid(getcharid(3,.players$[.@i]))) { MapPoints += .points; dispbottom "You stayed one hour in this map and so earned "+.points+" map point"+(.points>1?"s":"")+"."; dispbottom "Your total points : "+MapPoints; setarray .players$[.@i+2] , "0"; } } initnpctimer; function AddPlayer { //player name , npc name for (.@i = 0 ; .@i < getvariableofnpc(.player_amount,getarg(1)) ; .@i += 3) if (getvariableofnpc(.players$[.@i],getarg(1)) == getarg(0)) return; setarray getvariableofnpc(.players$[getvariableofnpc(.player_amount,getarg(1))],getarg(1)) , getarg(0) , strcharinfo(3) , "0"; set getvariableofnpc(.player_amount,getarg(1)) , getvariableofnpc(.player_amount,getarg(1)) + 3; return; } } this one doesn't support reloadscript and will reset all timers, it also won't start them back if players doesn't warp in the map again. don't forget to edit these: setarray .maps$ , "morocc"; //maps where the system is active .points = 1; //number of points get after one hour How to 'prevent or support from reloadscript for this script? Quote Link to comment Share on other sites More sharing options...
Question
PandaLovesHamster
I'd like to request an npc where it would give you points every hour as long as the player remains inside the map.
Warping out will cause the timer to reset back to 0, character select or disconnection results to timer reset as well.
Thank you sirs.
Link to comment
Share on other sites
2 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.