- Joined
- Oct 16, 2016
- Messages
- 7
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Hello there,
So, I'm having trouble with a particular skill. I want it to randomly choose from among 8 possible outcomes. I'm using a random number between 1 and 8 assigned to a value which should then be read by the if...then statement to decide which outcome to choose, but either the variable isn't being set to said random int or the if...then isn't reading the variable. It always performs the default action (nothing) for if the variable isn't set to a number between 1 and 8.
I'm using yanfly's Battle Core notetags to do this, so everything happens in a <target action> as part of a skill notetag.
I am not JS fluent (at all), so I'm guessing that I'm probably missing something elementary. Any ideas on how to fix this?
So, I'm having trouble with a particular skill. I want it to randomly choose from among 8 possible outcomes. I'm using a random number between 1 and 8 assigned to a value which should then be read by the if...then statement to decide which outcome to choose, but either the variable isn't being set to said random int or the if...then isn't reading the variable. It always performs the default action (nothing) for if the variable isn't set to a number between 1 and 8.
I'm using yanfly's Battle Core notetags to do this, so everything happens in a <target action> as part of a skill notetag.
I am not JS fluent (at all), so I'm guessing that I'm probably missing something elementary. Any ideas on how to fix this?
Code:
<target action>
eval: $gameVariables.setValue[10] = Math.randomInt(8)+1;
perform action
if ($gameVariables.value[10] == 1)
animation 3: target
eval this.elementID = 4
action effect
add state 12: target
else if ($gameVariables.value[10] == 2)
animation 4: target
eval this.elementID = 5
action effect
add state 13: target
else if ($gameVariables.value[10] == 3)
animation 5: target
eval this.elementID = 6
action effect
add state 14: target
else if ($gameVariables.value[10] == 4)
animation 2: target
action effect
add state 5: target
else if ($gameVariables.value[10] == 5)
animation 2: target
action effect
add state 6: target
else if ($gameVariables.value[10] == 6)
animation 2: target
action effect
add state 15: target
else if ($gameVariables.value[10] == 7)
animation 2: target
action effect
add state 16: target
else if ($gameVariables.value[10] == 8)
animation 2: target
action effect
add state 17: target
else
break action
</target action>


