Quake DeveLS - Homing Missile 2

Author: Gregg Reno
Difficulty: Medium

Let's Do It...

First off, the original homing missle mod is great! I've been testing it out on a deathmatch server, and it's perfect for large maps. This tutorial adds to the first homing missile tutorial by Chris Hilton, so be sure to do that one first. Here's the homing missile Mark 2. I modified the code so that when the missle locks on to a target (enemy player), it plays a sound notifying them that there is a missle locked onto them! I have not included the sound file, since I don't know if I have the right to distribute it. The one I'm using is from DeadLoad (http://deadlode.utah.edu) which is a team fortress mod. The sound file is just 3 quick beeps.

[Ed's note : just use any .wav file you like, put be sure to save it as \quake2\modname\sounds\misc\homelock.wav directory, where 'modname' is the name of the mod, e.g. \quake2\homing\sounds\misc\homelock.wav. If you can't find a 'beep beep beep' sound, use anything. Hell, use 'The Microsoft Sound' ! That'll not only alert your opponent that you have a missile locked onto them, but strike fear into their very soul on hearing the annoying microsoft sound ! - SumFuka]

Here are the changes:

g_local.h at the end of the edict_s structure:

	// common data blocks
	moveinfo_t		moveinfo;
	monsterinfo_t	monsterinfo;

+      // GREGG
+      int       homing_lock;    //0 = not locked, 1 = locked
   };
g_weapon.c in homing_think function :
    if (target != NULL)
       {
       // target acquired, nudge our direction toward it
       VectorNormalize(targetdir);
       VectorScale(targetdir, 0.2, targetdir);
       VectorAdd(targetdir, ent->movedir, targetdir);
       VectorNormalize(targetdir);
       VectorCopy(targetdir, ent->movedir);
       vectoangles(targetdir, ent->s.angles);
       speed = VectorLength(ent->velocity);
       VectorScale(targetdir, speed, ent->velocity);

+      //is this the first time we locked in? sound warning for the target
+      if (ent->homing_lock == 0)
+         {
+         gi.sound (target, CHAN_AUTO, gi.soundindex ("misc/homelock.wav"), 1, ATTN_NORM, 0);
+         ent->homing_lock = 1;
+         }
       }
g_weapon.c in fire_rocket function
	rocket->touch = rocket_touch;
//	rocket->nextthink = level.time + 8000/speed;
//	rocket->think = G_FreeEdict;

+      //GREGG - Add homing lock status
+      rocket->homing_lock = 0;

       // CCH: see if this is a player and if they have homing on
       if (self->client && self->client->pers.homing_state)
            {
Now go and play deathmatch. If you hear a 'beep beep beep', start running !

Gregg Reno.

This site, and all content and graphics displayed on it,
are ©opyrighted to the Quake DeveLS team. All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600.
Thanks to Planet Quake for their great help and support with hosting.
Best viewed with Netscape 4