- Joined
- Jun 24, 2020
- Messages
- 11
- Reaction score
- 0
- First Language
- English
- Primarily Uses
- RMMV
I'm making a magic attack right now called "Cast" where it has a chance to...
Mind you, the code is very bare bones right now, it's just for reference.
- 10% to backfire on the user. (User takes decreased damage from their attack instead.)
- 20% to fail. (It does nothing.)
- 60% to succeed and hit its target.
- 10% to still and deal bonus damage to its target.
Code:
<setup action>
display action
eval: $gameVariables.setValue(11, Math.random())
</setup action>
<target action>
action animation
wait for animation
if $gameVariables.value(11) < 0.1
eval: BattleManager.addText("...but it backfires.", 0)
else if ($gameVariables.value(11) >= 0.1 && $gameVariables.value(11) < 0.3)
SE: Buzzer1
eval: BattleManager.addText("...but nothing happens.", 0)
else if ($gameVariables.value(11) >= 0.3 && $gameVariables.value(11) < 0.9)
action effect: target
eval: BattleManager.addText("...and fires a magical beam!", 0)
else if $gameVariables.value(11) >= 0.9
eval: BattleManager.addText("crit.", 0)
end
</target action>
<finish action>
wait: 60
clear battle log
</finish action>
Mind you, the code is very bare bones right now, it's just for reference.