Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The chance of getting any item in this list is that items chance out of '.chance'...
- - script World_Drops -1,{
- end;
- OnNPCKillEvent:
- .@rnd = rand(.chance);
- if( getmonsterinfo( killedrid,1 ) ) {
- for( .@i = 0; .@i < getarraysize(.items); .@i+=3 ) {
- if( .@rnd < .items[.@i+2] ) {
- getitem .items[.@i], .items[.@i+1];
- .@remainder$ = .items[.@i+2] % 10000;
- .@division = (.items[.@i+2] * 100) / .chance;
- while ( getstrlen(.@remainder$) < 4 )
- .@remainder$ = insertchar(.@remainder$, "0", 0);
- while ( charat(.@remainder$,getstrlen(.@remainder$)) == "0" && getstrlen(.@remainder$) > 2 )
- delchar(.@remainder$,getstrlen(.@remainder$));
- .@display_chance$ = .@division +"."+ .@remainder$;
- dispbottom2 "Congratulations! Player "+ strcharinfo(0) +" has obtained "+ getitemname( .items[.@i] ) +" ["+ .items[.@i+1] +"] from "+ getmonsterinfo(killedrid, 0) +" (chance: "+.@display_chance$+"%).",0xFFFFFF;
- }
- }
- }
- end;
- OnInit:
- .chance = 1000000;
- setarray .items[0],
- 501, 1, 400, //0.04%
- 501, 1, 100, //0.01%
- 501, 1, 100, //0.01%
- 501, 1, 100, //0.01%
- 501, 1, 100, //0.01%
- 501, 1, 500, //0.05%
- 501, 1, 500, //0.05%
- 501, 1, 500, //0.05%
- 501, 1, 1, //0.0001%
- 501, 1, 1, //0.0001%
- 501, 1, 1, //0.0001%
- 501, 1, 1, //0.0001%
- 501, 1, 1 //0.0001%
- ;
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement