Homing Missiles

By Postal

Intermediate

 

            I am quite sure we all like having a lock on someone with the eightball, it is always fun to know you are going to hit someone with a little package of pain.  But perhaps you are sick of having to keep aiming at the stupid bots as they run around like headless chickens.  Well now I shall tell you what to do about it.  We are going to make a subclass or RocketMK2.  We are going to modify the code used in the seeking missiles to find a target them by themselves.  So to go over quick idea, the eightball finds the target you are looking at, and tell the rocket that, we are going to make the rocket find its own target.

 

So lets look at the seeking rocket code:

 

simulated function Timer()

This is timer so it is called upon constantly to keep updating the course of the missile towards the target

           {

            local ut_SpriteSmokePuff b;

            local vector SeekingDir;

            local float MagnitudeVel;

 

            if ( InitialDir == vect(0,0,0) ) InitialDir = Normal(Velocity);

            if ( (Seeking != None) && (Seeking != Instigator) )

            {

If the guy we are aiming at is not you or if that guys doesn’t exist

                        SeekingDir = Normal(Seeking.Location - Location);