Total Miner Forums
Total Miner => Creative Features => Topic started by: Forgeplex on April 06, 2018, 06:04:33 PM
-
Does anybody know how to make this?
-
var [num] = [rand:2]
If
IsVar [num] [=] [0]
Then
Inventory [player] [add] [reward1] [1]
ElseIf
IsVar [num] [=] [1]
Then
Inventory [player] [add] [reward2] [1]
ElseIf
IsVar [num] [=] [2]
Then
Inventory [player] [add] [reward3] [1]
Else
EndIf
If this is what you mean it just gets a random number between 0-2, and then gives a certain item for each number
-
var [num] = [rand:2]
If
IsVar [num] [=] [0]
Then
Inventory [player] [add] [reward1] [1]
ElseIf
IsVar [num] [=] [1]
Then
Inventory [player] [add] [reward2] [1]
ElseIf
IsVar [num] [=] [2]
Then
Inventory [player] [add] [reward3] [1]
Else
EndIf
If this is what you mean it just gets a random number between 0-2, and then gives a certain item for each number
A slightly more streamlined version. Since if num is not 0 and not 1 we know it must be 2 so the last ElseIf is unnecessary.
var [num] = [rand:2]
If
IsVar [num] [=] [0]
Then
Inventory [player] [add] [reward1] [1]
ElseIf
IsVar [num] [=] [1]
Then
Inventory [player] [add] [reward2] [1]
Else
Inventory [player] [add] [reward3] [1]
EndIf
-
var [num] = [rand:2]
If
IsVar [num] [=] [0]
Then
Inventory [player] [add] [reward1] [1]
ElseIf
IsVar [num] [=] [1]
Then
Inventory [player] [add] [reward2] [1]
ElseIf
IsVar [num] [=] [2]
Then
Inventory [player] [add] [reward3] [1]
Else
EndIf
If this is what you mean it just gets a random number between 0-2, and then gives a certain item for each number
A slightly more streamlined version. Since if num is not 0 and not 1 we know it must be 2 so the last ElseIf is unnecessary.
var [num] = [rand:2]
If
IsVar [num] [=] [0]
Then
Inventory [player] [add] [reward1] [1]
ElseIf
IsVar [num] [=] [1]
Then
Inventory [player] [add] [reward2] [1]
Else
Inventory [player] [add] [reward3] [1]
EndIf
Thanks to Craig and Lunar! :D