YesNoOk
avatar

How to code "If this projectile hits the foe, set var5 to 1" and a followup- (Read 1452 times)

Started by Mimikyutest77, September 04, 2019, 10:34:17 pm
Share this topic:
How to code "If this projectile hits the foe, set var5 to 1" and a followup-
#1  September 04, 2019, 10:34:17 pm
  • avatar
  • **
    • UK
I want to code State 631 which fires a projectile straight forwards that, if it hits the foe, will set variable 5 to 1. Var(5) is normally zero. And if the attack misses, Var5 is untouched.

A special move on D,DF,F,A will shoot the projectile that does this. When Var(5) is 0 D,DF,F,A will fire this projectile.

But I need a second move connected to this state. If you do this move's input again once Var5 is set to 1 by successfully hitting your foe with the projectile, you get the attack in State 551, which also sets V5 back to 0 when it's done.
Re: How to code "If this projectile hits the foe, set var5 to 1" and a followup-
#2  September 04, 2019, 11:15:55 pm
  • ****
    • crepa.neocities.org
Code your projectile as a helper and use a ParentVarSet with trigger1 = MoveHit (or MoveContact, up to you). Then in the CMD, for the changestate you can use:
value = ifelse(var(5), 551, 631)
State 551 will need a second helper with ParentVarSet, but this time set it to 0 instead.