[State -1, AI Fireball condition Check]
type = VarRandom
triggerall = var(58) = 1 ; AI variable
triggerall = power >= 1000
trigger1 = ctrl = 1
trigger1 = p2bodydist x >= 80
trigger1 = statetype != A
trigger1 = random < 999 ; You could put the random values at a lower number so the character doesnt just spam fireballs (making sure that you have other moves to compensate for that situation)
trigger1 = statetype = S
trigger2 = p2bodydist x >= 80
trigger2 = random < 999
trigger2 = stateno = 2000 ; Flying state optional
v = 55
range = 10,12 [State -1,AI Combo condition Reset] ; Resets variable after AI has chosen an attack
type = varset
triggerall = var(58) = 1
trigger1 = movetype = A
trigger2 = stateno = 1010 || stateno = 1000 || stateno = 300
var(55) = 0
[State -1, AI Fireball 1] ;Projectile move 1
type = changestate
value = 1010
triggerall = var(58) = 1
triggerall = p2movetype != A ; P2 not in an attack state
trigger1 = var(55) = 10
[State -1, AI Fireball 2]
type = changestate
value = 1000
triggerall = var(58) = 1
triggerall = p2movetype != A
trigger1 = var(55) = 11
[State -1, AI Fireball 3]
type = changestate
value = 300
triggerall = var(58) = 1
triggerall = p2movetype != A
trigger1 = var(55) = 12