Just as the title says, I'm trying to code a homing attack but I don't know how to code the vels to work like that.Also, I'm having issues with the change state, or with the flight state, I'm not sure what's wrong. ;---------------------------------------------------------; Homing Attack Start - from ground[statedef 950]type = aphysics = aanim = 950[state 50, 6]type = turntrigger1 = p2dist x < 0[State 1155, VelSet]type = VelSettrigger1 = time = 0y = -7[State 1155, VelAdd]type = VelAddtrigger1 = animelem = 5y = .75[State 1155, VelAdd]type = VelAddtrigger1 = animelem = 6y = 0[state 50, 12]type = changestatetrigger1 = anim=950trigger1 = animelem = 7value = 951;---------------------------------------------------------; Homing Attack flight[statedef 951]type = aphysics = aanim = 951[state 50, 6]type = turntrigger1 = p2dist x < 0[state 50, 7]type = velsettrigger1 = Time = 0x = 8[State 1200, Hitdef]type = HitDeftrigger1 = !Timeattr = A, SAhitflag = MAFguardflag = MA;animtype = hardpriority = 7, Hitdamage = 0;Ceil(IfElse(fvar(11) * (20+3*(var(5)=1)+6*(var(5)=2)) < 7, 7, fvar(11) * (20+3*(var(5)=1)+6*(var(5)=2)))), 2+(var(5)=1)+2*(var(5)=2);20+3*(var(5)=1)+6*(var(5)=2),2+(var(5)=1)+2*(var(5)=2)pausetime = 1,1sparkno = -1guard.sparkno = -1sparkxy = -10, -9hitsound = -1guardsound = -1p2facing = 1ground.type = lowground.slidetime = 12ground.hittime = 12ground.velocity = -2,-9air.velocity = -2,-8;fall = 1fall.recover = 0getpower = IfElse(P2MoveType = H,40,140), 35givepower = 35,35envshake.time = 16envshake.freq = 60envshake.ampl = 4yaccel = 0.5;p1stateno = 1202persistent = 0;snap = 20,50[State 1200, TargetBind]type = TargetBindtrigger1 = MoveHit = 1time = 1pos = 5+p2bodydist x, p2bodydist y;60ignorehitpause = 1persistent = 0[State 1200, ChangeState]type = ChangeStatetrigger1 = MoveHit = 1 && Enemy,Movetype = H ;if you write "Target, MoveType = H" you'll get debug flood. value = 952ctrl = 0ignorehitpause = 1persistent = 0;---------------------------------------------------------; Homing Attack hit[statedef 952]type = Amovetype = Aphysics = AAnim = 610;velset = 0,0sprpriority = 2ctrl = 0[State 610, 1]type = playsndtrigger1 = animelem = 1 && random <= 800value = s2000,0+random%4volume = 255channel = 0[State 610, 2]type = Playsndtrigger1 = animelem = 1value = s4000,1[State 610, 3]type = HitDeftrigger1 = Time = 0attr = A, NAdamage = 22animtype = Mediumhitflag = MAFguardflag = HApausetime = 14,14sparkxy = 0,-40sparkno = s9104guard.sparkno = s9101hitsound = s5544,1guardsound = s5546,0ground.type = lowair.type = Highground.slidetime = 12ground.hittime = 12air.hittime = 12guard.ctrltime = 15ground.velocity = -1guard.velocity = -5air.velocity = -1,-7.25airguard.velocity = -5,-1ground.cornerpush.veloff = 0air.cornerpush.veloff = 0airguard.cornerpush.veloff = 0getpower = 35,35givepower = 35, 35yaccel = .5fall.xvelocity =0fall.yvelocity =-2[State 600, Changestate]type = ChangeStatetrigger1 = AnimTime = 0value = 460The char jumps and it seemingly changes to the flight state but It lands inmediately. What I want it to do: jump, stay in the air for like 20 ticks, then change to the flight, follow P2 vertically and when in contact, hit.
So you don't want an actual homing attack, you just want to match your opponents vertical velocity? Or fly to his location vertically? Not horizontally?Just following your opponent vertically should be as simple as something like..[state 0, velset]type=velsettrigger1=1y=enemynear,vel yignorehitpause=1somethin' like that.
That works for the Y vel, but I still need it to fly towards p2.Look, what I'm aiming for is the DBZ pursuit attack
[state 50, 12]type = changestatetrigger1 = anim=950 ;redundant. There's no way for it not to be 950 from what I can telltrigger1 = animelem = 7 ;change this to >=7 to avoid problemsvalue = 951[state 50, 6]type = turntrigger1 = p2dist x < 0 ;having it at 0 will SNAP the player. It may cause jitters if P2 is hovering above P1.[state 50, 7]type = velsettrigger1 = Time = 0x = 8So where's the velset/veladd for when P2 moves? I'm not familiar with the DBZ move. But you're going to want to slow down the vel x to switch which way it's heading. I'd say look at Shadow Lady's homing missiles. They're pretty relentless. My Samus' homing missiles dont bother going backwards.