Revival code

Started by Ichisennen, November 28, 2010, 01:34:36 PM

Previous topic - Next topic

Ichisennen

So I've been working on this code which will allow me to remain with 1 hp even after a KO-inducing hit. It does work, problem is, when this character fights himself...... Well, it bugs, and none of them dies. Although he does die when he's fighting others.

Another note is that I've also included a defense code which buffs up my defence when Im at low health.
Code:

[Statedef -2]

[State -2,011]
Type=VarAdd
Trigger1=life<var(36)
fv=15
value=(var(36)-life)*fvar(14)
ignorehitpause=1

[State -2,012]
Type=LifeAdd
triggerall = life < 300
Trigger1=life>=1
Trigger1=abs(fvar(15))>=1
value=floor(fvar(15))
absolute=1
ignorehitpause=1

[State -2,011]
Type=VarAdd
Trigger1=life<var(36)
fv=18
value=(var(36)-life)*fvar(17)
ignorehitpause=1

[State -2,013]

Type=VarSet
Trigger1=1
fv=15
value=fvar(15)-floor(fvar(15))
ignorehitpause=1

[State -2,015]
Type=VarSet
Trigger1=1
fv=14
value = 0.5
ignorehitpause=1

[State -2,014]
Type=VarSet
Trigger1=1
v=36
value=Life
ignorehitpause=1

[State -2]
Type=Assertspecial
Trigger1=var(37)>0
Trigger1=P2life>0
flag=NoKo
ignorehitpause=1

[State -2]
Type=Lifeset
Trigger1=var(37)>0
Trigger1=Life<=0
value=1
ignorehitpause=1

[State -2]
Type=VarSet
Trigger1=1
var(37)=(movetype=H) || (Life>1)
ignorehitpause=1


So what do you guys think is wrong..?

Cyanide

Fuck knows, add some comments so we get a better idea of what the hell all those variables are actually for. I am surprised the system needs to be so complicated.

lifeset
trigger1 = life < gethitvar(damage)
value = 1

I assume you wish to achieve something else?


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.

leandro1412

#2
This code doesn't works, its imposible "Realive" any character after KO, you can fill his life again and see your player stand again but you can't keep fighting.

one stupid idea is make a helper to fight and hide real character after helper dies with some code you can show your character again aand keep fighting.. i really don't know if exist other way... but revive your character its impossible.  --;
[

Nice userbars no? :P Make click & Download something nice for your Mugen!!!
________________________________

Ricepigeon

Quote from: leandro1412 on November 29, 2010, 02:19:16 AM
i really don't know if exist other way... but revive your character its impossible.  --;

Gill and Mokou say hi

Ichisennen

Quote from: leandro1412 on November 29, 2010, 02:19:16 AM
This code doesn't works, its imposible "Realive" any character after KO, you can fill his life again and see your player stand again but you can't keep fighting.

one stupid idea is make a helper to fight and hide real character after helper dies with some code you can show your character again aand keep fighting.. i really don't know if exist other way... but revive your character its impossible.  --;

Sorry, wrong name. Its impossible to revive any character, only make them remain with one hp after a hit, then make them go into some custom state, or make a helper fight like you said. Only this code is more of a second chance thing, since he doesn't go into any custom state/revival animation, just remain with on hp. And yes, this code works, and yes I can still fight. Try copy pasting it into your character, just avoid using the same variable with already used in that character.

Quote from: Cyanide on November 28, 2010, 08:34:07 PM
Fuck knows, add some comments so we get a better idea of what the hell all those variables are actually for. I am surprised the system needs to be so complicated.

lifeset
trigger1 = life < gethitvar(damage)
value = 1

I assume you wish to achieve something else?

Sorry,  I copy pasted the whole -2 state into this post. To narrow it down, the "remain with 1 hp code" itself is:

[State -2]
Type=Assertspecial
Trigger1=var(37)>0
Trigger1=P2life>0
flag=NoKo
ignorehitpause=1

[State -2]
Type=Lifeset
Trigger1=var(37)>0
Trigger1=Life<=0
value=1
ignorehitpause=1

[State -2]
Type=VarSet
Trigger1=1
var(37)=(movetype=H) || (Life>1)
ignorehitpause=1

Now I only included the other things because I thought you guys would want to see the other things in my -2 state to help me better............... guess i was wrong.

That bit of code you were saying the life < gethitvar is part of the armor code... disregard that........

Ricepigeon

Quote from: Ichisennen on November 29, 2010, 03:37:14 PM
[State -2]
Type=Assertspecial
Trigger1=var(37)>0
Trigger1=P2life>0
flag=NoKo
ignorehitpause=1



Last time I checked, NoKo isnt a valid flag for the assertspecial controller

Cyanide

NoKo is valid, it's an undocumented incomplete sctrl. It works, but not how you'd expect.

While asserted NOBODY can be knocked out.
If you lose all your life during NoKO and then gain it back, when noko is turned off, you lose anyway.

Ditto for p2. Not the best solution as implementation is incomplete.


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.

Riptide

what about turning it off then gaining more life?

Why not send out a clone when life is at 10, let the helper fight for a while then remove it after a few hits?

Ricepigeon

Quote from: Riptide on November 29, 2010, 08:33:43 PM
what about turning it off then gaining more life?

Why not send out a clone when life is at 10, let the helper fight for a while then remove it after a few hits?

You have 300 life. Opponent uses a level 3 that deals 400 damage in a single hit.

There are too many scenarios where this wouldnt work. Iirc, using a player type helper used to solve this problem in the older versions of mugen, but no longer worked once it became depricated.

One disadvantage to the clone helper method is that helpers can't inherit the -2 and -3 states.

Riptide

You mean the player type isn't in mugen 1 or ...what?
deprecated doesn't mean no longer working. Or do you mean it is deprecated and doesn't work.

Cyanide

Deprecated means it still functions but it may be removed from mugen altogether. Basically if you use it it may not function in the next release and you will need a better solution.

This is also why you should use animelemtime over animelem and explod over gamemakeanim.


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.

leandro1412

lol XD Cyanide code Works but i have to update a little  :sugoi: to make your request

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

[State 0, LifeSet]
type = LifeSet
trigger1 = Gethitvar(Damage) >= Life
value = 1
ignorehitpause = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = Gethitvar(Damage) >= Life
flag = noko
ignorehitpause = 1

[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),Ifelse(Facing != Enemy,Facing,5000,5010),Ifelse(Facing != Enemy,Facing,5010,5000)) + 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

Put this code in 5020 5030 5070 and any start gethit state :D

well you can limit that using a variable ;D try it, really works, don't care your life or gethitvar damage value.

(Target lifeadd and lifeadd could be fixed in -2)

any way like Cyanide says "Not the best solution as implementation is incomplete."
[

Nice userbars no? :P Make click & Download something nice for your Mugen!!!
________________________________

Ichisennen

#12
Quote[State 0, LifeSet]
type = LifeSet
trigger1 = Gethitvar(Damage) >= Life
value = 1
ignorehitpause = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = Gethitvar(Damage) >= Life
flag = noko
ignorehitpause = 1

Hmm. This almost got it, but i think this will make me invincible? I dunno, I'm not really that sure. If i insert this into my hitstates, each time i go to a hitstate, this'll negate all damages greater than my current life, and set my life to one. But there's no part in it that says to not do this when I have one life left. So ill keep remaining with one life no matter what, hence ill be unkillable... i dont want that. All i want is to remain with one life for one time after a KO-hit/combo, and then die when Im hit with 1 life. So unless i heal(yep, char has a small heal ability), i'll die after another non-combo hit. Maybe a bit more edit and this will work, ill try to go by this approach.

leandro1412

Add new Triggers

[State 0, LifeSet]
type = LifeSet
triggerall = Life > 1 && Alive
trigger1 = Gethitvar(Damage) >= Life
value = 1
ignorehitpause = 1

[State 0, AssertSpecial]
type = AssertSpecial
triggerall = Life > 1 && Alive
trigger1 = Gethitvar(Damage) >= Life
flag = noko
ignorehitpause = 1
[

Nice userbars no? :P Make click & Download something nice for your Mugen!!!
________________________________

Ricepigeon

It wont activate on custom states with the above code. Not sure if you want it that way, but more than likely not.

Hero

Just add them to -2 state, variables to check the three possible states (alive, alive but knocked and returning to life), with 5110 state as a optional trigger. That's all. Just experiment and try every combination, that's what a coder do.

Ichisennen



Quote from: Hero. on November 30, 2010, 09:50:42 PM
Just add them to -2 state, variables to check the three possible states (alive, alive but knocked and returning to life), with 5110 state as a optional trigger. That's all. Just experiment and try every combination, that's what a coder do.

Again, if i wanted to put it just in my -2 state i would've just used my original code, because it works, just that it bugs when my character fights himself. This "solution" your giving would be if code didn't work, but I did say it works, doesn't it? Just that it bugs.

And yes, like a coder, I have done everything to make it work via -2 states, thats why im asking here for newer possibities which i haven't thought of, like the one leandro1412 gave me. Thats why we have something called development HELP; when one not as well off as you has ran out of ideas. I won't ask here if it was out of the bounds of my knowledge, woundn't I?

And no, just posting it plus adding variables for the three states does not work.

Quote from: leandro1412 on November 30, 2010, 01:15:05 PM
Add new Triggers

[State 0, LifeSet]
type = LifeSet
triggerall = Life > 1 && Alive
trigger1 = Gethitvar(Damage) >= Life
value = 1
ignorehitpause = 1

[State 0, AssertSpecial]
type = AssertSpecial
triggerall = Life > 1 && Alive
trigger1 = Gethitvar(Damage) >= Life
flag = noko
ignorehitpause = 1


Don't know why but it plain doesn't just work anymore when I add that.  Twas better before, still thanks again XD  :sugoi:

Quote from: DUCTRUONG on November 30, 2010, 08:51:21 PM
It wont activate on custom states with the above code. Not sure if you want it that way, but more than likely not.

Nope, I don't, and it doesn't work when I'm combo'ed as well.

Eurgh.

leandro1412

Ok then we go to improve that with a var ;D

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

[State 0, LifeSet]
type = LifeSet
triggerall = !Sysvar(4)
trigger1 = Gethitvar(Damage) >= Life
value = 1
ignorehitpause = 1

[State 0, AssertSpecial]
type = AssertSpecial
triggerall = !Sysvar(4)
trigger1 = Gethitvar(Damage) >= Life
flag = noko
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
trigger1 = !SysVar(4) || Life <= 1
sysvar(4) = 1


Whit this switch you should fix just for one time the not one hit kill :D don't care the damage amount.

Sorry but i can't understand why you are using this code (first posted), what are u looking with that, ahh by the way you cant do that in -2 or -3 because that starts detection from tic 1 (Time = 1) so we cant detect the time 0 codes... lifeadd and hold the gethitvar(damage) jeje XD for that you must to edit all Gethit shake states (for example 5000) its like and armor mode XD
[

Nice userbars no? :P Make click & Download something nice for your Mugen!!!
________________________________

Ricepigeon

#18
I dont think messing around with sysvars is a good idea, especially since only sysvar(0) and sysvar(1) are actually used and supported.

Either way, theres no reason why such a code should bug if you're fighting yourself and it works otherwise

leandro1412

Quote from: DUCTRUONG on December 01, 2010, 04:37:06 PM
I dont think messing around with sysvars is a good idea, especially since only sysvar(0) and sysvar(1) are actually used and supported.

Either way, theres no reason why such a code should bug if you're fighting yourself and it works otherwise

emm i use sysvar(4) because its so weird use for other thing else XD he can use anything :P
[

Nice userbars no? :P Make click & Download something nice for your Mugen!!!
________________________________