[Requesting] Invasion that checks day or night

xienne15

New member
Messages
120
Points
0
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)

 
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.

 
Last edited by a moderator:
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!
default_smile.png
 
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)

 
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.

 
Last edited by a moderator:
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?
 
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:

Code:
-	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;}
 
Last edited by a moderator:
Back
Top