YesNoOk
avatar

Projectiles not colliding with target. (Read 936 times)

Started by Pizzaking405, January 20, 2022, 03:49:26 AM
Share this topic:
Projectiles not colliding with target.
#1  January 20, 2022, 03:49:26 AM
  • avatar
    • USA
I am trying to make a projectile move for my character, but the projectiles move straight through the other character. I want to know how to make the projectiles hit the opponent. The code I am using is simply an altered version of the default Kung Fu Man's standing strong punch and is performed by simply pressing ; as player 1, or T as player 2. Included below is the code for this move, and a video showing the move can be found in the replies. Projectiles do have attack contact boxes. I would put pictures of them here, but I do not understand how to put an image in these posts. Additional note: The 1st [State 0, Projectile] with projanim = 27 is just an effect and not actually intended to collide with anything. Every [State 0, Projectile] with projanim = 25 or 24 that comes after this are the actual projectiles that are intended to collide with the foe.

Code:
[/;---------------------------------------------------------------------------
; Standing strong punch
; CNS difficulty: easy
; Note the width controller. It makes KFM's push box larger, so he doesn't
; stand so close to the opponent. Hit Ctrl-C and look at the red bar at his
; feet.
; The sprpriority for this state is at -1, instead of the usual 2 for
; attacks. This makes KFM appear behind the opponent initially.
; The SprPriority controller in [State 210, 4] brings KFM to the front when
; his arm has swung over.
; To stop KFM from pausing in his swing frame, there is a ChangeAnim in
; [State 210, 3] that detects if the hit has come in contact with the
; opponent during that frame, and switches to the next animation element
; (notice the elem=6 parameter). If you don't see what I mean, try commenting
; out that controller, then hit someone with this attack.
[Statedef 210]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 30
ctrl = 0
velset = 0,0
anim = 10000
sprpriority = -1

[State 210, Width]
type = Width
trigger1 = (AnimElemTime (2) >= 0) && (AnimElemTime (7) < 0)
value = 15,0

[State 210, 1]
type = PlaySnd
trigger1 = Time = 2
value = 0, 4

[State 210, 2]
type = HitDef
trigger1 = AnimElem = 7
trigger2 = animelem = 1
trigger3 = animelem = 2
trigger4 = animelem = 3
attr = S, NA
animtype  = Medium
damage    = 57
guardflag = MA
pausetime = 12,12
sparkno = 1
sparkxy = -10,-70
hitsound   = 5,2
guardsound = 6,0
ground.type = High
ground.slidetime = 12
ground.hittime  = 16
ground.velocity = -5.5
air.velocity = -2.5,-4
forcenofall = 1

[State 210, 3]
type = ChangeAnim
trigger1 = AnimElemTime(5) > 0 && AnimElemTime(6) <= 0
trigger1 = movecontact
ignorehitpause = 1
persistent = 0
value = 210
elem = 6

[State 210, 4]
type = SprPriority
trigger1 = AnimElem = 5
value = 2

[State 210, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =27
projanim =27
;projhitanim =
;projremanim =
;projcancelanim =
projscale = 1,1
projremove = 1
projremovetime = 70
velocity = 0,0
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-135
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
;persistent =


[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =25
projanim =25
;projhitanim =
projremanim =26
;projcancelanim =
projscale = 2,2
projremove = -1
projremovetime = 70
velocity = 6,7
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-145
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
persistent =1
damage=50, 20
hitflag=maf

[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =25
projanim =25
;projhitanim =
projremanim =26
;projcancelanim =
projscale = 2,2
projremove = -1
projremovetime = 70
velocity = -6,7
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-145
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
persistent =1
damage=50, 20
hitflag=maf

[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =25
projanim =25
;projhitanim =
;projremanim =26
;projcancelanim =
projscale = 2,-2
projremove = -1
projremovetime = 70
velocity = -6,-7
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-145
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
persistent =1
damage=50, 20
hitflag=maf

[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =25
projanim =25
;projhitanim =
;projremanim =26
;projcancelanim =
projscale = 2,-2
projremove = -1
projremovetime = 70
velocity = 6,-7
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-145
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
persistent =1
damage=50, 20
hitflag=maf

[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =24
projanim =24
;projhitanim =
;projremanim =26
;projcancelanim =
projscale = 2,-2
projremove = -1
projremovetime = 70
velocity = 6,0
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-145
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
persistent =1
damage=50, 20
hitflag=maf

[State 0, Projectile]
type = Projectile
trigger1 =AnimElem=7
ProjID =24
projanim =24
;projhitanim =
;projremanim =26
;projcancelanim =
projscale = 2,-2
projremove = -1
projremovetime = 70
velocity = -6,0
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = -6,-145
postype = P1         ;P2, Front, Back, Left, Right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;ignorehitpause =
persistent =1
damage=50, 20
hitflag=maf]
Last Edit: January 22, 2022, 03:20:04 AM by Pizzaking405
Re: Projectiles not colliding with target.
#2  January 20, 2022, 09:33:07 PM
  • avatar
    • USA
Here is a video showing what the move looks like right now. The needles are the main projectiles that I need help with. The black hole that appears at the tip of Elpizo's sword is also coded as a projectile, but I don't intend for it to deal damage. The burst that comes up when the projectile hits the ground is the projremanim. I also intend for said burst to deal damage, but I will get to that after I figure out how to get the main projectiles to collide with the target. [youtube][https://youtu.be/vcxVTTur9_k/youtube]
Re: Projectiles not colliding with target.
#3  January 23, 2022, 02:29:38 AM
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Projectiles take hitdef parameters. You don't use a separate hitdef for them. Specifically here though you're missing the attr setting which prevents attacks hitting. Youll need the rest too but attr not being there makes stuff miss regardless of other settings


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.