YesNoOk
avatar

Need help with custom state (Read 238 times)

Started by krissuja, March 28, 2013, 01:56:56 am
Share this topic:
Need help with custom state
#1  March 28, 2013, 01:56:56 am
  • *
  • I am listening...
    • Poland
    • shinakuma@aqq.eu
Can anyone tell my what is wrong wit this code?

In CNS

;Call the helper
[StateDef 10000]
type    = S
movetype= I
physics = S
juggle  = 1
velset = 0,0
ctrl = 1

[State 10000, 1]
type = Helper
trigger1 = 1
trigger1 = NumHelper(9010) = 0
ID = 9010
stateno = 9010
pos = 160, -140
postype = left
helpertype = normal
name = "FINISH HIM!"
keyctrl = 0
ownpal = 1

[State 10000, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;--------------------------------------------------------------------------

;Helper state
[StateDef 9010]
type = S
movetype = A
physics = S
anim = 9010
velset = 0,0
ctrl = 1

[State 9010, 1]
type = HitDef
trigger1 = animelem = 1
trigger1 = P2StateType != A
attr = S, SA
damage = 0,0
animtype = Heavy
hitflag = MF
guardflag = A
priority = 7
pausetime = 0,3
sparkxy = 0,0
sparkno = -1
gurad.sparkno = -1
hitsound = -1
guardsound = -1
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = 0
air.velocity = 0
air.fall = 1
fall = 0
numhits = 0
p2stateno = 49999
;--------------------------------------------------------------------------

;"FINISH HIM!" - MSG
[Statedef 9011]
type    = S
movetype= I
physics = S
juggle  = 1
velset = 0,0
anim = 9011
ctrl = 0

[State 9011,]
type = PlaySnd
trigger1 = Time = 1
value = 3,0

[State 9011, 3]
type = SprPriority
trigger1 = 1
value = 5

[state 9011, 4]
type = Helper
trigger1 = NumHelper(9010) = 1
trigger1 = NumHelper(9011) = 0
trigger1 = P2StateNo = 49999
id = 9011
stateno = 9011
pos = 160, -140
postype = left
helpertype = normal
name = "FINISH HIM! - MSG"
keyctrl = 0
;--------------------------------------------------------------------------

;Dizzy
[Statedef 49999]
type    = S
movetype= H
physics = S
juggle  = 1
ctrl = 0
velset = 0,0

[State 49999, 1]
type = LifeSet
trigger1 = 1
value = 1

[State 49999, 2]
type = TargetLifeAdd
trigger1 = P2life <= 1
value = 1

[State 49999, 3]
type = SelfState
trigger1 = Time = 48
trigger1 = P2StateNo != [3000,3200]
value = 5301
ctrl = 0

[State 49999, 4]
type = LifeSet
trigger1 = P2StateNo = 5300
trigger1 = Time = 48
trigger1 = P2StateNo != [3000,3200]
value = 0

;Enemy is dizzy.
[State 49999, 5]
type = ChangeAnim
trigger1 = AnimExist(5300)
trigger1 = Anim != 5300
value = 5300
;-------------------------------------------------------------------------

[Statedef -2]

[State -2, 1]
type = varset
trigger1 = Win = 1
trigger1 = NumHelper(9010) = 0
v = 58
value = 1

[State -2, 2]
type = varset
trigger1 = Win = 1
trigger1 = NumHelper(9010) = 1
trigger1 = p2life != 0
v = 58
value = 0

[State -2, 3]
type = AttackMulSet
triggerall = !Var(58)
triggerall = p2Life <= 1
trigger1 = Win = 0
trigger1 = RoundNo != 1
trigger1 = P2StateNo = 49999
value = 9999
;--------------------------------------------------------------------------
 In CMD

[State -1]
type = Changestate
trigger1 = Ctrl ;It must have the control.
trigger1 = P2Life <= 1 ;Life of P2 must be equal the 1.
trigger1 = NumHelper(9010) = 0 ;It cannot have another Helper as this in the screen.
trigger1 = P2StateNo != 49999 ;Opponent cannot be in Custom State.
trigger1 = RoundNo != 1 ;Round cannot be the first one.
trigger1 = var(58) >= 1 ;You must be to win one round before.
trigger1 = statetype != A ;P1 cannot be in air.
trigger1 = p2statetype != A ;P2 also not.
value = 10000

;--------------------------------------------------------------------------

The Finish Him massage wont appear on the screen, as well as sound, but P2 seems to be send to a custom state. After hit he is in "dizzy" state, but after 48 ticks he wont die! And I can't move! What is wrong here?


Re: Need help with custom state
#2  March 28, 2013, 02:04:22 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
Ok, well I see a couple of things wrong with your code. Most importantly though, I don't see any way of your message helper ever getting to state 9011. My guess is that you wanted the "FINISH HIM!" helper to go to the message state when hit. That can't happen with this code. You need either a ChangeState or p1stateno=9011 on the HitDef of your helper.

-[Все слова это только слова.]-
Re: Need help with custom state
#3  March 28, 2013, 02:19:12 am
  • *
  • I am listening...
    • Poland
    • shinakuma@aqq.eu
OOOOOOO!!!!! thanks:) Now it's working

     Posted: March 28, 2013, 02:28:02 am
and why P2 won't die?
Re: Need help with custom state
#4  March 28, 2013, 02:28:40 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
Anytime :)

-[Все слова это только слова.]-
Re: Need help with custom state
#5  March 28, 2013, 02:32:06 am
  • *
  • I am listening...
    • Poland
    • shinakuma@aqq.eu
and why

[State 49999, 3]
type = SelfState
trigger1 = Time = 48
trigger1 = P2StateNo != [3000,3200]
value = 5301 <<<<<<<<<<HERE any other animation won't work? should be 5050
ctrl = 0
Re: Need help with custom state
#6  March 28, 2013, 02:57:54 am
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
I'm not sure why you would use P2Stateno in a custom state. I actively avoid P2StateNo because its unreliable, so I don't really know what it would be checking. If you're sending P2 to your state, then P2StateNo would return ... their own stateno or essentially P1's? I'm not sure about that. Try removing that trigger with P2Stateno in it all together, or comment it out. Does it work then? Trial and Error is the key to success :)

-[Все слова это только слова.]-
Re: Need help with custom state
#7  March 28, 2013, 09:33:43 am
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
How is p2stateno unreliable? P2stateno returns the nearest alive opponent's state number. There's nothing unreliable about it.

But I would avoid it in that situation, definitely.
Re: Need help with custom state
#8  March 28, 2013, 01:38:01 pm
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
Rajaa, what I mean is that it's not reliable in all situations. Once taken into Simultaneous Mode, P2 is only P2, not just your opponent. One would think that, given the description in the docs, it would fail miserably in that situation. I personally avoid it, because I want something that works anywhere I take it.

You'd think they'd call it something more self-explanatory like "EnemyNearStateNo" (enemynear(0),stateno :P) if it was going to do return the state number of the nearest alive opponent. I don't know honestly. I've been avoiding it, since I read the description for the reasons stated above.

-[Все слова это только слова.]-
Re: Need help with custom state
#9  March 28, 2013, 05:57:33 pm
  • *
  • I am listening...
    • Poland
    • shinakuma@aqq.eu
You talk about this >trigger1 = P2StateNo != [3000,3200]? state 3000 to 3200 is a fatality state, so P2 should die if I don't perform fatality in 48 ticks. I removed them and P2 still won't die! And I don't know why, there is a LifeSet to 0 ,after 48 ticks in state 5300 (dizzy state) I checked other CNS,  and all of them has the same structure...

     Posted: March 28, 2013, 06:09:19 pm
Now its working! LifeSet should be BEFORE selfstate... I make simple mistakes....;p