Jump to content
  • 0

REQUEST: monster spawn fuction with rate for a custom item


ffman22

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   2
  • Joined:  08/11/12
  • Last Seen:  

hello, I am trying to create a fuction, to use in my custom branch to spawn, diferent mvps, with a specific chance for each one, I want to create a version that is more easy to implement, or use with a biger number of MVPs

this is the current script that I made.

 

function	script	active_branch	{
set .tw,0;
set .@ms,0;
setarray .mob_id[0],1582,1112,1492,1147;
setarray .mob_c[0],80,60,20,10;
		for(set .@i,0; .@i< (getarraysize(.mob_c)); set .@i,.@i+1) {
		.tw += .mob_c[.@i];
		}
set .rnum, rand(.tw);
debugmes "total weight is: "+.tw;
debugmes .rnum;
freeloop(1);
		for(set .@i,0; .@i< (getarraysize(.mob_c)); set .@i,.@i+1) {
			if(.rnum <= .mob_c[.@i]){
			if(.@ms==0){
			debugmes .mob_id[.@i];
			monster "this", -1,-1, "--ja--",.mob_id[.@i], 1, "";
			.@ms = 1;
			}
			//			
			}
			else
			{
			//debugmes .rnum + "substracted by: "+.mob_c[.@i];
			.rnum -= .mob_c[.@i];	
			}
		}
freeloop(0);
}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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