This tutorial will instruct you how to control P2 throughout a Win Pose.
EXAMPLE VIDEO
Please read this tutorial carefully, because the conditions for this to work properly are very strict.
As an example, this tutorial will assume that there are a total of 4 Win Poses: 3 "normal" ones, and this custom pose. It is also assumed that each win pose will have a 25% chance of occurring
Overview / Checklist:
- Add a variable in STATE -2 to determine whether the custom win pose will be executed. THIS MUST BE DETERMINED BEFORE THE ROUND ENDS
- Adjust the triggers in your Win Pose selection (the VarRandom controller located in State 180)
- Create a blank Animation that will put P2 into the "custom death state"
- Create a helper that will appear when P2 is going to die, which will send P2 into a custom death state
- Create a custom death state, which will be Statedef 5150
- Create another custom state, which will contain all the fun stuff you want P2 to do.
- Adjust ALL your HitDefs (Explained in Step 7)
Step 1: Code for State -2
Whether this win pose will be executed or not MUST be determined BEFORE the round ends, unlike an ordinary Win Pose.
Therefore, add the following code into State -2:
[State -2, Determine Win Pose]
type = VarRandom
trigger1 = RoundState = 0 ;If this Win Pose will occur or not is determined at the beginning of each round
v = 2 ;Choose an unused variable. In this example, 2
range = 1,4 ;The range. I recommend using 1, followed by the total number of win poses you have
[State -2, Stun P2 for Win Pose]
type = Helper
trigger1 = var(2) = 1 ;In this example, there is a 25% chance that the win pose will be chosen (compare with range set above).
trigger1 = P2Life <= 1 ;And if P2 is going to die
trigger1 = p2stateno != [5150,5151] ;And if P2 is not in either of the custom states
name = "P2 Stunner" ;Name of the helper. Optional - you might need an ID but I did not.
postype = back ;Don't change
stateno = 7101 ;State # of your helper
ignorehitpause = 1 ;Don't change
Step 2: Adjustments to State 180
State 180 must be adjusted to take the new variable into account. Please review the following code to see what must be done.
[State 180, 1] ;Determine Win Pose
type = VarRandom
trigger1 = Time = 0
v = 1
range = 1,3 ;The range. I recommend using 1, followed by the total number of NORMAL win poses you have
[State 180, 2] ;Win Pose 1 ("Normal" Win Pose)
type = ChangeState
trigger1 = Var(1) = 1
trigger1 = var(2) != 1 ;Prevents Win 1 from triggering if Var(2) is triggering the custom win pose.
value = 181
[State 180, 3] ;Win Pose 2 (CUSTOM WIN POSE)
type = ChangeState
trigger1 = var(2) = 1 ;IF Var(2) TRIGGERS THE CUSTOM WIN POSE, THE CORRECT WIN POSE WILL EXECUTE
value = 182
[State 180, 4] ;Win Pose 3 ("Normal" Win Pose)
type = ChangeState
trigger1 = Var(1) = 2
trigger1 = var(2) != 1 ;Prevents Win 3 from triggering if Var(2) is triggering the custom win pose.
value = 183
[State 180, 5] ;Win Pose 4 ("Normal" Win Pose)
type = ChangeState
trigger1 = Var(1) = 3
trigger1 = var(2) != 1 ;Prevents Win 4 from triggering if Var(2) is triggering the custom win pose.
value = 184
Step 3: Create a blank Animation that will put P2 into the Custom Death State
Create a new Animation with the following properties. Use any anim # you want, but you will need it in Step 4:
[Begin Action 9998] ;P2, You Have Nowhere to Hide
Clsn1: 1
Clsn1[0] = 0, -480, 640, 480
-1,0, 0,0, -1
Step 4: Create the Helper that will put P2 into the Custom Death State
Create this StateDef. The State # must match the one found in Step 1. The anim # must match the one in Step 3.
[StateDef 7101] ;P2 Stunner
type = S
movetype = A
physics = S
anim = 9998 ;The blank anim with giant Clsn1 box
velset = 0,0
ctrl = 1
[State 7101, 1] ;Full-screen hit
type = HitDef
trigger1 = Time = 0
attr = S, SA
damage = 0,0
animtype = Heavy
hitflag = MF
guardflag = A
priority = 7
pausetime = 0,3
sparkxy = 0,0
sparkno = -1
guard.sparkno = -1
hitsound = -1
guardsound = -1
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = 0
air.velocity = 0,0
air.fall = 1
fall = 0
numhits = 0
p2stateno = 5150 ;*****MUST BE STATE 5150******
[State 7101, 2] ;DestroySelf
type = DestroySelf
trigger1 = P2StateNo = !5150 ;In combination with the code in Step 1, the helper will appear as much as necessary to succeed in putting P2 into the custom state
Step 5: Create the Custom Death State
THIS CUSTOM STATE MUST BE 5150, OTHERWISE THE ROUND WILL NEVER END.
With that in mind, go ahead and create this StateDef. When P2 is dead, this will send him to another State containing all the fun stuff you want to do with P2:
[Statedef 5150] ;Custom P2 KO
type = L
physics = U
sprpriority = -3
ctrl = 0
[State 5150, 1] ;This will kill P2
type = LifeSet
trigger1 = name != "Jailbot" ;YOUR CHARACTER's NAME GOES HERE
value = 0
ignorehitpause = 1
[State 5150, 2] ;Normal anim
type = ChangeAnim
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140
[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)
[State 5150, 4] ;Match over anim
type = ChangeAnim
persistent = 0
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10
[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110
[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85
[State 5150, 7] ;Friction
type = VelSet
trigger1 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0
[State 5150, 8] ;Normal NotHitBy
type = NotHitBy
trigger1 = name = "Jailbot" ;YOUR CHARACTER's NAME GOES HERE
value = SCA
time = 1
ignorehitpause = 1
[State 5150, 9] ;Custom NotHitBy
type = NotHitBy
trigger1 = name != "Jailbot" ;YOUR CHARACTER's NAME GOES HERE
value = SCA
time = 1
ignorehitpause = 1
[State 5150, 10] ;More Custom
type = NotHitBy
trigger1 = name != "Jailbot" ;YOUR CHARACTER's NAME GOES HERE
value = , NA, SA, AP
time = 100
ignorehitpause = 1
[State 5150, 11] ;P2 IS NOW YOUR PUPPET
type = ChangeState
trigger1 = Roundstate = 4 ;DONT CHANGE THIS TRIGGER
trigger1 = name != "Jailbot" ;YOUR CHARACTER's NAME GOES HERE
value = 5151 ;I Recommend you use State 5151
Step 6: Create State(s) containing all the things you want P2 to do in your Win Pose(s)
You can now have P2 do whatever it is you want him or her to do during your character's Win Pose. In this example, you would put the State Controllers in StateDef 5151.
If you were able to understand everything above, you can also probably figure out how to control P2 for multiple Win Poses at this point, if you so desire. It would involve creating yet another custom state for P2 to go into from State 5150 (such as State 5152, 5153, etc), and then basically adjusting all the values and triggers from the previous steps accordingly.
Step 7: Adjust ALL Your Character's HitDefs
Don't skip this Step, because this is the most important one 
Add the following line to ALL of your character's HitDefs:
This will ensure that P2's health will become 1 instead of 0 from a death-blow, allowing the helper to hit P2 and finish the job.
kill = var(2) != 2
GOOD LUCK,HAVE FUN!