YesNoOk
avatar

Projectile with multiple hits (Read 9559 times)

Started by lusianoproo2011, September 06, 2024, 09:43:05 pm
Share this topic:
Projectile with multiple hits
#1  September 06, 2024, 09:43:05 pm
  • lusiano proo 2011
    • Argentina
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:
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
Last Edit: September 07, 2024, 04:23:43 am by lusianoproo2011
Re: Projectile with multiple hits
#2  September 07, 2024, 12:15:26 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
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!
Re: Projectile with multiple hits
#3  September 07, 2024, 02:54:26 am
  • lusiano proo 2011
    • Argentina
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
Code:
; 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
Re: Projectile with multiple hits
#4  September 07, 2024, 03:14:11 am
  • lusiano proo 2011
    • Argentina
nvm i just had to put the varset in the character state, not in the helper. thanks for the help tho!!!!!! :D