YesNoOk
avatar

Code to make character invincible so long as they have meter? (Read 4103 times)

Started by xmark12, February 13, 2021, 02:13:45 am
Share this topic:
Code to make character invincible so long as they have meter?
#1  February 13, 2021, 02:13:45 am
  • *
  • Incarnate
  • N/A
    • Philippines
I'm trying to add a Prevasion system for an edit of Gunvolt, where if you get hit, the attack won't do any damage. However, in exchange, every time Prevasion protects you, it'd drain a portion of your meter.

How would you go about adding that kind of code into MUGEN? I know a similar system is at play for Kor Sans, but I don't quite understand how that code works to implement it into my edit of Gunvolt.
Last Edit: February 13, 2021, 10:59:01 am by xmark12
Re: Code to make character invincible so long as they have meter?
#2  February 13, 2021, 04:21:03 am
  • avatar
  • **
    • USA
you just need a super armor code using hitoverride. in the super armor custom state put a power add so every time hitoverride is activated power is removed. If you don't want it to be a fixed amount and you want it to be the same amount as the opponents attack damage, put enemy,gethitvar(damage) for the value.
Follow Twitter: @MVDCGD
Subscribe Youtube: MVDCGD
Re: Code to make character invincible so long as they have meter?
#3  February 13, 2021, 07:13:12 am
  • *
  • Incarnate
  • N/A
    • Philippines
Would the super armor code be a normal statedef, or would it be something in -2 or -3?
Re: Code to make character invincible so long as they have meter?
#4  February 13, 2021, 08:08:41 am
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
Seravy's old method is still worth using for it
https://web.archive.org/web/20150405055826/http://elecbyte.com/wiki/index.php/Superarmor

Helper seems best for your case, you can just add most of it in, you just have to change some parameters.

Just some notes for what you have to change from Seravy's original code:
because you're using power and not health, change
Code:
[State -2, LifeAdd]
Type = LifeAdd
Trigger1 = NumHelper(11777) > 0 ; If the superarmor helper exists, subtract taken damage from life.
Trigger1 = fVar(29) >=1
Value = -floor(fVar(29))
ignorehitpause=1
to
Code:
[State -2,PowerAdd]
Type = PowerAdd
Trigger1 = NumHelper(11777) > 0 ; If the superarmor helper exists, subtract taken damage from life.
Trigger1 = fVar(29) >=1
Value = -floor(fVar(29))
ignorehitpause=1

And I assume you want the helper to disappear at 0 power, so change
Code:
[State 6965, DestroySelf]
Type = DestroySelf
Trigger1 = Superarmor ending condition.
ignorehitpause=1
to
Code:
[State 6965, DestroySelf]
Type = DestroySelf
Trigger1 = root,Power = 0
ignorehitpause=1
Re: Code to make character invincible so long as they have meter?
#5  February 13, 2021, 10:58:50 am
  • *
  • Incarnate
  • N/A
    • Philippines
It works, thanks!