Jump to content
  • 0

Requesting assistance on random mobs from array with % chance spawn


DR4LUC0N

Question


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

So I have this script that I've been working on, but the problem is, it only spawns 1 of the monsters, trying to get random monsters off the list with the % based chance to spawn. If possible I'd like to keep the array mob_ID,%chance, if not it's okay, would much rather a functioning script over functionality.

 

ba_chess,20,20,6	script	MvP Shower Helper	10023,{
	
	if(getgmlevel() >= 90){
		mes "Hello"+ strcharinfo(0) +", welcome to the MvP Shower NPC.";
		mes "Please select a map you'd like to spawn MvPs on.";
		next;
		
		.@select$ = implode(.map_name$, ":");
		.@i = select( .@select$ ) - 1;
		
		mes "How many MvPs would you like to spawn on map "+ .map_name$[.@i] +"?";
		next;
		
		input .@mob_nbr;
		
		mes "So you have choosen to spawn "+ .@mob_nbr +" on "+ .map_name$[.@i] +" is this correct?";
		if(select("Yes:No") == 2) end;
		
		.@rand = rand(1,getarraysize(.size_mob)/2)*2;
		monster .map_name$[.@i],0,0,"--ja--",.mob_id[.@rand+1],.@mob_nbr;
	}
OnInit:
setarray .map_name$,"ba_chess","veil","prontera","fair_izlude","ba_bath";
setarray .mob_id[1],1857,5,1002,10,1031,2,1113,15,1613,33,1836,60;
.size_mob = getarraysize( .mob_id );
end;
}

I appreciate any help given.

Edited by DR4LUC0N
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

On 6/26/2021 at 2:25 PM, DR4LUC0N said:

So I have this script that I've been working on, but the problem is, it only spawns 1 of the monsters, trying to get random monsters off the list with the % based chance to spawn. If possible I'd like to keep the array mob_ID,%chance, if not it's okay, would much rather a functioning script over functionality.

 


ba_chess,20,20,6	script	MvP Shower Helper	10023,{
	
	if(getgmlevel() >= 90){
		mes "Hello"+ strcharinfo(0) +", welcome to the MvP Shower NPC.";
		mes "Please select a map you'd like to spawn MvPs on.";
		next;
		
		.@select$ = implode(.map_name$, ":");
		.@i = select( .@select$ ) - 1;
		
		mes "How many MvPs would you like to spawn on map "+ .map_name$[.@i] +"?";
		next;
		
		input .@mob_nbr;
		
		mes "So you have choosen to spawn "+ .@mob_nbr +" on "+ .map_name$[.@i] +" is this correct?";
		if(select("Yes:No") == 2) end;
		
		.@rand = rand(1,getarraysize(.size_mob)/2)*2;
		monster .map_name$[.@i],0,0,"--ja--",.mob_id[.@rand+1],.@mob_nbr;
	}
OnInit:
setarray .map_name$,"ba_chess","veil","prontera","fair_izlude","ba_bath";
setarray .mob_id[1],1857,5,1002,10,1031,2,1113,15,1613,33,1836,60;
.size_mob = getarraysize( .mob_id );
end;
}

I appreciate any help given.

Create a specific array for mobCount. 

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