xienne15 5 Posted August 2, 2013 Info: The invasion will occur when the script detects that the server is night time, and when day time arrives, the invasion will end killing all the monster in a map(prontera) Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted August 2, 2013 (edited) Try this one (untested) - script night_invader -1,{OnInit: if (isday()) donpcevent strnpcinfo(3)+"::OnDay"; else donpcevent strnpcinfo(3)+"::OnNight"; sleep 10*1000; // Checking every 10 seconds donpcevent strnpcinfo(3)+"::OnInit"; end;OnDay: if (.mobout) { announce "The day rises and monsters start to stop invading Prontera.",bc_all; killmonster "prontera",strnpcinfo(3)+"::OnInvasionMobDead"; set .mobout, 0; } end;OnNight: if (!.mobout){ // Summon your monsters here, by using the monster script command. Make sure that the event label is strnpcinfo(3)+"::OnInvasionMobsDead". // Summon example with 30 orc zombies (ID 1153): monster "prontera",0,0,"--ja--",1153,30,strnpcinfo(3)+"::OnInvasionMobDead"; announce "The night rises and monsters start to attack Prontera!",bc_all; set .mobout, 1; } end;OnInvasionMobDead: if (isnight()) monster "prontera",0,0,"--ja--",1153,1,strnpcinfo(3)+"::OnInvasionMobDead"; // We simply artificially respawn them. end;} If you want to spawn more than one kind of monster and they all be respawning, your script will be a bit more complicated. For best perfomance of the NPC you should add OnDay and/or OnNight labels to trigger via the src, but this one is still OK. Edited August 2, 2013 by jaBote Amended code (third try xD) 1 xienne15 reacted to this Quote Share this post Link to post Share on other sites
0 xienne15 5 Posted August 2, 2013 Try this one (untested) - script night_invader -1,{OnInit: if (isday()) donpcevent strcharinfo(3)+"::OnDay"; else donpcevent strcharinfo(3)+"::OnNight"; sleep 10*1000; // Checking every 10 seconds donpcevent strcharinfo(3)+"::OnInit"; end;OnDay: if (.mobout) { announce "The day rises and monsters start to stop invading Prontera.",bc_all; killmonster "prontera",strnpcinfo(3)+"::OnInvasionMobsDead"; set .mobout, 0; } end;OnNight: if (!.mobout){ // Summon your monsters here, by using the monster script command. Make sure that the event label is strnpcinfo(3)+"::OnInvasionMobsDead". // Summon example with 30 orc zombies (ID 1153): monster "prontera",0,0,"--ja--",1153,30,strnpcinfo(3)+"::OnInvasionMobDead"; announce "The night rises and monsters start to attack Prontera!",bc_all; set .mobout, 1; } end;OnInvasionMobDead: if (isnight()) monster "prontera",0,0,"--ja--",1153,1,strnpcinfo(3)+"::OnInvasionMobDead"; // We simply artificially respawn them. end;} If you want to spawn more than one kind of monster and they all be respawning, your script will be a bit more complicated. For best perfomance of the NPC you should add OnDay and/or OnNight labels to trigger via the src, but this one is still OK. Thank you!! i will try it ASAP! Quote Share this post Link to post Share on other sites
0 xienne15 5 Posted August 2, 2013 jaBote, on 02 Aug 2013 - 21:07, said: Try this one (untested) - script night_invader -1,{OnInit: if (isday()) donpcevent strcharinfo(3)+"::OnDay"; else donpcevent strcharinfo(3)+"::OnNight"; sleep 10*1000; // Checking every 10 seconds donpcevent strcharinfo(3)+"::OnInit"; end;OnDay: if (.mobout) { announce "The day rises and monsters start to stop invading Prontera.",bc_all; killmonster "prontera",strnpcinfo(3)+"::OnInvasionMobsDead"; set .mobout, 0; } end;OnNight: if (!.mobout){ // Summon your monsters here, by using the monster script command. Make sure that the event label is strnpcinfo(3)+"::OnInvasionMobsDead". // Summon example with 30 orc zombies (ID 1153): monster "prontera",0,0,"--ja--",1153,30,strnpcinfo(3)+"::OnInvasionMobDead"; announce "The night rises and monsters start to attack Prontera!",bc_all; set .mobout, 1; } end;OnInvasionMobDead: if (isnight()) monster "prontera",0,0,"--ja--",1153,1,strnpcinfo(3)+"::OnInvasionMobDead"; // We simply artificially respawn them. end;} If you want to spawn more than one kind of monster and they all be respawning, your script will be a bit more complicated. For best perfomance of the NPC you should add OnDay and/or OnNight labels to trigger via the src, but this one is still OK. im having a problem running it, this one appears script_rid2sd:fatal error! player not attached! Function: strcharinfo (1 parameter): data: number value =3 source: NPC night_invader (invisible/not on a map) Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted August 2, 2013 LoL change all instances of strcharinfo(3) to strnpcinfo(3). Edited on the first reply. Sorry for the mistake. It should work now I think. Quote Share this post Link to post Share on other sites
0 xienne15 5 Posted August 2, 2013 LoL change all instances of strcharinfo(3) to strnpcinfo(3). Edited on the first reply. Sorry for the mistake. It should work now I think. lol! I tried it now and it works, but the ting is when day, the monster still stays on the map, how can i make them go away when day come? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted August 2, 2013 I've just made another mistake fix: OnDay label was trying to kill OnMobsInvasionDead event while the mob event was actually OnMobsInvasionDead. Try again, first post amended again and sorry. Rushes are not your friend it seems. This is the I hope fixed code, without any (expected) errors: - script night_invader -1,{OnInit: if (isday()) donpcevent strnpcinfo(3)+"::OnDay"; else donpcevent strnpcinfo(3)+"::OnNight"; sleep 10*1000; // Checking every 10 seconds donpcevent strnpcinfo(3)+"::OnInit"; end;OnDay: if (.mobout) { announce "The day rises and monsters start to stop invading Prontera.",bc_all; killmonster "prontera",strnpcinfo(3)+"::OnInvasionMobDead"; set .mobout, 0; } end;OnNight: if (!.mobout){ // Summon your monsters here, by using the monster script command. Make sure that the event label is strnpcinfo(3)+"::OnInvasionMobsDead". // Summon example with 30 orc zombies (ID 1153): monster "prontera",0,0,"--ja--",1153,30,strnpcinfo(3)+"::OnInvasionMobDead"; announce "The night rises and monsters start to attack Prontera!",bc_all; set .mobout, 1; } end;OnInvasionMobDead: if (isnight()) monster "prontera",0,0,"--ja--",1153,1,strnpcinfo(3)+"::OnInvasionMobDead"; // We simply artificially respawn them. end;} 1 xienne15 reacted to this Quote Share this post Link to post Share on other sites
0 JoyRo 5 Posted December 22, 2015 When i try this script it says error on line 4 if (isday()) donpcevent strnpcinfo(3)+"::OnDay"; Quote Share this post Link to post Share on other sites
Info:
The invasion will occur when the script detects that the server is night time, and when day time arrives, the invasion will end killing all the monster in a map(prontera)
Share this post
Link to post
Share on other sites