News:

MFG's Character of the Month: September 2026 Voting

Main Menu

Projectile with multiple hits

Started by lusianoproo2011, September 06, 2024, 09:43:05 PM

Previous topic - Next topic

lusianoproo2011

My char has a hyper move that shoots a fireball and I want it to do 4 hits and then disappear but idk how to do it..  :S

Here is the projectile helper code:

; Super Hadoken [HELPER]
[Statedef 3010]
type    = A
movetype= A
physics = N
velset = 2,0
anim = 500
sprpriority = 2

[State 3010, 1]
type = HitDef
trigger1 = !time
attr = S, SP
damage = 50, 10
numhits = 4
hitonce = 1
animtype = Heavy
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 0, 8
sparkno = s510
sparkxy = -10, 0
hitsound = 5, 0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 11
ground.velocity = -4
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 15

[State 3010, HitOverride]
type = HitOverride
trigger1 = !time
attr = SCA,AA,AP,AT
slot = 0
stateno = 510
time = 999999
ignorehitpause = 1

[State 3010, NotHitBy]
type = NotHitBy
trigger1 = !time
value = ,AA,AT
time = 999999
ignorehitpause = 1

[State 3010, ChangeState]
type = DestroySelf
trigger1 = movecontact || pos x != [-180/camerazoom,180/camerazoom]
ignorehitpause = 1

XGargoyle

You have a destroyself after the projectile hits, which makes the helper to hit only once.

To solve it, you will need to keep a variable that increases with the hit, and have a changestate to the same state (as in a loop) while the variable is less than 4. If it's 4 or more, then apply the destroyself


XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!

lusianoproo2011

Quote from: XGargoyle on September 07, 2024, 12:15:26 AM
You have a destroyself after the projectile hits, which makes the helper to hit only once.

To solve it, you will need to keep a variable that increases with the hit, and have a changestate to the same state (as in a loop) while the variable is less than 4. If it's 4 or more, then apply the destroyself

i think i'm doing something wrong with the variables because the fireball never disappears

; Super Hadoken [HELPER]
[Statedef 3010]
type    = A
movetype= A
physics = N
velset = 2,0
anim = 500
sprpriority = 2

[State 3010, VarSet]
type = VarSet
trigger1 = !time
var(0) = 0

[State 3010, 1]
type = HitDef
trigger1 = !time
attr = S, SP
damage = 50, 10
numhits = 1
animtype = Heavy
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 8, 8
sparkno = s510
sparkxy = -10, 0
hitsound = 5, 0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 11
ground.velocity = -4
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 15

[State 3010, HitOverride]
type = HitOverride
trigger1 = !time
attr = SCA,AA,AP,AT
slot = 0
stateno = 511
time = 999999
ignorehitpause = 0

[State 3010, NotHitBy]
type = NotHitBy
trigger1 = !time
value = ,AA,AT
time = 999999
ignorehitpause = 0

[State 3010, VarAdd]
type = VarAdd
trigger1 = movecontact
var(0) = 1

[State 3010, ChangeState]
type = ChangeState
trigger1 = movecontact && var(0) < 4
value = 3010

[State 3010, ChangeState]
type = DestroySelf
trigger1 = var(0) >= 4 || pos x != [-180/camerazoom,180/camerazoom]
ignorehitpause = 1

lusianoproo2011

nvm i just had to put the varset in the character state, not in the helper. thanks for the help tho!!!!!! :D