Homing a projectile properly

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Cjk10000
Posts: 98
Joined: Fri Jan 02, 2009 10:13 am

Homing a projectile properly

Post by Cjk10000 »

One problem I'm having is getting the projectile to home for humans (originally it is planned for Skulltag, but thus far I'm just testing it on ZDoom monsters). The code for the red shotgun shell is below (it's a test run), and I've been able to get the actor itself to work, but I'm struggling to have it home in on something. When I fire it from my gun

Code: Select all

, works, but it does not seek.

[code]ACTOR RedShell 25000
{
  Speed 12
  Radius 16
  Height 28
  Mass 0
  Damage 10
  PROJECTILE
  +SEEKERMISSILE
  +SKYEXPLODE
  States
  {
  Spawn:
    RSHL AB 4 A_SeekerMissile (90,90)
    Loop
  Death:
  	MISL B 8
	MISL C 6
	MISL D 4
    Stop
  }
}


// Code for firing

    PISG B 4 A_FireCustomMissile ("RedShell", 0,1,8,8,0)
Thus far my projectile doesn't have any homing abilities.

Is there something I'm doing wrong? :(
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Homing a projectile properly

Post by NeuralStunner »

You need SMF_LOOK in A_SeekerMissile, probably.

However, I don't know if the function itself is even available in Skulltag, much less the extended functionality. :(
User avatar
Cjk10000
Posts: 98
Joined: Fri Jan 02, 2009 10:13 am

Re: Homing a projectile properly

Post by Cjk10000 »

Yeah it's not available in skulltag :( They only allow two parameters to A_SeekerMissle

I tried looking at Ghouls vs Humans to see what Cutman did. His used A_SeekerMissile and the +SEEKERMISSILE flag as well:

Code: Select all

SPIR P 0 A_SeekerMissile (5, 15) 
I tried replicating that by updating my code:

Code: Select all

  Spawn:
    RSHL A 2
	RSHL A 0 A_SeekerMissile (180, 90) 
	RSHL B 2
	RSHL A 0 A_SeekerMissile (180, 90) 
    Loop
That didn't work. The numbers he used as well I tried to get an exact replica and it did not work.


To further test this, I decided to rip his code in exactly and see if it was just me or not. Apparently his code doesn't work in my thing despite having copied it exactly (just his homing missile), but it does work in his online. I did test it through ST :/ Life is so fun :)
Therefore I have to find out what I'm missing, though I'm quite stuck since it technically should be working.


The only other thing I can think of is, would there be a known wad that has homing stuff inside of it that I could also look at?
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Homing a projectile properly

Post by Blue Shadow »

I tried your code and it works as it should.

The whole code for the weapon might help, though I don't think it is relative.
NeuralStunner wrote:You need SMF_LOOK in A_SeekerMissile, probably.
SMF_LOOK is not a requirement for a seeker projectile to function properly.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Homing a projectile properly

Post by NeuralStunner »

Blue Shadow wrote:SMF_LOOK is not a requirement for a seeker projectile to function properly.
It is to hit something you're not aiming directly at. Or, often, something that's too far away.
User avatar
Cjk10000
Posts: 98
Joined: Fri Jan 02, 2009 10:13 am

Re: Homing a projectile properly

Post by Cjk10000 »

I just turned Autoaim to "always" and it seems to work O_o


My only question now is:

1) How can I widen the angle that it will turn? I tried using
A_SeekerMissile (180, 90)
But it only seems to work if you're aiming dead on the actor. It was the exact same as "A_SeekerMissile (0, 5)"
Is there any way to make the angle of homing in a bit more drastic (having it being able to do 60-90 degree turns would be best)

EDIT: Well it seems to home better, but I don't understand the first argument of A_SeekerMissile. It's defined as
Specifies the angle inside which the missile will home in directly on its tracer. If the angle toward the target is larger than threshold it will change its movement angle only partially towards the tracer.
What does it mean by the angle 'inside'?

2) Is there a way to make seekers work with having autoaim set to "never"?
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Homing a projectile properly

Post by Blue Shadow »

NeuralStunner wrote:
Blue Shadow wrote:SMF_LOOK is not a requirement for a seeker projectile to function properly.
It is to hit something you're not aiming directly at. Or, often, something that's too far away.
Yes I know that, but the projectile would still seek if you are close enough and the target is under your crosshair without the flag.
Cjk10000 wrote:I just turned Autoaim to "always" and it seems to work O_o
For me, it works fine whether I set it to 'Always' or 'Never'. Of course, I use the mouse when setting it to 'Never'.
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: Homing a projectile properly

Post by amv2k9 »

Cjk10000 wrote: I don't understand the first argument of A_SeekerMissile. It's defined as
Specifies the angle inside which the missile will home in directly on its tracer. If the angle toward the target is larger than threshold it will change its movement angle only partially towards the tracer.
What does it mean by the angle 'inside'?
Imagine that we're looking at your projectile from a top-down, 'bird's-eye' view. The area that your projectile can see in is represented as a cone (think of the soldiers in MGS if you've played that).

The lower the number that threshold is set to, the narrower the area that your projectile can see in, and thus the narrower the range in which it can acquire a target.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Homing a projectile properly

Post by NeuralStunner »

Technically it searches for targets in a full 360 egree range (if set to seek freely). The direct angle means it will point directly at what it's homing toward. Generally this should be a small number, unless you want it turning corners sharply. :P
Locked

Return to “Editing (Archive)”