A list of codes that can be used in [statedef -1] with this system.
Counter enemy's projectile with projectile, if possible. (Standing)
[No root var needed]
*"If possible" means, if there is enough time to counter without getting hit by enemy's projectile. Will not trigger, if not possible.
[State -1, AI projectile against enemy projectile] ;by Inktrebuchet
type = ChangeState
value = 220
triggerall = ailevel
triggerall = ctrl
triggerall = statetype = S
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;enemy projectile exists
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 ; Avoid attempt to counter projectiles that are to high. 100 = char height
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow
;distance / velocity = time >= startup time
trigger1 = (((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) - const(size.ground.front) - PlayerID(helper(33333333),var(3)),const(size.ground.front)) / (PlayerId(helper(33333333),var(3)),vel x) >= 5 ;5= startup time
Counter enemy's projectile with projectile (last second), if possible
[No root var needed]
*"If possible" means, if there is enough time to counter without getting hit by enemy's projectile. Will not trigger, if not possible.
[State -1, AI projectile against enemy projectile] ;by Inktrebuchet
type = ChangeState
value = 220
triggerall = ailevel
triggerall = ctrl
triggerall = statetype = S
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;enemy projectile exists
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 || PlayerID(helper(33333333),var(3)), vel y > 0 ; Avoid attempt to counter projectiles that are to high. 100 = char height, unless the enemy projectile is moving downwards.
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow
;distance / velocity = time = startup time + active
trigger1 = (((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) - const(size.ground.front) - PlayerID(helper(33333333),var(3)),const(size.ground.front)) / (PlayerId(helper(33333333),var(3)),vel x) = [5,22] ; 5 = startup time, 22 = active ; [0,5] for last second
Reflect enemy's projectile, if possible
[No root var needed]
*"If possible" means, if there is enough time to reflect enemy's projectile without getting hit by enemy's projectile. Will not trigger, if not possible.
[State -1, AI Reflect enemy projectile] ;by Inktrebuchet
type = ChangeState
value = 1200
triggerall = ailevel
triggerall = ctrl
triggerall = statetype = S
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;enemy projectile exists
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 || PlayerID(helper(33333333),var(3)), vel y > 0 ; Avoid attempt to reflect projectiles that are to high. 100 = char height or reflector height, unless the enemy projectile is moving downwards.
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow
;distance / velocity = time = startup time + active
trigger1 = (((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) - const(size.ground.front) - PlayerID(helper(33333333),var(3)),const(size.ground.front)) / (PlayerId(helper(33333333),var(3)),vel x) = [5,22] ; 5 = startup time, 22 = active ; [0,5] for last second reflect.
Slide under enemy's projectile
[No root var needed]
*This code assumes the character is able to be low enough to avoid the projectile. It would be wise to add a trigger that stops the character's slide attempts, if they are hit when trying to slide. This is because it's not possible to know where the bottom of the projectiles clsn box is until contact. Check the Safeguards section for more info.
[State -1, AI Slide under enemy projectile] ;by Inktrebuchet
type = ChangeState
value = 1100
triggerall = ailevel
triggerall = ctrl
triggerall = statetype = S || statetype = C
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;enemy projectile exists
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 ; Avoid sliding under projectiles that are high enough to walk under. 100 = char height
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow
trigger1 = ((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) / (PlayerId(helper(33333333),var(3)), vel x) > 9 ; 9 = lowest point of moves hitbox .
trigger1 = ((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) / (PlayerId(helper(33333333),var(3)), vel x) < 35 ; 35 = when hitboxs lowest point changes to a higher point.
Hop backwards to avoid enemy's projectile, if possible.
[No root var needed]
*"If possible" means, if there is enough time to land the hop without getting hit by enemy's projectile. Will not trigger, if not possible.
[State -1, AI Hop backwards to avoid enemy projectile, when possible] ;by Inktrebuchet
type = changestate
Value = 105 ;This value is based on default MUGEN common1.cns "Hop backwards" state.
triggerall = ailevel
triggerall = ctrl
triggerall = statetype = S
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;enemy projectile exists
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 || PlayerID(helper(33333333),var(3)), vel y > 0 ; Avoid attempt to reflect projectiles that are to high. 100 = char height or reflector height, unless the enemy projectile is moving downwards.
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow
;(distance / velocity) = (hop.y/yaccel) + ((((hop.y^2 - 0^2) / (2 * yaccel)) /yaccel) / hop.x) || time = Max height time + ((max height / yaccel ) / hop.x)
;trigger1 = ceil((((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) - const(size.ground.front) - PlayerID(helper(33333333),var(3)),const(size.ground.front)) / (PlayerId(helper(33333333),var(3)),vel x)) = floor(((abs(const(velocity.run.back.y)) / const(movement.yaccel)) + ((abs(const(velocity.run.back.y))**2 - 0**2) / (2*const(movement.yaccel)) / const(movement.yaccel))) / abs(const(velocity.run.back.x)))
;alternative to above trigger.
trigger1 = ceil((((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) - const(size.ground.front) - PlayerID(helper(33333333),var(3)),const(size.ground.front)) / (PlayerId(helper(33333333),var(3)),vel x)) = [0,16] ; 16 = the time it takes to start and land the hop.
Neu jump over enemy's projectile
[No root var needed], [No editing needed]
*This code assumes the character is able to jump high enough to avoid the projectile. It would be wise to add a trigger that stops the character's jump attempts, if they are hit when trying to jump. This is because it's not possible to know where the top of the projectiles clsn box is until contact. Check the Safeguards section for more info.
[State -1, AI Neu jump over enemy projectile] ;by Inktrebuchet
type = ChangeState
value = 40 ;This value is based on default MUGEN common1.cns "Jump Start" state.
triggerall = ailevel
triggerall = ctrl
triggerall = stateno != 40
triggerall = statetype = S || statetype = C
trigger1 = PlayerIDExist(helper(33333333),var(3)) ; enemy projectile exist?
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 ; Avoid jumping over projectiles that are to high. 100 = char height
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow.
;distance/speed = time
trigger1 = ceil(((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) / PlayerID(helper(33333333),var(3)), vel x ) = floor(abs(const(velocity.jump.y)) / const(movement.yaccel))
Fwd jump over enemy's projectile
[No root var needed], [No editing needed]
*This code assumes the character is able to jump high enough to avoid the projectile. It would be wise to add a trigger that stops the character's jump attempts, if they are hit when trying to jump. This is because it's not possible to know where the top of the projectiles clsn box is until contact. Check the Safeguards section for more info.
*This code assumes the character uses sysvar(1) in [statedef 40](jump). This is what's used in default MUGEN's common1.cns for "holdfwd".
[State -1, AI fwd jump over enemy projectile part 1 of 4] ;by Inktrebuchet
type = explod
triggerall = ailevel
triggerall = ctrl
triggerall = stateno != [40,52] ; not already jumping
triggerall = statetype = S || statetype = C
triggerall = numexplod(33330001) = 0
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;enemy projectile exists
trigger1 = PlayerID(helper(33333333),var(3)), pos y > -100 ; Avoid jumping over projectiles that are to high. 100 = char height
trigger1 = PlayerID(helper(33333333),var(3)), vel x != 0 ; Avoid "Division by Zero" debug overflow.
;distance / vel x = ((time) * vel x) / vel x
trigger1 = ceil(((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) / PlayerID(helper(33333333),var(3)), vel x ) = floor(abs(const(velocity.jump.y)) / const(movement.yaccel))
anim = helper(33333333), anim ; blank anim
ID = 33330001
[State -1, AI fwd jump over enemy projectile part 2 of 4]
type = varset
trigger1 = numexplod(33330001) = 1
sysvar(1) = 1
[State -1, AI fwd jump over enemy projectile part 3 of 4]
type = ChangeState
value = 40 ;This value is based on default MUGEN common1.cns "Jump Start" state.
triggerall = ctrl
triggerall = stateno != [40,52] ; not already jumping
triggerall = statetype = S || statetype = C
trigger1 = numexplod(33330001) = 1
trigger1 = sysvar(1) = 1 ; holding fwd
[State -1, AI fwd jump over enemy projectile part 4 of 4]
type = removeexplod
triggerall = numexplod(33330001) = 1
trigger1 = prevstateno = 40
trigger2 = movetype = H
ID = 33330001
ignorehitpause = 1
Safeguards "a measure taken to protect someone or something or to prevent something undesirable."
Safeguard code is used to ensure a move that resulted in being hit by the enemy projectile isn't used in response to that same projectile again.
Safeguard Example 1 1.0+ ONLY
[No root var needed]
This should go at the end of [statedef 33333333].
*This code uses 2 var in [statedef 33333333] if added. no editing needed here.
*be sure to update [statedef 33333333]'s "helper var usage" section if used! var(20) & var(21)
[state safeguard 0] ;similar to prevprevstateno ;by Inktrebuchet
type = null
trigger1 = root, movetype != h
trigger1 = var(21) := root,stateno
[state safeguard 1] ;safeguard, saves move number and enemy projectile vel x. ;by Inktrebuchet
type = explod
trigger1 = var(21) != 0 ;similar to prevprevstateno != 0
trigger1 = PlayerIDExist(var(3))
trigger1 = cond(playerid(var(3)),prevstateno = 0, var(2) := abs(floor(playerid(var(3)),vel x)), 1)
trigger1 = playerid(var(3)),Cond(NumTarget, Target, Cond(1, ID, 0), 0) = root,ID ; enemy,proj,target,ID = ID
trigger1 = numexplod((var(20)*100000000) + var(2)) = 0
anim = anim ;This anim is blank as long as this stctrl is in "AI Detect Projectile System"
ID = (var(20)*100000000) + var(2)
removetime = -1
[state safeguard 2] ;safeguard, saves move number and enemy projectile stateno. ;by Inktrebuchet
type = explod
trigger1 = var(21) != 0 ;similar to prevprevstateno != 0
trigger1 = PlayerIDExist(var(3))
trigger1 = playerid(var(3)),Cond(NumTarget, Target, Cond(1, ID, 0), 0) = root,ID ; enemy,proj,target,ID = ID
trigger1 = numexplod((var(20)*100000000) + playerid(var(3)),prevstateno) = 0
anim = anim ;This anim is blank as long as this stctrl is in "AI Detect Projectile System"
ID = (var(20)*100000000) + playerid(var(3)),prevstateno
removetime = -1
This can be added to the triggers used in [statedef -1].
*the first trigger should be edited for each move that it's added to. notes added to the first trigger.
;safeguard
trigger1 = cond(numhelper(33333333),helper(33333333), cond(1, var(20) := 15, 0), 0) ; the 15 in "var(20) := 15" represents the 15th time this trigger was used. the number should be different everytime this is added/used.
trigger1 = cond(helper(33333333),numexplod((helper(33333333),var(20)*100000000)+PlayerID(helper(33333333),var(3)),stateno) = 0, 1, helper(33333333),numexplod((helper(33333333),var(20)*100000000)+abs(floor(PlayerID(helper(33333333),var(3)),vel x))) = 0)
Snippets
Enemy,Proj,P2Dist X Alternative
;Enemy,Proj,P2Dist X:
;ProjDist X:
((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing)
;this is an alternative to using PlayerID(helper(33333333),var(3)),P2Dist X.
Enemy,Proj,P2BodyDist X Alternative
;Enemy,Proj,P2BodyDist X:
;ProjBodyDist X:
(((PlayerID(helper(33333333),var(3)), pos x - pos x )* facing) - const(size.ground.front) - PlayerID(helper(33333333),var(3)),const(size.ground.front))
;this is an alternative to using PlayerID(helper(33333333),var(3)),P2BodyDist X.
Enemy,Projectile Made Contact With You. 1.0+ ONLY
;enemy,projectile made contact with you, not your partner or anyone else.
trigger1 = playerid(helper(33333333),var(3)),Cond(NumTarget, Target, Cond(1, ID, 0), 0) = ID ; enemy,proj,target,ID = ID
;This is accurate with partners as well.
Enemy,Projectile Hit You. 1.0+ ONLY
;enemy,projectile hit you, not your partner or anyone else.
trigger1 = playerid(helper(33333333),var(3)),Cond(NumTarget, Target, Cond(1, ID, 0), 0) = ID ; enemy,proj,target,ID = ID
trigger1 = playerid(helper(33333333),var(3)),movehit
;This is accurate with partners as well.