Jump to content
  • 0

random box script %


Kudo

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  97
  • Reputation:   0
  • Joined:  08/18/12
  • Last Seen:  

here is the script 
set .@Total,9;
    //<%>,<ItemID>,<Amount>
    setarray .@P1[0],1,512,1; //Gallon Hat of Flame
    setarray .@P2[0],2,512,1; //Crow_Tengu_Mask
    setarray .@P3[0],3,512,1; //Canopy 
    setarray .@P4[0],5,7179,10; //PODS
    setarray .@P5[0],30,969,150; //(Gold) 
    setarray .@P6[0],80,12016,10; //Speed_Up_Potion
    setarray .@P7[0],90,12214,5; //12214
    setarray .@P8[0],95,12412,5; //HE_Bubble_Gum
    setarray .@P9[0],70,12103,5; //Bubble Gum
    setarray .@Default[0],rand(13517,12534,12103,6767,3100,7227,7608,6420,981,983),rand(1,20);
    set .@i, rand(1,.@Total);
    if (rand(1,100) > getd(".@P"+.@i+"[0]"))

i want to know if it is ok to put same % of items on array or it will have a conflict?
and for the default array did i make the right codes?

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  215
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

Hello,

rand(13517,12534,12103,6767,3100,7227,7608,6420,981,983)

You need F_rand to do that (a script function). rand is just for maximum 2 numbers:

*rand(<number>{,<number>});

This function returns a number ...
(if you specify one) ... randomly positioned between 0 and the number you specify -1.
(if you specify two) ... randomly positioned between the two numbers you specify.

rand(10)  would result in 0,1,2,3,4,5,6,7,8 or 9
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(2,5) would result in 2,3,4 or 5

The rest seems good to me

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  97
  • Reputation:   0
  • Joined:  08/18/12
  • Last Seen:  

3 minutes ago, Kreustoo said:

Hello,


rand(13517,12534,12103,6767,3100,7227,7608,6420,981,983)

You need F_rand to do that (a script function). rand is just for maximum 2 numbers:


*rand(<number>{,<number>});

This function returns a number ...
(if you specify one) ... randomly positioned between 0 and the number you specify -1.
(if you specify two) ... randomly positioned between the two numbers you specify.

rand(10)  would result in 0,1,2,3,4,5,6,7,8 or 9
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(2,5) would result in 2,3,4 or 5

The rest seems good to me

so you mean its ok if i put this one?
  setarray .@P1[0],10,512,1; //Gallon Hat of Flame
    setarray .@P2[0],10,512,1; //Crow_Tengu_Mask
    setarray .@P3[0],10,512,1; //Canopy 
    setarray .@P4[0],10,7179,10; //PODS
    setarray .@P5[0],10,969,150; //(Gold) 
all %  = 10% there is no conflict on that?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  215
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

I'm not sure what you're trying to achieve but yeah no problem as a script.

For what I see on your first post, you'll chose one box and then test if he can get it or not checking on the % position.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  97
  • Reputation:   0
  • Joined:  08/18/12
  • Last Seen:  

can you give me an example of the f_rand so that i can use..

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

        set .@Total,12;    
        setarray .@P1[0],1,1230,1; //Ice Pick
        setarray .@P2[0],1,5135,1; //Cyclops
        setarray .@P3[0],1,4365,1; // HW Card
        setarray .@P4[0],1,4451,1; // Crothen Card
        setarray .@P5[0],1,18885,1; // Jejecap
        setarray .@P6[0],1,20036,1; // Sword Master Crown
        setarray .@P7[0],1,4357,1; // LK Card
        setarray .@P8[0],1,4403,1; // kiel card
        setarray .@P9[0],20,12210,20; // BGUM
        setarray .@P10[0],30,7227,20; // TCG
        setarray .@P11[0],100,7227,2; // TCG
        setarray .@P12[0],100,7227,2; // TCG
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl",0;
    specialeffect2 248;
    close;

 

  • Upvote 1
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  97
  • Reputation:   0
  • Joined:  08/18/12
  • Last Seen:  

9 hours ago, Poring King said:

        set .@Total,12;    
        setarray .@P1[0],1,1230,1; //Ice Pick
        setarray .@P2[0],1,5135,1; //Cyclops
        setarray .@P3[0],1,4365,1; // HW Card
        setarray .@P4[0],1,4451,1; // Crothen Card
        setarray .@P5[0],1,18885,1; // Jejecap
        setarray .@P6[0],1,20036,1; // Sword Master Crown
        setarray .@P7[0],1,4357,1; // LK Card
        setarray .@P8[0],1,4403,1; // kiel card
        setarray .@P9[0],20,12210,20; // BGUM
        setarray .@P10[0],30,7227,20; // TCG
        setarray .@P11[0],100,7227,2; // TCG
        setarray .@P12[0],100,7227,2; // TCG
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 10 ) // 10% equal or below will announce
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from Lotti Girl",0;
    specialeffect2 248;
    close;

 

this script is from lotti npc right? is it alright to use this in random box?? what is the difference between this 2 script...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

F_rand is 2 or more while rand is 2 only

Link to comment
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.   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.

×
×
  • Create New...