Total Miner Forums
Total Miner => Creative Features => Topic started by: Jakub34 on November 22, 2017, 08:11:14 PM

Var [loot] = [1] [+] [rand:3]
If
IsVar [loot] = [1]
then
Inventory [player] [add] [apple] [1]
elseif
IsVar [loot] = [2]
then
Inventory [player] [add] [apple] [2]
elseif
IsVar [loot] = [3]
then
Inventory [player] [add] [apple] [3]
elseif
As far as I understand, the variable script should choose a random number between 13. ( Hopefully it is not including decimals... ) The script works perfectly, but sometimes, the script will not give an apple.

[rand:3] returns a random value between 0 and 3 inclusive, either 0, 1, 2 or 3. That's 4 possible numbers.
change your script to [rand:2]

[rand:3] returns a random value between 0 and 3 inclusive, either 0, 1, 2 or 3. That's 4 possible numbers.
change your script to [rand:2]
Guess that script documentation was a bit misleading then ;s It applied it to the name instead of the rand, so who knows :s
Tanks for the help.

With variables, is it a random chance for each one? Im trying to figure out an easier way to make drop chances happen in scripts
for instance, i click a button which gives me a chance to get a sword. The chance of a higher tier sword dropping is dependant on the percentage. but is there an easier way to do it?

With variables, is it a random chance for each one? Im trying to figure out an easier way to make drop chances happen in scripts
for instance, i click a button which gives me a chance to get a sword. The chance of a higher tier sword dropping is dependant on the percentage. but is there an easier way to do it?
The script rolls a random number between the numbers you chose. In my case (when I changed the script), I rolled a number between 1 and 3. If my number landed on 1, I get 1 apple. If my number landed on two, I get 2 apples.
To answer your question, this is way better for drop chances. Say you have wood swords and iron swords. You will roll a random number between 15, upon pressing the button. Wood sword has the values of 1,3,5 and iron sword has 2,4. Rolling 1,3,5 will give a wood sword, and rolling 2 or 4 will give iron sword. Now, let's say iron sword has a value of 3. Rolling a 3 will give you both the iron and wood sword.

To answer your question, this is way better for drop chances. Say you have wood swords and iron swords. You will roll a random number between 15, upon pressing the button. Wood sword has the values of 1,3,5 and iron sword has 2,4. Rolling 1,3,5 will give a wood sword, and rolling 2 or 4 will give iron sword. Now, let's say iron sword has a value of 3. Rolling a 3 will give you both the iron and wood sword.
how would you write that in the script? [rand:1,3,5] is a completely random guess

To answer your question, this is way better for drop chances. Say you have wood swords and iron swords. You will roll a random number between 15, upon pressing the button. Wood sword has the values of 1,3,5 and iron sword has 2,4. Rolling 1,3,5 will give a wood sword, and rolling 2 or 4 will give iron sword. Now, let's say iron sword has a value of 3. Rolling a 3 will give you both the iron and wood sword.
how would you write that in the script? [rand:1,3,5] is a completely random guess
Just follow what I have. I'm not 100% sure on what number to use (since my script somehow had a 0 in it), but if you did Var [loot] = [1]  [rand:2], you would roll a random number between 13

My point is how do you control how many of those are 1 item and the others a different item.

Also you have operators mixed up, on IsVar it would be
 , on Var it would be + (no brackets)

Okay so
If
IsVar [Ran:3] [0,1,2]?

Okay so
If
IsVar [Ran:3] [0,1,2]?
IDK exactly but that sounds right

IDK exactly but that sounds right
no i got it now, i got taught by MrMarooca. He's such a good teacher.
what it is, is:
Var [loot] [Rand:2]
If
IsVar [loot] [=]
Then
Inventory [player] [add] [apple] [1]
ElseIf
IsVar [loot] [=] [1]
Then
Inventory [player] [add] [apple] [2]
ElseIf
IsVar [loot] [=] [2]
Then
Inventory [player] [add] [apple] [3]
Edit: no idea why there's a dot in the way :/