Quake Style - Quake 3 Tutorials
New Game Styles - InstaGib Railgun
Railguns only, unlimited slugs, instant gibbing. What more can you want?

InstaGib Railgun

This simple modification turns the game into a rail-fest where one shot = one kill. It's rather simple to make this an optional mode of your mod with cvars, but for this we'll just make it permanent.

Files to be modified:
 
bg_pmove.c
g_client.c
g_items.c
g_weapon.c

Let's get started - First open up bg_pmove.c and go to the definition of the PM_Weapon( void ) function. Find these lines:
 
	// take an ammo away if not infinite
	if ( pm->ps->ammo[ pm->ps->weapon ] != -1 ) {
		pm->ps->ammo[ pm->ps->weapon ]--;
	}

Insert this line just after the if statement in the code above:
  
		if ( pm->ps->weapon != WP_RAILGUN ) // InstaGib - unlimited ammo


This will make sure that the railgun never runs out of ammo. It'd be just as simple to set the railgun ammo to -1, but that would cause another problem: the "out of ammo" text would be shown all the time to each player. Annoying, no? Doing it this way prevents that problem, although it could be solved by modifying the client game code.

Next open up g_client.c and go to the definition of the ClientSpawn(gentity_t *ent) function and find these lines:
  
	client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MACHINEGUN );
	if ( g_gametype.integer == GT_TEAM ) {
		client->ps.ammo[WP_MACHINEGUN] = 50;
	} else {
		client->ps.ammo[WP_MACHINEGUN] = 100;
	}


Replace the above lines with these:
  
	// InstaGib - weapons on spawning w/ammo
	client->ps.stats[STAT_WEAPONS] = ( 1 << WP_RAILGUN );
	client->ps.ammo[WP_RAILGUN] = 99;
 

That gives the spawning player a railgun and 99 slugs, which won't ever run out because of the change in bg_pmove.c.

Next go down a bit further until you find this line:
  
		client->ps.weapon = WP_MACHINEGUN;
 

Replace it with this one:
  
		client->ps.weapon = WP_RAILGUN; // InstaGib
 

That simply causes the railgun to be brought up on spawn, instead of the machinegun.

Now open up g_items.c and find the definition of the G_SpawnItem (gentity_t *ent, gitem_t *item) function.

Right at the top, before any of the other code, put this:
  
	// InstaGib - prevent weapons and ammo from spawning
	if ( item->giType == IT_WEAPON || item->giType == IT_AMMO)
		return;
 

This prevents any other weapons or ammo spawning, since we only want to use the railgun and it won't run out of ammo.

Lastly open up g_weapon.c and go to the weapon_railgun_fire (gentity_t *ent) function. Find this line:
 
	damage = 100 * s_quadFactor;


Replace it with this:
  
	damage = 1000 * s_quadFactor;// InstaGib - increase damage!
 

That'll do nicely to instantly gib any player that's hit.

That's all there is to it! Enjoy.

-- Credits:
   Tutorial by Willi
   Return to QS Tutorials

-- Important:
   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.