Jump to content
  • 0

Need help using rand command.


Question

Posted (edited)
sec_in02,154,165,6    script    Fishing Hole    723,{
    
//Fishing rod
set .@Rod,2764;
//Fishing Lure
set .@Lure,2775;
//Auto-Fish
set .@Auto,1;
//Auto-Fish on Fail
set .@AutoFail,1;
Fish:
    if (isequipped(.@Rod)) && (isequipped(.@Lure)){
        specialeffect EF_BUBBLE,"Fishing Hole";

        dispbottom "[Fishing] Baiting.....";
        set .@fcast,11;
            if (isequipped(2550)) { //Fisher's Muffler
                set .@fcast,.@fcast - 2;
            }
            if (isequipped(2443)) { //Fisher's Boots
                set .@fcast,.@fcast - 2;
            }
            if (isequipped(2764)) { //Fishing Rode
                set .@fcast,.@fcast - 3;
            }
            if (isequipped(2775)) { //Fishing Lure
                set .@fcast,.@fcast - 1;
            }
        progressbar "ffffff",.@fcast;
        if (rand(1,40) == 2){
        getitem 26080,1; //Credit
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught a ATM Credit Card x1!",bc_map,"0xff77ff";
        }
        if (rand(1,40) == 2){
        getitem 7227,5; //TCG
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught TCG Cards x5!",bc_map,"0xff77ff";
        }
        if (rand(1,50) == 2){
        getitem 671,1; //Gold Coins
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught a Gold Coin x1!",bc_map,"0xff77ff";
        }
        if(.@Auto==1){
        goto Fish;}else{
        end;}     
        } else {
    dispbottom "[Fishing] You need a Fishing Rod and Lure.";
    end;
    }


}

This is my script. Actually this script is working. I just don't understand the "rand"

I want 10% for ATM Credit
I want 5% for TCG Card
and 1% for Gold Coin.

PLEASE HELP!

 

Edited by TheDerpySupport
Codebox

2 answers to this question

Recommended Posts

  • 0
Posted

Well this is my script you're using so It's relatively easy to understand;

        if (rand(0,9) == 2){
        getitem 26080,1; //Credit
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught a ATM Credit Card x1!",bc_map,"0xff77ff";
        }

This would be 10%
rand(0,19) would be 5% and 1% would be rand(0,99)

  • Love 1
  • 0
Posted (edited)
sec_in02,154,165,6    script    Fishing Hole    723,{
    
//Fishing rod
set .@Rod,2764;
//Fishing Lure
set .@Lure,2775;
//Auto-Fish
set .@Auto,1;
//Auto-Fish on Fail
set .@AutoFail,1;
Fish:
    if (isequipped(.@Rod)) && (isequipped(.@Lure)){
        specialeffect EF_BUBBLE,"Fishing Hole";

        dispbottom "[Fishing] Baiting.....";
        set .@fcast,11;
            if (isequipped(2550)) { //Fisher's Muffler
                set .@fcast,.@fcast - 2;
            }
            if (isequipped(2443)) { //Fisher's Boots
                set .@fcast,.@fcast - 2;
            }
            if (isequipped(2764)) { //Fishing Rode
                set .@fcast,.@fcast - 3;
            }
            if (isequipped(2775)) { //Fishing Lure
                set .@fcast,.@fcast - 1;
            }
        progressbar "ffffff",.@fcast;
        if (rand(1,10) == 2){ // 10%
        getitem 26080,1; //Credit
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught a ATM Credit Card x1!",bc_map,"0xff77ff";
        }
        if (rand(1,20) == 2){ // 5%
        getitem 7227,5; //TCG 
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught TCG Cards x5!",bc_map,"0xff77ff";
        }
        if (rand(1,100) == 2){ 1%
        getitem 671,1; //Gold Coins
        specialeffect2 EF_TEMP_OK;
        mapannounce strcharinfo(3),strcharinfo(0)+" has caught a Gold Coin x1!",bc_map,"0xff77ff";
        }
        if(.@Auto==1){
        goto Fish;}else{
        end;}     
        } else {
    dispbottom "[Fishing] You need a Fishing Rod and Lure.";
    end;
    }


}

Applying the basic math for percentage will do the trick.

Edited by crazyarashi
  • Love 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...