Jump to content
  • 0
Sign in to follow this  
xienne15

[Requesting] Invasion that checks day or night

Question

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

7 answers to this question

Recommended Posts

  • 0

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;}

Share this post


Link to post
Share on other sites
  • 0

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 by jaBote
Amended code (third try xD)

Share this post


Link to post
Share on other sites
  • 0

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! :)

Share this post


Link to post
Share on other sites
  • 0

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)

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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?

Share this post


Link to post
Share on other sites
  • 0

When i try this script it says error on line 4

 

if (isday()) donpcevent strnpcinfo(3)+"::OnDay";

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.