The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Topic started by: xmark12 on February 13, 2021, 02:13:45 AM

Title: Code to make character invincible so long as they have meter?
Post by: xmark12 on February 13, 2021, 02:13:45 AM
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.
Title: Re: Code to make character invincible so long as they have meter?
Post by: MDCGD on February 13, 2021, 04:21:03 AM
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.
Title: Re: Code to make character invincible so long as they have meter?
Post by: xmark12 on February 13, 2021, 07:13:12 AM
Would the super armor code be a normal statedef, or would it be something in -2 or -3?
Title: Re: Code to make character invincible so long as they have meter?
Post by: Bannana on February 13, 2021, 08:08:41 AM
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
Title: Re: Code to make character invincible so long as they have meter?
Post by: xmark12 on February 13, 2021, 10:58:50 AM
It works, thanks!