Seen 5 Days Ago
Posted 3 Weeks Ago
1 posts
27 Days
This is my first foray into scripting. I did some research prior and have tried a couple different inputs. So far this is the only one I've tried that doesn't crash the game with a scripting error but it doesn't actually give the player any pokemon:

if random3==0
elseif random3==1
elseif random3==2
elseif random3==3

What is the appropriate way to make an event tile give a random reward?

Amras Anárion

Age 32
Seen 2 Days Ago
Posted 3 Days Ago
31 posts
2.5 Years
I would advise you to use a RMXP variable and assign your random value to it. I would advise you to use a RMXP variable and assign your random value to it. By default, it is variable 7 for Essentials.

Afterwards, you can use the conditions "If variable = 0, 1, 2 or 3" to give the appropriate consequences to the continuation of your adventure (for example: quote the good name of your starter or modify the team of the rival).

$game_variables[7] = rand(4)
if $game_variables[7] == 0
elsif $game_variables[7] == 1
elsif $game_variables[7] == 2
else #Ensure that at least one starter is given
$game_switches[3] = false #Switch used *in Essentials to determine whether the player is in the middle of choosing a starter.
Also, Beware of the ruby syntax : it's "elsif" and not "elseif".
If the script is entered in an event-making command, it must be in one block. Otherwise, your instance variable "random3" is lost and returns "nil", which will generate an inequality on all your comparisons, so only false conditions.