Tossing Runes in CTF

How to add the toss runes facility to your QW CTF 4.2 servers (should work for classic Quake servers too).

Change to the qwsrc (or src for classic Quake) subdirectory, edit the items.qc file, and add this in after the “void() DropRune = { … }” function.

// TossRune is bound to impulse 19
// Cloud-Warrior, 6 February, 1998

void (float flag) Do_TossRune =
{
  local entity    item;

  item = spawn();

  item.player_flag = flag;

  item.owner = self;
  makevectors(self.v_angle);

  setorigin(item, self.origin + '0 0 32');
  item.velocity = aim(self, 1000);
  item.velocity = item.velocity * 500;
  item.flags = FL_ITEM;
  item.solid = SOLID_TRIGGER;
  item.movetype = MOVETYPE_BOUNCE;

  if (flag & ITEM_RUNE1_FLAG)
    setmodel (item, "progs/end1.mdl");
  else if (flag & ITEM_RUNE2_FLAG)
    setmodel (item, "progs/end2.mdl");
  else if (flag & ITEM_RUNE3_FLAG)
    setmodel (item, "progs/end3.mdl");
  else if (flag & ITEM_RUNE4_FLAG)
    setmodel (item, "progs/end4.mdl");
  setsize (item, '-16 -16 0', '16 16 56');
  item.touch = RuneTouch;
  item.nextthink = time + 120; /* if no one touches it in two minutes,
    respawn it somewhere else, so inaccessible ones will come 'back' */
  item.think = RuneRespawn;
};

/*
===============
Tossrune
self is player
===============
*/
void() TossRune =
{
  if (self.player_flag & ITEM_RUNE1_FLAG)
    Do_TossRune(ITEM_RUNE1_FLAG);
  if (self.player_flag & ITEM_RUNE2_FLAG)
    Do_TossRune(ITEM_RUNE2_FLAG);
  if (self.player_flag & ITEM_RUNE3_FLAG)
    Do_TossRune(ITEM_RUNE3_FLAG);
  if (self.player_flag & ITEM_RUNE4_FLAG)
    Do_TossRune(ITEM_RUNE4_FLAG);
  self.player_flag = self.player_flag - (self.player_flag & ITEM_RUNE_MASK);
};

Edit weapons.qc and add this text in after “else if (self.impulse == 99) PrintLocation();”.

// *TEAMPLAY*
// If we're allowed to drop items, enable impulse 19 to toss a rune
// Cloud-Warrior, 6 February, 1998
  else if ((teamplay & TEAM_DROP_ITEMS) && self.impulse == 19)
    TossRune ();

Compile with qcc. For some strange reason, you have to aim upwards at an angle of around 45 degrees before you can release your rune! This facility is available on the QuakeWorld server ctf1.quake.ie.

0 Responses to “Tossing Runes in CTF”


  1. No Comments

Leave a Reply