Hello, my English is not good so I am using Google Translate for this.
In my char I am occupying a Super Armor, so there are no Collision Boxes in the char. (Only in the Projectile Helper)
I wanted to Try to make a Projectile, where it can be Hit and can disappear, but when trying to do it, it sends me to Statedef 5040 and a loop is created returning the projectile to state 0
what I would like to do is that the Projectile after certain blows it is destroyed and an animation of exploration is seen. But it is impossible for me.
I will leave the Code that I am dealing with the Super Armor and the Projectile.
Spoiler, click to toggle visibilty
;---------------------------------------------------------------------------
; ARMOR
[Statedef 1000]
type = s
movetype = i
physics = n
anim = 1000
ctrl = 0
[State 1000]
type = hitoverride
trigger1 = 1
attr = sca, aa, ap, at
stateno = 1010
[State 1000]
type = bindtoroot
trigger1 = 1
[State 1000] ; PALETA
type = parentvarset
trigger1 = time = 0
var(2) = 0
[State 1000]
type = destroyself
trigger1 = roundstate != 2
trigger2 = parent,life <= 0
trigger3 = parent,stateno = 240
;trigger4 = parent,stateno = 6
trigger5 = stateno != 1000
;--------------------------
; ARMOR PARENTVARSET
[Statedef 1010]
type = s
movetype = i
physics = n
anim = 1010
ctrl = 0
[State 1010]
type = bindtoroot
trigger1 = 1
[State 1010] ; RECIBE DAÑO
type = parentvarset
trigger1 = 1
trigger2 = gethitvar(damage) <= floor(lifemax * 0.199)
trigger2 = gethitvar(hitcount) <= 1
var(1) = gethitvar(damage)
[State 1010] ; CONECTA CON DESAPARECER Y PAL
type = parentvarset
trigger1 = time = 0
var(2) = 1
[State 1010] ; EFECTO TIEMPO PAL Y DESAPARECER
type = Changestate
trigger1 = 1
trigger1 = time = 50
value = 1000
[State 1010]
type = null;destroyself
trigger1 = roundstate != 2
trigger2 = parent,life <= 0
trigger3 = parent,stateno = 220
trigger4 = parent,stateno = 265
trigger5 = parent,stateno = 270
trigger6 = parent,stateno = 275
trigger7 = stateno != 1010
this goes at -2
Spoiler, click to toggle visibilty
;---------------------------------------------------
; Armor And Guard Armor
[State -2] ;HERLPER QUE LLAMA AL ESTADO 1000 (ARMOR)
type = helper
trigger1 = numhelper(1000) = 0
id = 1000
stateno = 1000
[State -2] ; PARA RECIBIR DAÑO
type = lifeadd
trigger1 = roundstate = 2
value = - ceil(var(1) / fvar(1))
[State -2, 16]
type = Palfx
triggerall = RoundState = 2
trigger1 = Var(2) >= 1
trigger1 = Gametime % 3 = 1
add = 100, 220, 256
time = 1
ignorehitpause = 1
[State -2, 16]
type = Palfx
triggerall = RoundState = 2
trigger1 = Var(2) >= 1
trigger1 = Gametime % 3 = 2
add = 256,256,256
time = 1
ignorehitpause = 1
[State -2] ;HERLPER QUE LLAMA AL ESTADO 2000 (Guard Armor)
type = helper
trigger1 = var(2) >= 1
trigger1 = numhelper(2000) = 0
id = 2000
stateno = 2000
[State -2] ;Var sin Errores
type = varset
;trigger1 = palno = [1,12]
trigger1 = life >= lifemax * 0.8
fvar(1) = 1
[State -2, 4]
type = NotHitBy
trigger1 = 1
value = ,AT
time = -1
and this is the code of the Projectil that is triggering in several statedef
Spoiler, click to toggle visibilty
;---------------------------------------------------------------------------
;Animacion tirando pua verde
[Statedef 220]
type = s
movetype = a
physics = s
ctrl = 0
sprpriority = 0
anim = 220
;------
[State 220] ;Helper pua verde
type = helper
trigger1 = animelem = 11
helpertype = normal
stateno = 221
postype = p1
pos = 35,-30
ownpal = 1
supermove
pausemove
[State 65, 5]
type = PlaySnd
trigger1 = Animelem = 11
value = 0,2
[State 220]
type = varrandom
trigger1 = time = 0
v = 8
range = 0, 1
[State 220]
type = varadd
trigger1 = var(59) = 1
trigger1 = time = 0
var(30) = 1
[State 550, 2]
type = ChangeState
trigger1 = Animtime = 0
value = ifelse(var(59) != 1, 0, 1)
ctrl = 1
;----------------------------------------------------------------------------
;Pua verde movimiento
[Statedef 221]
type = A
movetype = A
physics = N
velset = 0,0
anim = 240
ctrl = 0
sprpriority = 20
[State 1000, 1]
type = VelSet
trigger1 = Time = 0
x = 3.5
[State 100, 2]
type = AssertSpecial
trigger1 = 1
flag = noshadow
[State 1000, 2]
type = HitDef
trigger1 = Animelem = 1
projremove = -500
projhitanim = -500
offset = 35,-33
;velocity = 4,0
attr = S,SP
animtype = Light
pausetime = 0,19
damage = 65,30
givepower = 100,100
hitflag = MA
guardflag = MAF
sparkno = s556
guard.sparkno = s215
sparkxy = 10, 15
hitsound = s200,1
guardsound = s200,2
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = 0,0
air.velocity = 0,0
air.hittime = 0
palfx.time = 1
palfx.add = 255,255,255
sprpriority = 0
[State 1000, 3]
type = ChangeState
trigger1 = (P2bodydist X <= -20) && (p2bodydist Y <= -20); This is the time to changeState
trigger2 = (P2bodydist X <= -20) && (p2bodydist Y >= -20); This is the time to changeState
value = 222
;--------------------------------------------------------------------------
;-------------------------------------------------------------------------------------
;Pua verde animacion suspendida
[Statedef 222]
type = A
movetype = A
physics = N
velset = 0,0
anim = 240
ctrl = 0
sprpriority = 20
[State 100, 2]
type = AssertSpecial
trigger1 = 1
flag = noshadow
[State 1000, 2]
type = HitDef
trigger1 = Animelem = 1
projremove = -1
projhitanim = -1
offset = 35,-33
;velocity = 4,0
attr = S,SP
animtype = Light
damage = 65,30
givepower = 100,100
hitflag = MA
guardflag = MAF
pausetime = 0,19
sparkno = s505
guard.sparkno = s215
sparkxy = 10, 15
hitsound = s200,1
guardsound = s200,2
ground.type = High
ground.slidetime = 0
ground.hittime = 0
ground.velocity = 0,0
air.velocity = 0,0
air.hittime = 0
palfx.time = 1
palfx.add = 255,255,255
sprpriority = 0
[State 1000, 3]
type = ChangeState
trigger1 = time = 80
value = 223
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------------------
;Pua verde desaparicion
[Statedef 223]
type = A
movetype = A
physics = N
velset = 0,0
anim = 241
ctrl = 0
sprpriority = 20
[State 100, 2]
type = AssertSpecial
trigger1 = 1
flag = noshadow
[State 1000, 2]
type = HitDef
trigger1 = Animelem = 1
projremove = 6007
projhitanim = 6007
offset = 35,-33
;velocity = 4,0
attr = S,SP
animtype = Light
damage = 65,30
givepower = 100,100
hitflag = MA
guardflag = MAF
pausetime = 0,19
sparkno = s556
guard.sparkno = s215
sparkxy = 10, 15
hitsound = s200,1
guardsound = s200,2
ground.type = High
ground.slidetime = 0
ground.hittime = 1
ground.velocity = 0,0
air.velocity = 0,0
air.hittime = 1
palfx.time = 1
palfx.add = 255,255,255
sprpriority = 0
[State 1001, 3]
type = DestroySelf
trigger1 = Time = 8
the projectile itself has a blue collision box, so it sends me to state 5040, but this barely touched the projectile.
I do not know how to use the Super Armor well, it is a problem that I have been dealing with for a long time.