# Total Miner Forums

## Total Miner => Creative Features => Topic started by: Forgeplex on April 06, 2018, 06:04:33 PM

Title: Random Reward Script
Post by: Forgeplex on April 06, 2018, 06:04:33 PM
Does anybody know how to make this?
Title: Re: Random Reward Script
Post by: Lunar on April 07, 2018, 12:37:01 PM

var [num] = [rand:2]

If
IsVar [num] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
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
Title: Re: Random Reward Script
Post by: Craig on April 08, 2018, 02:59:45 AM

var [num] = [rand:2]

If
IsVar [num] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
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] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
Else
EndIf

Title: Re: Random Reward Script
Post by: Forgeplex on April 15, 2018, 03:38:54 PM

var [num] = [rand:2]

If
IsVar [num] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
ElseIf
IsVar [num] [=] 
Then
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] [=] 
Then