State -2 code
Create/Destroy the effect as needed from State -2
[State -2, Head Explod]
type = Explod
triggerall = !numexplod(1234) ;this effect has not yet been created
trigger1 = alive ;-- example condition / if you want it gone when dead
removetime = -1
bindtime = -1
sprpriority = 1
value = 1234
id = 1234
pos = Cond(var(1),var(1),55),Cond(var(2),var(2),-80)
;-----if var(1) or var(2) is zero, use a default pos value
[State -2, Remove Head Explod Whenever you Don't Want it Active]
type = RemoveExplod
triggerall = numexplod(1234)
trigger1 = !alive ;-- example condition / if you want it gone when dead
removetime = -1
bindtime = -1
sprpriority = 1
value = 1234
id = 1234
pos = Cond(var(1),var(1),55),Cond(var(2),var(2),-80)
;-----if var(1) or var(2) is zero, use a default pos value
Example of code in State 0.
Example is based on Anim 0 having 3 animelems total.
[State 0, Head X/Y - Anim 0]
type = Null
triggerall = anim = 0
trigger1 = animelem = 1 || !animtime ;--- !animtime is needed with looping anims to trigger again on elem 1
trigger1 = var(1) := 50 || var(2) := -80
trigger2 = animelem = 2
trigger2 = var(1) := 55 || var(2) := -82
trigger3 = animelem = 3
trigger3 = var(1) := 60 || var(2) := -82
[State 0, Constantly Modify Head Explod Position Without Resetting the Anim]
type = ModifyExplod
triggerall = numexplod(1234)
trigger1 = anim = 0
removetime = -2
bindtime = -1
sprpriority = 1
value = 1234
pos = var(1),var(2)
Still create/destroy the effect in State -2, like in my example above.
Example code in State 0, again assuming Anim 0 has a total 3 anim elems.
[State 0, Reposition Explod for animelem 1]
type = ModifyExplod
triggerall = numexplod(1234)
triggerall = anim = 0
trigger1 = animelem = 1 || !animtime ;--- !animtime is needed with looping anims to trigger again on elem 1
removetime = -2
bindtime = -1
sprpriority = 1
value = 1234
pos = 50,-80
[State 0, Reposition Explod for animelem 2]
type = ModifyExplod
triggerall = numexplod(1234)
triggerall = anim = 0
trigger1 = animelem = 2
removetime = -2
bindtime = -1
sprpriority = 1
value = 1234
pos = 55,-82
[State 0, Reposition Explod for animelem 3]
type = ModifyExplod
triggerall = numexplod(1234)
triggerall = anim = 0
trigger1 = animelem = 3
removetime = -2
bindtime = -1
sprpriority = 1
value = 1234
pos = 60,-82
[State 0, Explod for anim 0, animelem 1]
type = Explod
triggerall = anim = 0
trigger1 = animelem = 2, < 0 || !animtime
sprpriority = 1
value = 0 + 10000
[State 0, Explod for anim 0, animelem 1]
type = Explod
triggerall = anim = 0
trigger1 = animelem = 2, >= 0 && animelem = 3, < 0
sprpriority = 1
value = 0 + 10001
etc
[State -2, Check Life]
type = Null
trigger1 = life < lifemax*0.75
trigger1 = var(5) := 0
trigger2 = life < lifemax*0.5
trigger2 = var(5) := 1
trigger3 = life < lifemax*0.25
trigger3 = var(5) := 2
Then just factor it into the example I showed before this like so:[State 0, Explod for anim 0, animelem 1]
type = Explod
triggerall = anim = 0
trigger1 = animelem = 2, < 0 || !animtime
sprpriority = 1
value = 0 + 10000 + var(5)
[State 0, Explod for anim 0, animelem 1]
type = Explod
triggerall = anim = 0
trigger1 = animelem = 2, >= 0 && animelem = 3, < 0
sprpriority = 1
value = 0 + 10003 + var(5)
etc
NOTE HOW THERE ARE 3 ANIMS DEDICATED TO EACH ANIMELEM.
For my Jailbot, there are 18 different faces / directions his eyes will move. So there are 18 face anims for every single animelem I want the effect to work. There are a lot of them.