Questions?  Comments?               telebutton.gif (26796 bytes)

 

 

Quad Rune Powerup!

 

This is a little tutorial I put together in request that
a player can keep the quad until death and when that
player does die, the quad last for 10 seconds before
disappearing..

Here's how you do it!

Add in the blue code and take out any pink code.

What you want to do is to find your Use_Quad() function in
your g_items.c file and change the name of that function to
Use_Quad2() (and we'll substitute in a new function in its
place)..

Here is the new Use_Quad() function..

 


//==========================================================
// Quad item's use() function - KEEP QUAD UNTIL DEAD..
//==========================================================
void Use_Quad(edict_t *player, gitem_t *quad) {  

player->client->pers.inventory[ITEM_INDEX(quad)]--;
ValidateSelectedItem(player);

player->client->quad_framenum=FLT_MAX;

gi.sound(player, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1.0, ATTN_NORM, 0);
}

This will give the player infinite time once they are in
possession of the quad damage! So, they'll keep it until
they are dead and then it gets tossed out like normal.

Okay, now find your TossClientWeapon() function and comment
out the line shown below in the if (quad) statement and add
the new line shown:

 


  if (quad)
  {
    self->client->v_angle[YAW] += spread;
    drop = Drop_Item(self, FindItemByClassname("item_quad"));
    self->client->v_angle[YAW] -= spread;
    drop->spawnflags |= DROPPED_PLAYER_ITEM;
    drop->touch = Touch_Item;
    drop->nextthink = level.time +(self->client->quad_framenum - level.framenum) * FRAMETIME;
    
    drop->nextthink=level.time+10.0; // Add this new line in its place..  

drop->think = G_FreeEdict;
}

This will make the quad disappear in 10 seconds once the quad
has been dropped by a player (if nobody has picked it up)..

Okay, that's it!

Now get out there with your quad and supershotgun and BLOW
THE BASTARDS INTO NEXT WEEK!!

Have Fun!

philip