RPG Maker Forums

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?

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>

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top