Jump to content
  • 0

Requesting assistance on random mobs from array with % chance spawn


Question

Posted (edited)

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

1 answer to this question

Recommended Posts

  • 0
Posted
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. 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...