ffman22 Posted July 14, 2021 Share Posted July 14, 2021 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 [email protected]ms,0; setarray .mob_id[0],1582,1112,1492,1147; setarray .mob_c[0],80,60,20,10; for(set [email protected]i,0; [email protected]i< (getarraysize(.mob_c)); set [email protected]i,[email protected]i+1) { .tw += .mob_c[[email protected]i]; } set .rnum, rand(.tw); debugmes "total weight is: "+.tw; debugmes .rnum; freeloop(1); for(set [email protected]i,0; [email protected]i< (getarraysize(.mob_c)); set [email protected]i,[email protected]i+1) { if(.rnum <= .mob_c[[email protected]i]){ if([email protected]ms==0){ debugmes .mob_id[[email protected]i]; monster "this", -1,-1, "--ja--",.mob_id[[email protected]i], 1, ""; [email protected]ms = 1; } // } else { //debugmes .rnum + "substracted by: "+.mob_c[[email protected]i]; .rnum -= .mob_c[[email protected]i]; } } freeloop(0); } Quote Link to comment Share on other sites More sharing options...
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.
Link to comment
Share on other sites