Jump to content
  • 0
DR4LUC0N

Requesting assistance on random mobs from array with % chance spawn

Question

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;
		
		[email protected]$ = implode(.map_name$, ":");
		[email protected] = select( [email protected]$ ) - 1;
		
		mes "How many MvPs would you like to spawn on map "+ .map_name$[[email protected]] +"?";
		next;
		
		input [email protected]_nbr;
		
		mes "So you have choosen to spawn "+ [email protected]_nbr +" on "+ .map_name$[[email protected]] +" is this correct?";
		if(select("Yes:No") == 2) end;
		
		[email protected] = rand(1,getarraysize(.size_mob)/2)*2;
		monster .map_name$[[email protected]],0,0,"--ja--",.mob_id[[email protected]+1],[email protected]_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
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;
		
		[email protected]$ = implode(.map_name$, ":");
		[email protected] = select( [email protected]$ ) - 1;
		
		mes "How many MvPs would you like to spawn on map "+ .map_name$[[email protected]] +"?";
		next;
		
		input [email protected]_nbr;
		
		mes "So you have choosen to spawn "+ [email protected]_nbr +" on "+ .map_name$[[email protected]] +" is this correct?";
		if(select("Yes:No") == 2) end;
		
		[email protected] = rand(1,getarraysize(.size_mob)/2)*2;
		monster .map_name$[[email protected]],0,0,"--ja--",.mob_id[[email protected]+1],[email protected]_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...

Important Information

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