YesNoOk
avatar

Syntax for a trigger on a Changestate (Read 905 times)

Started by DrStrange, January 27, 2010, 05:52:12 pm
Share this topic:
Syntax for a trigger on a Changestate
#1  January 27, 2010, 05:52:12 pm
  • **
  • Don't be an Anti-Pockite
    • USA
So i have a move with an animation and I want the state to change when either the player moves or hits any button, or they are hit by p2. What would the syntax be for that change state.

Code:
[State 2000, 1] 
type = ChangeState
trigger1 = ;if the player moves in any direction
trigger2 = ;if the player hits any button
trigger3 = ;if the player gets hit
value = 660      ; new state

Thanks
Last Edit: January 27, 2010, 07:26:18 pm by DrStrange
Re: Syntax for a trigger on a Changestate
#2  January 27, 2010, 06:04:06 pm
  • ******
  • Limited time to use Infinite power !
    • France
    • network.mugenguild.com/cybaster/
trigger 1 & 2 : "command="a" || "command="b" || ...

trigger 3 : Movetype = H
Re: Syntax for a trigger on a Changestate
#3  January 27, 2010, 07:27:50 pm
  • **
  • Don't be an Anti-Pockite
    • USA
That did it. Thanks so much.

And just curious, is there some place else I could have gone (some documentation) that I could have found the answer to this?

Re: Syntax for a trigger on a Changestate
#4  January 27, 2010, 08:00:10 pm
  • ******
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: Syntax for a trigger on a Changestate
#5  January 27, 2010, 08:05:40 pm
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
Trigger 3 would be useless. Use a hitoverride instead.
Re: Syntax for a trigger on a Changestate
#6  January 27, 2010, 08:24:15 pm
  • ******
I don't see why, movetype = H is just fine. As long as it's really what he wants.
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: Syntax for a trigger on a Changestate
#7  January 27, 2010, 09:09:06 pm
  • ******
    • www.mugenguild.com/pots/
Because by the time he's in movetype=H he'll already be in another state.
Use anything you want from my works.  If you need to contact me use email, not private messages.
Re: Syntax for a trigger on a Changestate
#8  January 27, 2010, 09:15:49 pm
  • ******
... Uh ? He gets hit (movetype = H), he goes to the state he wants (the changestate he's making). Isn't that what he wants ?
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: Syntax for a trigger on a Changestate
#9  January 27, 2010, 09:16:54 pm
  • **
  • Don't be an Anti-Pockite
    • USA
Here is what I wanted to accomplish with Movetype = H.

Player1 will be in a state, player 1's state will change if one of 2 things happen.

1. If player 1 moves at all, up down, punch, kick anything.

OR

2. Player 2 hits player 1.

When I added the trigger2 = Movetype = H, it worked. When player 1 is in the state and player 2 hits player 1, the state changes correctly.
Re: Syntax for a trigger on a Changestate
#10  January 27, 2010, 09:30:20 pm
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
That's strange, but as long as it works how you want it to. :ninja:
Re: Syntax for a trigger on a Changestate
#11  January 27, 2010, 09:31:59 pm
  • ******
I can't see what's strange with it :S It's a simple and straightforward solution that doesn't require an additional sctrl. Changestate when you get hit => triggerblah = movetype = H.
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: Syntax for a trigger on a Changestate
#12  January 27, 2010, 09:33:00 pm
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
Like, when you're in a state, and you're hit, you go to the hitstates, and then your movetype becomes Hit, so I don't see how it works in the state itself. I even just tested it out for myself and it doesn't work like that.
Re: Syntax for a trigger on a Changestate
#13  January 27, 2010, 09:33:50 pm
  • ******
Who said it was in the state itself ? It's in statedef -1 in the cmd.
... Oh wait, it does say [state 2000, 1]. :( But it can work if it's put in a negative state (and then it requires an additional trigger on the prevstateno).
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: Syntax for a trigger on a Changestate
#14  January 27, 2010, 10:03:58 pm
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
Yeah, that's why I'm confused.  ::)
Re: Syntax for a trigger on a Changestate
#15  January 27, 2010, 10:24:42 pm
  • **
  • Don't be an Anti-Pockite
    • USA
Here is the code I used and it works exactly how I want it too. Should it not work?

Code:
[StateDef 2000]    
type = S
movetype= I
physics = N
juggle  = 15
ctrl = 0
anim = 2000

;[State 2000, sndx]
;type = PlaySnd
;trigger1 = time = 1
;value = 20,8

[State 2000, 1]
type = LifeAdd
trigger1 = time = 120
value = 50

[State 2000, 1]
type = LifeAdd
trigger1 = time = 240
value = 75

[State 2000, 1]
type = LifeAdd
trigger1 = time = 360
value = 100

[State 2000, 1]
type = LifeAdd
trigger1 = time = 480
value = 200


[State 2000, 2]   
type = ChangeState     
trigger1 = command = "a" || command="b" || command="x" || command="y" || command = "holdfwd" || command = "holdback" || command = "holdup" || command = "holddown"
trigger2 = Movetype = H
trigger3 = time = 481   
value = 660       
ctrl = 0
Re: Syntax for a trigger on a Changestate
#16  January 27, 2010, 10:27:33 pm
  • ******
Oh, yeah. It's indeed not normal if it works when you get hit without pressing any button and before 481 ticks have passed :blank:
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: Syntax for a trigger on a Changestate
#17  January 27, 2010, 11:09:49 pm
  • **
  • Don't be an Anti-Pockite
    • USA
I will take a video tonight and post it, if it helps.
Re: Syntax for a trigger on a Changestate
#18  January 28, 2010, 04:05:49 am
  • **
  • Don't be an Anti-Pockite
    • USA
Ok, so this is weird. When I was testing I was using a light punch from P2 and it seemed to work as I wanted. But now I tested it with a heavy punch and the state did not change. Odd.

So it looks like I need to use a hitoverride. I read the doc on it but it did not make sense to me. Could someone give me a piece of example code with it in use?

Thanks
Re: Syntax for a trigger on a Changestate
#19  January 28, 2010, 05:28:24 am
  • ******
  • I hang out tough. I'm a real boss.
    • USA
    • litotichues.com/
Hitoverride is simple

First you need to know what attributes are, it tells you to check out the hitdef-documentation for that, you should doso.

state
type - hitoverride
trigger - whatever
attr - read up on it
stateno - state number you want to be changed to when this is activated
slot - up to 8 slots 0-7, only one active on one slot at a time
time - how long it lasts after triggered
Re: Syntax for a trigger on a Changestate
#20  January 28, 2010, 06:41:20 am
  • **
  • Don't be an Anti-Pockite
    • USA
I want the trigger to be p1 getting hit correct? So wouldn't that bring me back to movetype = H for trigger?
Re: Syntax for a trigger on a Changestate
#21  January 28, 2010, 06:49:21 am
  • **
  • Don't be an Anti-Pockite
    • USA
Nevermind, I got it working and I think I understand why  :)

Thanks to everyone who took the time to reply.

Re: Syntax for a trigger on a Changestate
#22  January 28, 2010, 10:27:26 am
  • ******
Right now, you are inside the state of the move. Its movetype is I.
If you get hit, you move to another state, and then your movetype become H.
So at this point when movetype becomes H, you are in another state and you can't read what was in your previous state - so you can't trigger your changestate. This is what Rajaa was finding odd.
There are a few solutions for that.
-Either you put your changestate in the gethit state, triggering if prevstateno is the state of your move. This isn't really a great idea to override the gethit states for that.
-Or you add a changestate triggered by prevstateno as your move and movetype = H, and you put that changestate *in one of the negative states* (-1 or -2 preferably). This is what I was first thinking of.
-Or you use a type = hitoverride with trigger1 = 1 and only that for a trigger, you don't need anything else.
There's no major difference between the last two possibilities.
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.