I'm working on a character that has a Mega Man X style charge that includes 3 levels of charge. How I have it is that when the player holds x, it spawns a helper which has the level 1 charge animation. After a few ticks it is destroyed and spawns a new helper which performs the same function with just a different animation. Same for level 3.
Anyway, I want to have the player go into a different state depending on which helper is present. This is what I put for the "level 2" attack in the cmd file.
;2nd charged attack
;—§‚¿Žãƒpƒ“ƒ`
[State -1]
type = ChangeState
value = 20004
trigger1 = command = "releasex"
triggerall = Numhelper(77116) >= 1
triggerall = statetype = s
triggerall = ctrl
Now this is what I have in statedef -3
[State 1000, 2]; CHARGING
type = Helper
triggerall = power >= 148
trigger1 = command = "x"
pos = -3, -27
postype = p1
stateno = 77114
bindtime = -1
id = 7714
keyctrl = 1
This spawns the helper, and here is the full code for the entire charging section
Spoiler, click to toggle visibilty
;---------------------------------------------------------------------------
; CHARGING (Invisible)
[Statedef 77114]
type = S
movetype= A
physics = S
juggle = 4
velset = 0,0
ctrl = 0
anim = 8013
poweradd = 0
sprpriority = 2
[State ];done
type=destroyself
trigger1= command = "releasex"
[State 1061, 1]
type = bindtoroot
trigger1 = time = [0,9999]
time = -1
pos = -2,-27
[State 1000, 2];
type = destroyself
trigger1 = time = 19
[State 1000, 2]; CHARGING
type = Helper
trigger1 = time = 18
pos = 1, -23
postype = p1
stateno = 77115
bindtime = -1
id = 77115
keyctrl = 1
;---------------------------------------------------------------------------
; CHARGING (RED)
[Statedef 77115]
type = S
movetype= A
physics = S
juggle = 4
velset = 0,0
ctrl = 0
anim = 8012
poweradd = 0
sprpriority = 2
[State 1061, 1]
type = bindtoroot
trigger1 = time = [0,9999]
time = -1
pos = -2,-27
[State 1061, 1]
type = trans
trigger1 = time = [0,9999]
trans = add
[State 1061, 1]
type = angledraw
trigger1 = time = [0,9999]
scale = .18,.18
[State 1000, 2]; CHARGING
type = Helper
trigger1 = time = 48
pos = -3, -27
postype = p1
stateno = 77116
bindtime = -1
id = 77116
keyctrl = 0
[State ];done
type=destroyself
trigger1= command = "releasex"
trigger2 = time = 49
;-------------------------------------
;---------------------------------------------------------------------------
; CHARGING (PURPLE)
[Statedef 77116]
type = S
movetype= A
physics = S
juggle = 4
velset = 0,0
ctrl = 0
anim = 8014
poweradd = 0
sprpriority = 2
[State 1061, 1]
type = bindtoroot
trigger1 = time = [0,9999]
time = -1
pos = -2,-27
[State 1061, 1]
type = trans
trigger1 = time = [0,9999]
trans = add
[State 1061, 1]
type = angledraw
trigger1 = time = [0,9999]
scale = .18,.18
[State 1000, 2]; CHARGING
type = Helper
trigger1 = time = 48
pos = -3, -27
postype = p1
stateno = 77117
bindtime = -1
id = 77117
keyctrl = 0
[State ];done
type=destroyself
trigger1= command = "releasex"
trigger2 = time = 49
;-------------------------------------
;---------------------------------------------------------------------------
; CHARGING (BLUE)
[Statedef 77117]
type = S
movetype= A
physics = S
juggle = 4
velset = 0,0
ctrl = 0
anim = 8015
poweradd = 0
sprpriority = 2
[State 1061, 1]
type = bindtoroot
trigger1 = time = [0,9999]
time = -1
pos = -2,-27
[State 1061, 1]
type = trans
trigger1 = time = [0,9999]
trans = add
[State 1061, 1]
type = angledraw
trigger1 = time = [0,9999]
scale = .18,.18
[State ];done
type=destroyself
trigger1= command = "releasex"
trigger2 = time = 49
;-------------------------------------
Now my problem is, if I set keybind = 1, it can properly remove the helper when the player releases x, BUT does not go into the state as defined by the cmd. file.
If keybind = 0, player goes into cmd defined state but the helper does not detect releasex command.
I tried spawning explods within the levels of charge helpers with which the cmd file can detect but it seemed like the same problem.
All I want is to have the player do a certain move when doing a "releasex" command, depending on which helper is present, and I want the helper to be removed once player is in that state.