YesNoOk
avatar

How does P1 add as much life as he/she take from a successful attack on P2? (Read 1166 times)

Started by Saturno, June 05, 2009, 02:43:27 pm
Share this topic:
How does P1 add as much life as he/she take from a successful attack on P2?
#1  June 05, 2009, 02:43:27 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
Hi.
I want to ask something a bit complicated. I want my char to add the same life that he takes from player2.
For example, when P1 attacks and causes a damage of 50 on P2, I want P1 to add 50 also, but ONLY IF the Hit is SUCCESSFUL.

I hope someone can help me, if this is possible to do in mugen...

Thanks a lot guys.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#2  June 05, 2009, 02:49:47 pm
  • **
  • Forever seeking..
[State 0, LifeAdd]
type = LifeAdd
trigger1 = Movehit
value = 50

(Thats the SIMPLE version without taking into account all the damage dampening and stuff)
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#3  June 05, 2009, 03:07:26 pm
  • ******
type = LifeAdd
trigger1 = Movehit
trigger1 = numtarget ; necessary to avoid a debug flood, even if you used movehit before
value = target,gethitvar(damage)
But that might be buggy in team mode if a move hits more than one enemy with the same hit.

And you definitely don't need a big green font to ask a question -_-
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#4  June 05, 2009, 05:56:39 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
type = LifeAdd
trigger1 = Movehit
trigger1 = numtarget ; necessary to avoid a debug flood, even if you used movehit before
value = target,gethitvar(damage)
But that might be buggy in team mode if a move hits more than one enemy with the same hit.

And you definitely don't need a big green font to ask a question -_-

Thank you byakko ;) I'll try this. Sorry about the big green font. It's just that I like the green colour. Thanks again.

[State 0, LifeAdd]
type = LifeAdd
trigger1 = Movehit
value = 50

(Thats the SIMPLE version without taking into account all the damage dampening and stuff)

Thank you SWTCH  too.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#5  June 06, 2009, 12:35:02 am
  • **
  • Forever seeking..
Anytime Brah  :sugoi:
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#6  June 07, 2009, 01:17:59 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
movehit = trigger while move is hitting, that's through the hitpause and for the entire hit.time of the hitdef. If it lasts 10 ticks you gain 200 life.

If you're not using state -2 for this but just adding it into each state, make sure you add

persistent = 0

to the lifeadd.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#7  June 07, 2009, 01:46:54 am
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
type = LifeAdd
trigger1 = Movehit
trigger1 = numtarget ; necessary to avoid a debug flood, even if you used movehit before
value = target,gethitvar(damage)
But that might be buggy in team mode if a move hits more than one enemy with the same hit.

Hi Byakko, I wanna tell you that this didn't work for me.
the problem was this line: value = target,gethitvar


movehit = trigger while move is hitting, that's through the hitpause and for the entire hit.time of the hitdef. If it lasts 10 ticks you gain 200 life.

If you're not using state -2 for this but just adding it into each state, make sure you add

persistent = 0

to the lifeadd.

Thanks Cyanide, I'll try what you told me. Thanks, man.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#8  June 07, 2009, 01:54:57 am
  • ******
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#9  June 07, 2009, 02:02:19 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
I'd be interested too, target, gethitvar(damage) should have functioned perfectly. Target doesn't need an ID specified, so there's no reason for that not to work.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#10  June 11, 2009, 05:53:33 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
Hi friends.
I'll post an example of what I have in my char. He adds life all the time he executes this state. But, as I said before, I only want him to add life if the hit is successful.
I hope you guys can help me. Thanks.


;---------------------------------------------------------------------------
; Standing Medium Punch
; CNS difficulty: easy
[StateDef 210]
type = S
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 210
poweradd = 20
sprpriority = 2

[State 210, 1]
type = HitDef
trigger1 = AnimElem = 2
attr = S, NA
damage = 100
animtype = Light
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 10, 10
sparkno = 0
sparkxy = -10, -76
hitsound = 5, 0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = -4
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12




[State 210, LifeAdd]
type = LifeAdd
trigger1 =  AnimElem = 4
value = 10
kill = 1
absolute = 0
;ignorehitpause =
;persistent =




[State 210, end]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#11  June 11, 2009, 07:39:57 pm
  • **
Change the trigger of the LifeAdd controller to
[mcode]trigger1 = movehit=1[/mcode]
Latest Creation: SSBB Assist Trophies
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#12  June 12, 2009, 05:58:35 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#13  June 16, 2009, 05:54:38 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
Change the trigger of the LifeAdd controller to
[mcode]trigger1 = movehit=1[/mcode]

Thank you very much ;) I'll try this.

This woked very well. Thank you.

By the way:
I want to make my char add life instead of being damaged by the enemy's projectiles. That is to say, if the enemy throws a projectile, I want him to add life if he is touched by the projectile (as if he makes himself stronger when being attacked by projectiles) Does anyone know how can I do that? I would really appreciate your help. Thank you.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#14  June 16, 2009, 06:21:19 pm
  • ******
  • [E]
    • Mexico

  • Online
use the lifeadd controller in state 5000, use the gethitvar as a trigger.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#15  June 16, 2009, 06:30:47 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#16  July 08, 2009, 10:31:11 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
use the lifeadd controller in state 5000, use the gethitvar as a trigger.
Thank you very much Frederika ;) I'll try this.

Hi Frederika Bernkastel. I wanna tell you that I've been trying to use the lifeadd controller in state 5000 and the gethitvar as a trigger as you told me to do so. However I must have done something wrong, because I can't make my char add life instead of being damaged by the enemy's projectiles. What I have done is adding life all the time the enemy hits my char, but that's not what I tried to do.   
"I want to make my char add life instead of being damaged by the enemy's projectiles. That is to say, if the enemy throws a projectile, I want him to add life if he is touched by the projectile (as if he makes himself stronger when being attacked by projectiles) but I don't want my char to add ife if the enemy attacks him with a punch or a kick, or any other kind of attack which is not a projectile.

Is it here that I've got to add the coding?


;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;HITG_SLIDE

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5000, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#17  July 08, 2009, 10:56:23 pm
  • ******
... It's nearly impossible to tell if you were hit by a punch or a fireball once you have been hit. What might be possible is add a [mcode]HitOverride[/mcode] that can override projectiles (P in the attr parameter) and send you to a special gethit state, copied from the original one, that adds life. Also, restore your gethit states to normal (remove them from your file, they're in the common1.cns already, you don't need to override them by having them in your files if you don't modify them)

the difference with this and the gethitvar method is that gethitvar can't look up the attr parameter of the attacker's hitdef.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#18  July 09, 2009, 07:24:19 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
... It's nearly impossible to tell if you were hit by a punch or a fireball once you have been hit. What might be possible is add a [mcode]HitOverride[/mcode] that can override projectiles (P in the attr parameter) and send you to a special gethit state, copied from the original one, that adds life. Also, restore your gethit states to normal (remove them from your file, they're in the common1.cns already, you don't need to override them by having them in your files if you don't modify them)

the difference with this and the gethitvar method is that gethitvar can't look up the attr parameter of the attacker's hitdef.

Thank you Byakko. Your explanation is very clear.  ;)
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#19  July 12, 2009, 09:09:29 pm
  • ***
  • Street Fighter II the game that changed everything
    • sites.google.com/site/mugenuba/
... It's nearly impossible to tell if you were hit by a punch or a fireball once you have been hit. What might be possible is add a [mcode]HitOverride[/mcode] that can override projectiles (P in the attr parameter) and send you to a special gethit state, copied from the original one, that adds life. Also, restore your gethit states to normal (remove them from your file, they're in the common1.cns already, you don't need to override them by having them in your files if you don't modify them)

the difference with this and the gethitvar method is that gethitvar can't look up the attr parameter of the attacker's hitdef.

HI Byakko I've been trying this but I can't do it. Could you give me an example of how to do it? What do I have to write in trigger1=......... ? I've seen some things like: ProjContac (*,***); ProjContactTime; ProjHit (*,***) and ProjHitTime.   Could they be useful for what I want to do? If so, how are they used?
Thanks for helping.
Re: How does P1 add as much life as he/she take from a successful attack on P2?
#20  July 12, 2009, 09:49:36 pm
  • ******
The hitoverride is used to override the regular gethit behavior as long as it is activated.
What you want is have a HitOverride active constantly (put it in statedef -2) that will work on projectiles - put a P in the attr parameter of your hitoverride.
So with that, you will have a hitoverride that will be active when you get hit by a projectile. You want it to send you to a specific gethit state, which should be a copy of the regular gethit states (the 5000+ states in common1.cns) that's something you do by setting the parameters of the hitoverride correctly. Just look at the docs for that.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.