projectile from the sky

Started by jamestheepic, June 15, 2024, 05:38:32 AM

Previous topic - Next topic

jamestheepic

so I'm try to make a projectile fall from the sky from my new boss char but whenever I hit the button it doesn't appear

here the code

;Segway Rain
[Statedef 230]
type    = C
movetype= A
physics = C
ctrl = 0
anim = 230
poweradd = 250
sprpriority = 2

[State 0, Helper]
type = Helper
trigger1 = time >= 15
trigger1 = time < 140
trigger1 = timemod = 10,1
helpertype = normal ;player
name = "Segway"
ID = 231
stateno = 231
pos = -100+random%201,-300
postype = p2
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0

[State 200, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = ifelse(Pos Y != 0 || Vel Y != 0,50,0)
ctrl = 1
;---------------------------------------------------------------------------
;Segway
[Statedef 321]
type = A
movetype = A
physics = N
anim = 321
velset = 0,1
sprpriority = 5

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 0, VelAdd]
type = VelAdd
trigger1 = 1
y = 0.57

[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 5
value = random%360

[State 0, VarAdd]
type = VarAdd
trigger1 = 1
v = 5
value = -12

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = var(5)
scale = 1,1
ignorehitpause = 1

[State 0, HitDef]
type = HitDef
trigger1 = time = 10
attr = S, SP
animtype  = Hard
damage    = 13, 5
priority  = 4
hitflag = MAFD
guardflag = MA
pausetime = 0,16
sparkxy = -10,0
hitsound   = S5,1
guardsound = S6,0
ground.type = High
ground.slidetime = 20
ground.hittime  = 22
ground.velocity = 0,-7
guard.velocity = -2
air.velocity = 0,-2
airguard.velocity = -2, -6
fall.animtype = Hard
fall = 1
fall.recover = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = vel y > 0
trigger1 = pos y >= -5
trigger2 = movecontact
value = 0
ctrl = 0
;------------------------------------------------------------------------------------------------------------------------
;Segway Explode
[Statedef 232]
type = A
movetype = A
physics = N
velset = -3+random%7,-8
sprpriority = 5

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 0, VelAdd]
type = VelAdd
trigger1 = 1
y = 0.47

[State 0, VarAdd]
type = VarAdd
trigger1 = vel x <= 0
v = 5
value = 6

[State 0, VarAdd]
type = VarAdd
trigger1 = vel x > 0
v = 5
value = -6

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = var(5)
scale = 1,1
ignorehitpause = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S440,4

[State 0, Trans]
type = Trans
trigger1 = 1
trans = addalpha
alpha = 256-(time*10),6+(time*10)

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time >= 25

let me know if theres any problems in the code if not any suggestions welcome. (and please note that this different to the other post i did)

SquidlyPoli1

I think it's this:

[State 0, ChangeState]
type = ChangeState
trigger1 = vel y > 0
trigger1 = pos y >= -5
trigger2 = movecontact
value = 0
ctrl = 0


The changestate controller in your segway code has a trigger that changes its state to 0 if it detects the Y velocity is greater than 0, and the velset parameter in your statedef sets the velocity to 1, which is greater than 0. It also changes to the idle state when it detects this and you do have a code that destroys the segway when it hits an enemy or the ground, so I would advise changing it to this:

[State 0, ChangeState]
type = ChangeState
trigger1 = pos Y > -vel Y ;if the Y position is greater than the negative of the Y velocity, change to this state
trigger2 = movecontact ;if move hits an opponent, change to this state
value = 232


The move that actually calls for the segways also states that the segways should have a stateno of 231, and your segway's stateno is 321 and not 231, so I would also advise changing that. The comments are there to talk about what the triggers do, and you don't need to keep them (though it is good to comment your code and talk about what things do).


jamestheepic


VictorCYBR

#3
What SquidlyPoli said.
Your helper is state 321, but you're calling state 231. Also why is it changing to state 0 instead of it's own state? Just for testing I'd advise to remove any changestate or destroyself in the helper. Also try spawning them in a position that it is visible for now (not offscreen).

Edit: also, keep an eye on the debug info (ctrl + D).