Sorry for the thread resurrection and hijacking, but as this one came up in a search for my problem, I figure this could help other people in the same situation.
Ceeb wrote:Is there any easy way to make a seekermissile choose a new target after it's current one is dead?
I'm actually trying to create a seekermissile that does
not choose a new target after it's current one is dead. Furthermore, I want it to seek a target when it doesn't have one (initially, that is).
Code: Select all
actor RottHeatSeeker : Rocket //MageStaffFX2
{
height 8
radius 6
damage 5
speed 28
alpha 1
deathsound "misc/shotx"
PROJECTILE
+SEEKERMISSILE
+SCREENSEEKER // only seek for enemies in shooter's FOV
+RocketTrail
-Ripper
states
{
See:
MISL A 2 bright A_SeekerMissile(5,20,SMF_LOOK,255) //,SMF_LOOK,255 // A_MStaffTrack
MISL A 1 bright A_ActiveSound
Loop
Spawn:
MISL A 10 bright
Goto See
Death:
MISL B 8 bright A_Explode
MISL CDEFGHIJKLMNO 2 Bright
stop
}
}
As-is now, the rocket will fire, start seeking after 10 tics (Spawn->See). It'll loop the SeekerMissile directive, then dies whenever it hits a target.
However, when firing 2 missile after another at the same target, they'll both home in on it but when the 1st kills the target, the 2nd one will (again) home in on another target.
I suppose this is due to the missile looking for a new target in the See-loop (with the SMF_LOOK flag), but as I want to make sure the rocket finds any target (even if he didn't get one from the player), I see no other option than to have that loop.
I also tried the MageStaffFX2 / A_MStaffTrack approach, but no luck there. I also couldn't disable the Ripper effect there anyway.
Does anyone have the code to a single target seeking homing missile? Or is this a limitation that would require an extension to A_SeekerMissile, possibly adding an
int seektimes to the SMF_LOOK flag to limit the seeks, or create a new SMF_LOOKONCE flag altogether?