Jump to content
  • 0

Monster Invasion Script


Zeke

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Hi, Im looking for a Monster Invasion script as follows

 

1. Should trigger every odd hour i.e 1,3,5,7,9,11,13

2. 100 Monsters should spawn which will drop only items set in script

3. 5 MVP should spawn again with drops specified in script.

4. Should take place in any 4 random city specified in the script

5. On Start Should Display a Message with the invaded city name

6. Should not start when WOE On.

 

Thank You

Link to comment
Share on other sites

13 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

-	script	TownInvasion	-1,{

OnMinute00:
	if(gettime(3) % 2 == 1 && !agitcheck() && !agitcheck2()) {

		for(.@i = 0; .@i < 4; .@i++) { //Spawn on 4 towns
			.Town_Invade$ = .Town$[rand(getarraysize(.Town$))];
			announce .Town_Invade$+" Guard: Help us! Our town is being invaded!",bc_blue|bc_all;

			for(.@ix = 0; .@ix < 5; .@ix++) { //MvP spawner
				monster .Town_Invade$,0,0,"--ja--",.MvP[rand(getarraysize(.MvP))],1,strnpcinfo(1)+"::OnInvadeDeath";
				}

			for(.@iy = 0; .@iy < 100; .@iy++) { //Mob spawner
				monster .Town_Invade$,0,0,"--ja--",-1,1,strnpcinfo(1)+"::OnMobsDeath";
				}
		}
	}
	end;

OnInvadeDeath:
	.@RandMvP = rand(getarraysize(.Prize));
	getitem .Prize[.@RandMvP],.PAmt[.@RandMvP];
	end;

OnMobsDeath:
	.@RandMob = rand(getarraysize(.Prize2));
	getitem .Prize2[.@RandMob],.PAmt2[.@RandMob];
	end;


OnInit:
	//Towns to Invade
	setarray .Town$[0],"prontera","izlude","geffen","payon","alberta","aldebaran","yuno","lighthalzen","einbroch","einbech","comodo","umbala","amatsu","gonryun","ayothaya","louyang","hugel","rachel","veins";

	//MvPs to summon
	setarray .MvP[0],1583,1832,1312;


	//Prize to give MVP
	setarray .Prize[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;
	setarray .PAmt[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;

	//Prize to give Mobs	
	setarray .Prize2[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;
	setarray .PAmt2[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
	end;

}

make sure .Prize, .PAmt, .Prize2, .PAmt2 has the same length of elements in their array. Just change their values to the Item ID of your prize

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  


- script TownInvasion -1,{

OnMinute00:

if(gettime(3) % 2 == 1 && !agitcheck() && !agitcheck2()) {

for(.@i = 0; .@i < 4; .@i++) { //Spawn on 4 towns

do {

.@index = rand(.num_towns);

} while (.@temp_check[.@index]);

.@temp_check[.@index] = 1;

announce .Town$[.@index]+" Guard: Help us! Our town is being invaded!",bc_blue|bc_all;

for(.@ix = 0; .@ix < 5; .@ix++) { //MvP spawner

monster .Town$[.@index],0,0,"--ja--",.MvP[rand(getarraysize(.MvP))],1,strnpcinfo(1)+"::OnInvadeDeath";

}

for(.@iy = 0; .@iy < 100; .@iy++) { //Mob spawner

monster .Town$[.@index],0,0,"--ja--",-1,1,strnpcinfo(1)+"::OnMobsDeath";

}

}

}

end;

OnInvadeDeath:

.@RandMvP = rand(getarraysize(.Prize));

getitem .Prize[.@RandMvP],.PAmt[.@RandMvP];

goto CheckWipe;

end;

OnMobsDeath:

.@RandMob = rand(getarraysize(.Prize2));

getitem .Prize2[.@RandMob],.PAmt2[.@RandMob];

goto CheckWipe;

end;

CheckWipe:

if(mobcount(strcharinfo(3),"OnInvadeDeath") < 1 && mobcount(strcharinfo(3),"OnMobsDeath") < 1)

Saved++;

if(Saved >= 4) {

announce "Thank you! All the cities have been saved!",bc_blue|bc_all;

Saved = 0;

}

end;

OnInit:

//Towns to Invade

setarray .Town$[0],"prontera","izlude","geffen","payon","alberta","aldebaran","yuno","lighthalzen","einbroch","einbech","comodo","umbala","amatsu","gonryun","ayothaya","louyang","hugel","rachel","veins";

set .num_towns, getarraysize(.Town$);

//MvPs to summon

setarray .MvP[0],1583,1832,1312;

//Prize to give MVP

setarray .Prize[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;

setarray .PAmt[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;

//Prize to give Mobs

setarray .Prize2[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;

setarray .PAmt2[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;

end;

}

  • Upvote 2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.01
  • Content Count:  35
  • Reputation:   1
  • Joined:  10/22/20
  • Last Seen:  


 

On 3/25/2014 at 12:18 PM, sandbox said:

 



 

- script TownInvasion -1,{

OnMinute00:

if(gettime(3) % 2 == 1 && !agitcheck() && !agitcheck2()) {

for(.@i = 0; .@i < 4; .@i++) { //Spawn on 4 towns

do {

.@index = rand(.num_towns);

} while (.@temp_check[.@index]);

.@temp_check[.@index] = 1;

announce .Town$[.@index]+" Guard: Help us! Our town is being invaded!",bc_blue|bc_all;

for(.@ix = 0; .@ix < 5; .@ix++) { //MvP spawner

monster .Town$[.@index],0,0,"--ja--",.MvP[rand(getarraysize(.MvP))],1,strnpcinfo(1)+"::OnInvadeDeath";

}

for(.@iy = 0; .@iy < 100; .@iy++) { //Mob spawner

monster .Town$[.@index],0,0,"--ja--",-1,1,strnpcinfo(1)+"::OnMobsDeath";

}

}

}

end;

OnInvadeDeath:

.@RandMvP = rand(getarraysize(.Prize));

getitem .Prize[.@RandMvP],.PAmt[.@RandMvP];

goto CheckWipe;

end;

OnMobsDeath:

.@RandMob = rand(getarraysize(.Prize2));

getitem .Prize2[.@RandMob],.PAmt2[.@RandMob];

goto CheckWipe;

end;

CheckWipe:

if(mobcount(strcharinfo(3),"OnInvadeDeath") < 1 && mobcount(strcharinfo(3),"OnMobsDeath") < 1)

Saved++;

if(Saved >= 4) {

announce "Thank you! All the cities have been saved!",bc_blue|bc_all;

Saved = 0;

}

end;

OnInit:

//Towns to Invade

setarray .Town$[0],"prontera","izlude","geffen","payon","alberta","aldebaran","yuno","lighthalzen","einbroch","einbech","comodo","umbala","amatsu","gonryun","ayothaya","louyang","hugel","rachel","veins";

set .num_towns, getarraysize(.Town$);

//MvPs to summon

setarray .MvP[0],1583,1832,1312;

//Prize to give MVP

setarray .Prize[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;

setarray .PAmt[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;

//Prize to give Mobs

setarray .Prize2[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;

setarray .PAmt2[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;

end;

}

 

what if i need it to be set on OnClock 

eg.
19:00 server time

10:00 server time?

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  296
  • Reputation:   4
  • Joined:  02/19/17
  • Last Seen:  

how to make this a NPC trigger?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Lucky for you i'm currently rewriting my invasion script! Though this is not exactly how I wrote it, I modified it based on your request.

 

Kindly test!

-	script	TownInvasion	-1,{

OnMinute00:
	if(gettime(3) % 2 == 1 && !agitcheck() && !agitcheck2()) {

		for(.@i = 0; .@i < 4; .@i++) { //Spawn on 4 towns
			.Town_Invade$ = .Town$[rand(getarraysize(.Town$))];
			announce .Town_Invade$+" Guard: Help us! Our town is being invaded!",bc_blue|bc_all;

			for(.@ix = 0; .@ix < 5; .@ix++) { //MvP spawner
				monster .Town_Invade$,0,0,"--ja--",-3,1,strnpcinfo(1)+"::OnInvadeDeath";
				}

			for(.@iy = 0; .@iy < 100; .@iy++) { //Mob spawner
				monster .Town_Invade$,0,0,"--ja--",-1,1,strnpcinfo(1)+"::OnMobsDeath";
				}
		}
	}
	end;

OnInvadeDeath:
	getitem .Prize[0],.Prize[1];
	end;

OnMobsDeath:
	getitem .Prize2[0],.Prize2[1];
	end;


OnInit:
	//Towns to Invade
	setarray .Town$[0],"prontera","izlude","geffen","payon","alberta","aldebaran","yuno","lighthalzen","einbroch","einbech","comodo","umbala","amatsu","gonryun","ayothaya","louyang","hugel","rachel","veins";

	//Prize to give, followed by amount
	setarray .Prize[0],7227,2;
	setarray .Prize2[0],607,5;
	end;

}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Sandbox I loved the script. Though need few small changes. I need to set the MVP's, which i want to get spawned ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Here you go

-	script	TownInvasion	-1,{

OnMinute00:
	if(gettime(3) % 2 == 1 && !agitcheck() && !agitcheck2()) {

		for(.@i = 0; .@i < 4; .@i++) { //Spawn on 4 towns
			.Town_Invade$ = .Town$[rand(getarraysize(.Town$))];
			announce .Town_Invade$+" Guard: Help us! Our town is being invaded!",bc_blue|bc_all;

			for(.@ix = 0; .@ix < 5; .@ix++) { //MvP spawner
				monster .Town_Invade$,0,0,"--ja--",.MvP[rand(getarraysize(.MvP))],1,strnpcinfo(1)+"::OnInvadeDeath";
				}

			for(.@iy = 0; .@iy < 100; .@iy++) { //Mob spawner
				monster .Town_Invade$,0,0,"--ja--",-1,1,strnpcinfo(1)+"::OnMobsDeath";
				}
		}
	}
	end;

OnInvadeDeath:
	getitem .Prize[0],.Prize[1];
	end;

OnMobsDeath:
	getitem .Prize2[0],.Prize2[1];
	end;


OnInit:
	//Towns to Invade
	setarray .Town$[0],"prontera","izlude","geffen","payon","alberta","aldebaran","yuno","lighthalzen","einbroch","einbech","comodo","umbala","amatsu","gonryun","ayothaya","louyang","hugel","rachel","veins";

	//MvPs to summon
	setarray .MvP[0],1583,1832,1312;


	//Prize to give, followed by amount
	setarray .Prize[0],7227,2;
	setarray .Prize2[0],607,5;
	end;

}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Thank You Bro. Its perfect.  /no1

Anyways just for knowledge. If i want the monsters to drop items randomly from 15 different items. Is that possible?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Perfect. !


I guess you can give both of em best ans. As both work differently.. 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Buddy, Need a few changes.

1. If a city is chosen it should not be repeated. 

2. Can we make it announce in each of those city which are trigerred by the event, after the monsters are over. 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Kindly test.. All credits goes to @ToastOfDoom for this one..

I went through all the pain when he lectured me about your two requests.. Thank you sensei toasty :(

-	script	TownInvasion	-1,{

OnMinute00:
	if(gettime(3) % 2 == 1 && !agitcheck() && !agitcheck2()) {
		
		for(.@i = 0; .@i < 4; .@i++) { //Spawn on 4 towns

			do {
				.@index = rand(.num_towns);
			} while (.@temp_check[.@index]);

			.@temp_check[.@index] = 1;
				
			announce .Town$[.@index]+" Guard: Help us! Our town is being invaded!",bc_blue|bc_all;

			for(.@ix = 0; .@ix < 5; .@ix++) { //MvP spawner
				monster .Town$[.@index],0,0,"--ja--",.MvP[rand(getarraysize(.MvP))],1,strnpcinfo(1)+"::OnInvadeDeath";
				}

			for(.@iy = 0; .@iy < 100; .@iy++) { //Mob spawner
				monster .Town$[.@index],0,0,"--ja--",-1,1,strnpcinfo(1)+"::OnMobsDeath";
				}
		}
	}
	end;

OnInvadeDeath:
	.@RandMvP = rand(getarraysize(.Prize));
	getitem .Prize[.@RandMvP],.PAmt[.@RandMvP];
	goto CheckWipe;
	end;

OnMobsDeath:
	.@RandMob = rand(getarraysize(.Prize2));
	getitem .Prize2[.@RandMob],.PAmt2[.@RandMob];
	goto CheckWipe;
	end;

CheckWipe:
	if(mobcount(strcharinfo(3),"OnInvadeDeath") < 1 && mobcount(strcharinfo(3),"OnMobsDeath") < 1)
		announce "Thank you, "+strcharinfo(3)+" has been saved!",bc_blue|bc_all;
	end;

OnInit:
	//Towns to Invade
	setarray .Town$[0],"prontera","izlude","geffen","payon","alberta","aldebaran","yuno","lighthalzen","einbroch","einbech","comodo","umbala","amatsu","gonryun","ayothaya","louyang","hugel","rachel","veins";
	set .num_towns, getarraysize(.Town$);

	//MvPs to summon
	setarray .MvP[0],1583,1832,1312;


	//Prize to give MVP
	setarray .Prize[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;
	setarray .PAmt[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;

	//Prize to give Mobs	
	setarray .Prize2[0],7227,607,608,501,502,503,504,505,506,507,508,509,510,511,512;
	setarray .PAmt2[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
	end;

}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Sir, There is one more small problem. It is giving the message "City has been saved after every monster killed". Can we make it to after all the monsters in a city are killed.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   2
  • Joined:  05/15/12
  • Last Seen:  

thanx 4 share but i found error like this, what should i do ?

[Debug]: Source (NPC): TownInvasion (invisible/not on a map)
[Warning]: NPC event parameter deprecated! Please use 'NPCNAME::OnEVENT' instead of 'OnMobsDeath'.

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...