Jump to content
  • 0
Sign in to follow this  
leloush

about mining success chance

Question

 

    // 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%)

how to work with the success chance ? this is a part of script from http://herc.ws/board/topic/1886-simple-mining/

 

sry i really can't get on how to work with this format..

 

thanks

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

 

For example :

 

The success chance of item 984 ws setted to  80%, actually the range of  if(rand(1, .@range) != .success[.@target * 2])

 

 was total  5 elements(1~5) ,  the if condition go rand 5 elements  not equal to 1 elements judged to failure change.

 

So the failure change is 4/5 and success chance is 1/5  not  satisfying our setting 80%  success chance

 

Hope you can understand my broken Eng :P

yes i did.  :P btw thanks

 

 

but what if i want to add a prize.. where should i put it

 

 

For example :

 

The success chance of item 984 ws setted to  80%, actually the range of  if(rand(1, .@range) != .success[.@target * 2])

 

 was total  5 elements(1~5) ,  the if condition go rand 5 elements  not equal to 1 elements judged to failure change.

 

So the failure change is 4/5 and success chance is 1/5  not  satisfying our setting 80%  success chance

 

Hope you can understand my broken Eng :P

yes i did.  :P btw thanks

 

 

but what if i want to add a prize.. where should i put it

 Do you mean add new mining reward ?

 

 

// Minerals
setarray .mineral[0], 1010, 1011, 984, 985, 501; // Phracon, Emveretarcon, Oridecon, Elunium
setarray .amount[0], 5,   3, 1, 1, 1; // Amount to mine
// 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%)
  3,  5;  // 3/5 (60%)
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

// 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%) 

yeah i already knew about this.. but i have hesitation on the format on what item are on the 2% success chance.

Share this post


Link to post
Share on other sites
  • 0

setarray .mineral[0], 25106, 1011, 984, 985; // Phracon, Emveretarcon, Oridecon, Elunium

 

// Success rate: (x / y)% chance        setarray .success[0],   1, 5,   // 1/5 (20%) -->25106                                1, 2,   // 1/2 (50%) -->1011                                4, 5,   // 4/5 (80%) -->984                                1, 50;  // 1/50 (2%) -->985

 

Share this post


Link to post
Share on other sites
  • 0

 

setarray .mineral[0], 25106, 1011, 984, 985; // Phracon, Emveretarcon, Oridecon, Elunium

 

// Success rate: (x / y)% chance        setarray .success[0],   1, 5,   // 1/5 (20%) -->25106                                1, 2,   // 1/2 (50%) -->1011                                4, 5,   // 4/5 (80%) -->984                                1, 50;  // 1/50 (2%) -->985

ok thanks .. i think my problem was solve.

Share this post


Link to post
Share on other sites
  • 0

I don't think the original  formula is correct

 

if(rand(1, .@range) != .success[.@target * 2])

 

should change to

 

if(rand(1, .@range) > .success[.@target * 2])

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

I don't think the original  formula is correct

 

if(rand(1, .@range) != .success[.@target * 2])

 

should change to

 

if(rand(1, .@range) > .success[.@target * 2])

thank you for your concern..

 

but what are the diff. of this two lines?

Edited by leloush

Share this post


Link to post
Share on other sites
  • 0

For example :

 

The success chance of item 984 was setted to  80%, actually the range of  if(rand(1, .@range) != .success[.@target * 2])  was total  5 elements(1~5) ,  The if condition go rand 5 elements  not equal to 1 element judged to failure change. So the failure change is 4/5 and success chance is 1/5  not  satisfying our setting 80%  success chance .

 

Hope you can understand my broken Eng :P

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

For example :

 

The success chance of item 984 ws setted to  80%, actually the range of  if(rand(1, .@range) != .success[.@target * 2])

 

 was total  5 elements(1~5) ,  the if condition go rand 5 elements  not equal to 1 elements judged to failure change.

 

So the failure change is 4/5 and success chance is 1/5  not  satisfying our setting 80%  success chance

 

Hope you can understand my broken Eng :P

yes i did.  :P btw thanks

 

 

but what if i want to add a prize.. where should i put it

Edited by leloush

Share this post


Link to post
Share on other sites
  • 0

 

 

For example :

 

The success chance of item 984 ws setted to  80%, actually the range of  if(rand(1, .@range) != .success[.@target * 2])

 

 was total  5 elements(1~5) ,  the if condition go rand 5 elements  not equal to 1 elements judged to failure change.

 

So the failure change is 4/5 and success chance is 1/5  not  satisfying our setting 80%  success chance

 

Hope you can understand my broken Eng :P

yes i did.  :P btw thanks

 

 

but what if i want to add a prize.. where should i put it

 

For example :

 

The success chance of item 984 ws setted to  80%, actually the range of  if(rand(1, .@range) != .success[.@target * 2])

 

 was total  5 elements(1~5) ,  the if condition go rand 5 elements  not equal to 1 elements judged to failure change.

 

So the failure change is 4/5 and success chance is 1/5  not  satisfying our setting 80%  success chance

 

Hope you can understand my broken Eng :P

yes i did.  :P btw thanks

 

 

but what if i want to add a prize.. where should i put it

 Do you mean add new mining reward ?

 

 

// Minerals
setarray .mineral[0], 1010, 1011, 984, 985, 501; // Phracon, Emveretarcon, Oridecon, Elunium
setarray .amount[0], 5,   3, 1, 1, 1; // Amount to mine
// 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%)
  3,  5;  // 3/5 (60%)

 

thank you so much angel.  :thx:

 

 

 

but lastly.. if u dont mind.. can u give me an idea of this script.. i want to put an announce to the map after being warped by the npc from outside.

 

example.. ( already in the destination map .. and the npc inside will ( welcome him/her ) )

 

 mellina,63,60,6 script sample 406,{
end;
OnInit:
waitingroom "waiting room",3,strnpcinfo(3)+"::OnStart",2;
end;
OnStart:
warpwaitingpc "guild_vs2",50,50;
announce  "The raid team of "+ rid2name( $@warpwaitingpc[0] ) +" was teleported to the Raid Dungeon!",bc_blue|bc_all;
enablenpc "insidenpc";
end;
}
 
after warped to guild_vs2
 
announce to map (guild_vs2)  welcome this is sample script... etc etc..

thank you in advanced  :meow:

Share this post


Link to post
Share on other sites
  • 0

you can use  mapannounce after warp player to the  mining map

 

mapannounce "guild_vs2", "wellcome ".+rid2name( $@warpwaitingpc[0] )+"....blah blah blah...", 0;

Share this post


Link to post
Share on other sites
  • 0

you can use  mapannounce after warp player to the  mining map

 

mapannounce "guild_vs2", "wellcome ".+rid2name( $@warpwaitingpc[0] )+"....blah blah blah...", 0;

good am madam.. i just tried to put this here

 

( this is the line inside after the waiting room.. so i think i need to put it here.. but it ddnt work. so im wondering on how to deal with this

after being warped by the waiting room outside. )

 

guild_vs2,34,67,0 script Extreme Raid[Lever] 1907,{
 
    message strcharinfo(0), "Pulling the lever...";
    progressbar "green", .progress2;
specialeffect 234;
set .Spawn,rand(100,100); // How many Monster should spawn?
set .Map$,.Maps$[rand(getarraysize(.Maps$))];
 
 
//------------------
nothing special about the (welcome/introducer)announcer.. but for me it will make sense .. and will make a good story line for this event. that's why i really want to have an announcer before the event start..
Edited by leloush

Share this post


Link to post
Share on other sites

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

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.