Quake Style - Quake 3 Tutorials
Weapon Mods - Remote Detonation Pipe Bombs!
Turns the grenade launcher into a pipe bomb launcher!
This tutorial modifies the original grenade launcher so the grenades explode on command.
First, open up g_missile.c and goto about line 296 to the fire_grenade function and modify
bolt->nextthink = level.time + 2500;
so it looks like this:
bolt->nextthink = level.time + 60000;
This will change the amount of time each grenade waits before exploding.
Next goto g_cmds.c and at the very top right after #include "g_local.h" add the following:
void G_ExplodeMissile( gentity_t *ent );
This declares the G_ExplodeMissile function in g_missile.c so we can use it here.
At around line 1027 before ClientCommand we are going to add the command that will detonate the grenades. Add this:
void Cmd_Detonate_f( gentity_t *ent)
gentity_t *grenades = NULL;
while ((grenades = G_Find (grenades, FOFS(classname), "grenade")) != NULL) //search for grenade entities
if(grenades->r.ownerNum == ent->s.clientNum) //make sure its our grenade
grenades->think = G_ExplodeMissile;
grenades->nextthink = level.time + 5;
This will search for grenades in the level and makes sure it belongs to the player who fired it, then finally detonates it. After (at around line 1112):
else if (Q_stricmp (cmd, "setviewpos") == 0)
Cmd_SetViewpos_f( ent );
else if (Q_stricmp (cmd, "detonate") == 0)
This adds a console command that will call the Cmd_Detonate_f function we made when typed in the console. Compile and run. Make sure you type /detonate in the console, you now have a grenade launcher that fires pipe bombs.
Tutorial by Gerbil!
Return to QS Tutorials
If you do use something from QuakeStyle in your mod, please give us credit.
Our code is copyrighted, but we give permission to everyone to use it in any way they see fit, as long as we are recognized.