This will make grenades follow a player, then blow up ten seconds after it starts chasing them.
In g_local.h
Find:
g_constructible_stats_t constructibleStats;
Below Add:
//bacon
int  specialTime;
This is how we’re going to control the explosion time.
Find:
//
// g_utils.c
//
Add Below:
// bacon
gentity_t *findradius(gentity_t *ent, vec3_t org, float radius);
In g_utils.c
At the very bottom of the file add:
gentity_t *findradius (gentity_t *ent, vec3_t org, float radius) {
vec3_t eorg;
int i;
if (!ent)
ent = g_entities;
else
ent++;
for (; ent <= &g_entities[level.numConnectedClients-1]; ent++) {
if (!ent->inuse)
continue;
for ( i = 0; i < 3; i++) {
eorg[i] = org[i] - (ent->r.currentOrigin[i] + (ent->r.mins[i] + ent->r.maxs[i]) * 0.5);
}
if (VectorLengthSquared(eorg) > SQR(radius))
continue;
return ent;
}
return NULL;
}
In g_missile.c
Find:
/*
=================
fire_grenade
NOTE!!!! NOTE!!!!!
This accepts a /non-normalized/ direction vector to allow specification
of how hard it's thrown. Â Please scale the vector before calling.
=================
*/
gentity_t *fire_grenade (gentity_t *self, vec3_t start, vec3_t dir, int grenadeWPID) {
ABOVE it add:
void G_FollowMe( gentity_t *self ) {
gentity_t *target = NULL;
vec3_t  dir, start, end;
if (!target) {
 while ((target = findradius(target, self->r.currentOrigin, 764)) != NULL) {
 // we must have a client
 if (!target->client) {
  continue;
 }
 // the target must have health left
 if ( target->health <= 0 ) {
  continue;
 }
 // the target must be able to take damage
 if ( !target->takedamage )
  continue;
 // when ff is disabled we will not attack teammates
 if ( g_friendlyFire.integer == 0 && OnSameTeam(self, target) ) {
  continue;
 }
 // only if there's no specialtime
 if (self->specialTime <= 0)
  self->specialTime = level.time + 10000;
 VectorCopy(self->r.currentOrigin, start);
 VectorCopy(target->r.currentOrigin, end);
 VectorSubtract(end, start, dir);
 VectorNormalize(dir);
 // scale the movement
 VectorScale(dir, 200, self->s.pos.trDelta);
 VectorCopy(dir, self->movedir);
 SnapVector(self->s.pos.trDelta);  // save net bandwidth
 }
}
// when we have reached our boom time, blow up
if ( level.time > self->specialTime && self->specialTime > 0 ) {
 G_ExplodeMissile( self );
 return;
}
self->nextthink = level.time + 20;
self->think = G_FollowMe;
}
This is the follow code. It will only follow clients with health, and can take damage. It will not follow teammates when friendly fire is disabled. It will find the distance between the client and the grenade, then the grenade will move closer to the client; it will hop towards the client!
Finally in fire_grenade()
Find:
case WP_GRENADE_LAUNCHER:
 bolt->classname   = "grenade";
 bolt->splashRadius  = 300;
 bolt->methodOfDeath  = MOD_GRENADE_LAUNCHER;
 bolt->splashMethodOfDeath = MOD_GRENADE_LAUNCHER;
 bolt->s.eFlags   = EF_BOUNCE_HALF | EF_BOUNCE;
 break;
 case WP_GRENADE_PINEAPPLE:
 bolt->classname   = "grenade";
 bolt->splashRadius  = 300;
 bolt->methodOfDeath  = MOD_GRENADE_LAUNCHER;
 bolt->splashMethodOfDeath = MOD_GRENADE_LAUNCHER;
 bolt->s.eFlags   = EF_BOUNCE_HALF | EF_BOUNCE;
Replace it with:
case WP_GRENADE_LAUNCHER:
 bolt->classname   = “grenade”;
 bolt->splashRadius  = 300;
 bolt->methodOfDeath  = MOD_GRENADE_LAUNCHER;
 bolt->splashMethodOfDeath = MOD_GRENADE_LAUNCHER;
 bolt->s.eFlags   = EF_BOUNCE_HALF | EF_BOUNCE;
  // bacon - stalk somebody;o
  //bolt->nextthink = level.time + 1000;
  bolt->nextthink = level.time + 10;  // 1s is buggy, sometimes the nade would sit in the ground
  bolt->think = G_FollowMe;
  bolt->parent = self;
 break;
 case WP_GRENADE_PINEAPPLE:
 bolt->classname   = “grenade”;
 bolt->splashRadius  = 300;
 bolt->methodOfDeath  = MOD_GRENADE_LAUNCHER;
 bolt->splashMethodOfDeath = MOD_GRENADE_LAUNCHER;
 bolt->s.eFlags   = EF_BOUNCE_HALF | EF_BOUNCE;
  // bacon - stalk somebody;o
  //bolt->nextthink = level.time + 1000;
  bolt->nextthink = level.time + 10;  // 1s is buggy, sometimes the nade would sit in the ground
  bolt->think = G_FollowMe;
  bolt->parent = self;
All done :)
Really all that needs to be done is a check to see how close the grenade is to a client and if it's too close it shouldn't move. Maybe also reset specialTime when there's no target found.
BTW, the aligning in the code is messed up because I copy + pasted from my post on an invisionboard.
