leloush
New member
how to work with the success chance ? this is a part of script from http://herc.ws/board/topic/1886-simple-mining/// Randomize target mineral to mine
.@target = rand(getarraysize(.mineral));
// Max range of success
.@range = .success[.@target * 2 + 1];
// Check if failed
if(rand(1, .@range) != .success[.@target * 2])
{
message strcharinfo(0), "Nothing valuable was excavated...";
end;
}
// Get mineral(s)
getitem .mineral[.@target], .amount[.@target];
message strcharinfo(0), "You have successfully mined "+ .amount[.@target] +" "+ getitemname(.mineral[.@target]) +"!";
end;
OnWhisperGlobal:
// Whisper anything to initialize settings
message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";
OnInit:
// Minerals
setarray .mineral[0], 25106, 1011, 984, 985; // Phracon, Emveretarcon, Oridecon, Elunium
setarray .amount[0], 1, 1, 1, 1; // Amount to mine
setarray .coordinate_x,0,300;
setarray .coordinate_y,0,300;
// Success rate: (x / y)% chance
setarray .success[0], 1, 5, // 1/5 (20%)
1, 2, // 1/2 (50%)
4, 5, // 4/5 (80%)
1, 50; // 1/50 (2%)
sry i really can't get on how to work with this format..
thanks