• 0

random box script %

Question

here is the script
set [email protected],9;
//<%>,<ItemID>,<Amount>
setarray [email protected][0],1,512,1; //Gallon Hat of Flame
setarray [email protected][0],3,512,1; //Canopy
setarray [email protected][0],5,7179,10; //PODS
setarray [email protected][0],30,969,150; //(Gold)
setarray [email protected][0],80,12016,10; //Speed_Up_Potion
setarray [email protected][0],90,12214,5; //12214
setarray [email protected][0],95,12412,5; //HE_Bubble_Gum
setarray [email protected][0],70,12103,5; //Bubble Gum
setarray [email protected][0],rand(13517,12534,12103,6767,3100,7227,7608,6420,981,983),rand(1,20);
set [email protected], rand(1,[email protected]);
if (rand(1,100) > getd("[email protected]"[email protected]+"[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?

Recommended Posts

• 0

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

Share on other sites

• 0
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 [email protected][0],10,512,1; //Gallon Hat of Flame
setarray [email protected][0],10,512,1; //Canopy
setarray [email protected][0],10,7179,10; //PODS
setarray [email protected][0],10,969,150; //(Gold)
all %  = 10% there is no conflict on that?

Share on other sites

• 0

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.

Share on other sites

• 0

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

Share on other sites

• 0
```        set [email protected],12;
setarray [email protected][0],1,1230,1; //Ice Pick
setarray [email protected][0],1,5135,1; //Cyclops
setarray [email protected][0],1,4365,1; // HW Card
setarray [email protected][0],1,4451,1; // Crothen Card
setarray [email protected][0],1,18885,1; // Jejecap
setarray [email protected][0],1,20036,1; // Sword Master Crown
setarray [email protected][0],1,4357,1; // LK Card
setarray [email protected][0],1,4403,1; // kiel card
setarray [email protected][0],20,12210,20; // BGUM
setarray [email protected][0],30,7227,20; // TCG
setarray [email protected][0],100,7227,2; // TCG
setarray [email protected][0],100,7227,2; // TCG
do{
set [email protected], rand(1,[email protected]);
}while( rand(1,100) > getd("[email protected]"[email protected]+"[0]") );

for(set [email protected],1; [email protected]<getarraysize(getd("[email protected]"[email protected])); set [email protected],[email protected]+2)
{
getitem getd("[email protected]"[email protected]+"["[email protected]+"]"), getd("[email protected]"[email protected]+"["+([email protected]+1)+"]");
if ([email protected][0])
{
set [email protected],[email protected];
setarray [email protected][0], getd("[email protected]"[email protected]+"["[email protected]+"]"), getd("[email protected]"[email protected]+"["+([email protected]+1)+"]");
break;
}
}
if( [email protected] && [email protected] <= 10 ) // 10% equal or below will announce
announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname([email protected][0])+" x "[email protected][1]+" from Lotti Girl",0;
specialeffect2 248;
close;```

Share on other sites

• 0
9 hours ago, Poring King said:
```        set [email protected],12;
setarray [email protected][0],1,1230,1; //Ice Pick
setarray [email protected][0],1,5135,1; //Cyclops
setarray [email protected][0],1,4365,1; // HW Card
setarray [email protected][0],1,4451,1; // Crothen Card
setarray [email protected][0],1,18885,1; // Jejecap
setarray [email protected][0],1,20036,1; // Sword Master Crown
setarray [email protected][0],1,4357,1; // LK Card
setarray [email protected][0],1,4403,1; // kiel card
setarray [email protected][0],20,12210,20; // BGUM
setarray [email protected][0],30,7227,20; // TCG
setarray [email protected][0],100,7227,2; // TCG
setarray [email protected][0],100,7227,2; // TCG
do{
set [email protected], rand(1,[email protected]);
}while( rand(1,100) > getd("[email protected]"[email protected]+"[0]") );

for(set [email protected],1; [email protected]<getarraysize(getd("[email protected]"[email protected])); set [email protected],[email protected]+2)
{
getitem getd("[email protected]"[email protected]+"["[email protected]+"]"), getd("[email protected]"[email protected]+"["+([email protected]+1)+"]");
if ([email protected][0])
{
set [email protected],[email protected];
setarray [email protected][0], getd("[email protected]"[email protected]+"["[email protected]+"]"), getd("[email protected]"[email protected]+"["+([email protected]+1)+"]");
break;
}
}
if( [email protected] && [email protected] <= 10 ) // 10% equal or below will announce
announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname([email protected][0])+" x "[email protected][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...

Share on other sites

• 0

F_rand is 2 or more while rand is 2 only

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.