Jump to content
  • 0

Help with Monster Spawner


Mystogan

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  05/05/12
  • Last Seen:  

ok i was wondering if anyone can point me in the right direction here is what im trying to do

i have 5 diff array groups of monsters what i was wondering is is there a way to spawn a specific amount of mobs depending on what the player imputs max limit of 100. but i would like it so that the monster would be taken from the array groups by amounts  so only the limit below would spawn

 

1class = 1

2class = 4

3class = 20

4class = 25

5class = 50

 

so i i where to start the event it would ask me how many then it would spawn the amount i said but keeping the classes spawn to the above limit

	setarray .1class[0],1735,1740,1312,1297,1567,1852,2144,2016,2338,2339,1868,2472,1507,1456,1992,1302,2342,1389,2018,1115;
	setarray .2class[0],1964,1715,1500,1098,1476,1593,1713,1882,1786,1269,1937,1109,2323,1117,1869,1512,1788,1257,1437,1662;
	setarray .3class[0],1271,1403,1099,1819,1367,1250,1244,1519,1108,1532,1791,1597,1541,1629,1680,1422,1212,1421,1543,1458;
	setarray .4class[0],1863,1280,1440,1069,1032,1927,2025,1013,1177,1178,1417,1111,1033,1119,1592,1040,1129,1544,1586,1509;
	setarray .5class[0],1420,1060,1188,1036,1129,1130,1135,1282,1242,1141,1142,1144,1058,1854,1160,1077,1445,1001,1235,1562;
Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Ok so you want it to be an event.

 

Do you want it to spawn monsters randomly or do you want to be able to choose them?

Do you want it to have a delay between two events?

Do you want to be able to add/delete monsters to classes in game?

Do you want to be able to edit the max amount of monsters who can be spawned in each class in game?

 

If I get it right, you want, once you start the event, to be asked how many monsters you want to spawn from each class (randomly?) and then spawn them to the map of your choice.

Tell me if I'm right or wrong.

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  05/05/12
  • Last Seen:  

Do you want it to spawn monsters randomly or do you want to be able to choose them?

Randomly But they must keep to the class limits like i dont want it to spawn 2 class 1 monsters or 5 class 2 as the limits for those is 1 and 4

 

Do you want it to have a delay between two events?

its all one event when the player chooses the amount i would like it for it to spawn the monsters at the same time with no delay

 

Do you want to be able to add/delete monsters to classes in game?

thats not really neded as i have that part configured on th npc

 

Do you want to be able to edit the max amount of monsters who can be spawned in each class in game?

same as above

 

If I get it right, you want, once you start the event, to be asked how many monsters you want to spawn from each class (randomly?) and then spawn them to the map of your choice.

Tell me if I'm right or wrong.

 

yea thats right but if the player choose lets say 10 mobs they should all spawn at the same time and radomize from the classes so it could spawn

1 class 1 monster

3 class 2 monsters

4 class 3 monster

1 class 4 monster

1 class 5 monster

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

-	script	NPC Name	-1,{
OnInit:
	//setarray .class<num> , <max amount of mob that can be spawned> , <mob>{,<mob>{,<mob>}};
	setarray .class1 , 1 , 1735,1740,1312,1297,1567,1852,2144,2016,2338,2339,1868,2472,1507,1456,1992,1302,2342,1389,2018,1115;
	setarray .class2 , 4 , 1964,1715,1500,1098,1476,1593,1713,1882,1786,1269,1937,1109,2323,1117,1869,1512,1788,1257,1437,1662;
	setarray .class3 , 20 , 1271,1403,1099,1819,1367,1250,1244,1519,1108,1532,1791,1597,1541,1629,1680,1422,1212,1421,1543,1458;
	setarray .class4 , 25 , 1863,1280,1440,1069,1032,1927,2025,1013,1177,1178,1417,1111,1033,1119,1592,1040,1129,1544,1586,1509;
	setarray .class5 , 50 , 1420,1060,1188,1036,1129,1130,1135,1282,1242,1141,1142,1144,1058,1854,1160,1077,1445,1001,1235,1562;
	.@n = 1;
	while (getd(".class"+.@n)) {.amount ++ ; .@n++;}
	.name$ = "[^663300"+strnpcinfo(1)+"^000000]";
	bindatcmd "mobevent",strnpcinfo(0)+"::OnEvent",40;
	end;
OnEvent:
	mes .name$;
	if (.mobs) { mes "Sorry but an event is currently running so you cannot start another one." ; close;}
	mes "Hey there!","I'm in charge of managing the monster spawn event.","","What do you want to do?";
	next;
	if (select("Start an event:Leave") == 2) end;
	mes "max amount of monsters you can spawn :";
	for (.@i = 1 ; .@i <= .amount ; .@i++) mes "~~ from class "+.@i+" >> ^0000ff"+getd(".class"+.@i)+"^000000";
	next;
	for (.@i = 1 ; .@i <= .amount ; .@i++) {
		mes "Please enter the amount of monsters to spawn from class "+.@i;
		input .@num[getarraysize(.@num)],0,getd(".class"+.@i);
		next;
	}
	mes "Recap :";
	for (.@i = 1 ; .@i <= .amount ; .@i++) mes "~~ monsters from ^0000ffclass "+.@i+"^000000 >> ^ff0000"+.@num[.@i-1]+"^000000";
	if (select("Confirm:Leave") == 2) end;
	next;
	mes "In which map do you want to spawn these monsters?";
	input .@map$;
	for (.@i = 1 ; .@i <= .amount ; .@i++) {
		.@total = .@total + .@num[.@i-1];
		for (.@j = 1 ; .@j <= .@num[.@i-1] ; .@j++) { .@rd_id = getd(".class"+.@i+"["+rand(1,getarraysize(getd(".class"+.@i)))+"]") ; monster .@map$,0,0,getmonsterinfo(.@rd_id,0),.@rd_id,1,strnpcinfo(0)+"::OnMobDead"; }
	}
	.mobs = .@total;
	announce "[Event] : "+.@total+" monsters were spawned in "+.@map$+".",0;
	end;
	
OnMobDead:
	.mobs -= 1;
	if (!.mobs) announce "[Event] : All monsters have been killed. Thank you for participating!",0;
}

So you'd start the event by calling the '@mobevent' command (only for gm lvl >= 40).

You can add as many classes as long as you follow this format:

//setarray .class<num> , <max amount of mob that can be spawned> , <mob>{,<mob>{,<mob>}};

You didn't want anything special so it ended up pretty short, don't hesitate to tell me if you want to add/change anything.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  05/05/12
  • Last Seen:  

thanks this helped point me to exaclty what i wanted

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...