Making a missile that stops and retargets player

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Making a missile that stops and retargets player

Post by Amuscaria »

I'm trying to make a projectile that stops after a short flight, and then re-fires in the players new location (kinda like incremental seeker). It can do this 5 times before detonating.

I got most of the decorate working except 1 major problem, the pitch for the projectile isn't adjusted, (no Z velocity). Without it, the projectile just either flies over the player or below while tracking the player's position. I'm not sure how to write an expression that adjusts the pitch.

Code: Select all

ACTOR SentinelShot : CacodemonBall
{
   Radius 6
   Height 12
   Speed 18
   Damage 10
   DamageType fire
   ALPHA 0.85
   ReactionTime 5
   +THRUGHOST   
   +FORCEXYBILLBOARD
   +SEEKERMISSILE
   Seesound "weapons/magic1"
   deathsound "weapons/magic9"
   Obituary "%o was fried by a Guardian."
   States
   {
   Spawn:
      CFX3 ABABABABABABABABAB 3 Bright
	  CFX3 A 3 Bright A_Stop
	  CFX3 BABAB 3 Bright
	  CFX3 A 0 Bright A_PlaySound("weapons/magic1",4)
	  CFX3 AAAA 0 Bright A_SeekerMissile(90,90,0,100,10240)
	  CFX3 A 0 Bright A_Countdown
	  CFX3 A 0 Bright A_ChangeVelocity(18,0,0, CVF_RELATIVE|CVF_REPLACE) <====this part
      loop
   Death:
      CFX3 CDEF 3 Bright
      stop
   }
}
If what I want is impossible I'll just stick to the long way and make the projectile spawn a series of other projectiles to simulate the effect.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Making a missile that stops and retargets player

Post by Apeirogon »



I`M ON THE TEN OF THE TWELWE POINT SKILL OF DECORATE
Spoiler:
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Making a missile that stops and retargets player

Post by Amuscaria »

Ah thanks! :D Didn't know there was A_SetSpeed.

Return to “Scripting”