home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / sgqcver2 / throwaxe.qc < prev    next >
Encoding:
Text File  |  1996-08-21  |  3.1 KB  |  88 lines

  1. void() AxeTouch =
  2. {
  3.         local   float   clink;
  4.         local   entity  stemp;
  5.  
  6.         if (other == self.owner && self.num_bounces == 0)
  7.                 return;
  8.         self.avelocity = '300 300 300';
  9.         self.movetype = MOVETYPE_BOUNCE;
  10.         setsize (self, '-1 -2 -3' , '1 2 3');
  11.  
  12.         if (other.classname == "player" && self.velocity == '0 0 0')
  13.         {
  14.                 sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  15.                 sprint(other,"You Got A Throwing Axe!\n");
  16.                 other.num_axes = other.num_axes + 1;
  17. //                self.currentammo = self.num_axes;
  18. //                W_SetCurrentAmmo ();
  19.                 stemp = self;
  20.                 self = other;
  21.                 W_SetCurrentAmmo();
  22.                 self = stemp;
  23.                 remove(self);
  24.         }
  25.         if (other.takedamage && self.velocity != '0 0 0')
  26.         {
  27.                 if (self.num_bounces == 0)
  28.                 {
  29.                         spawn_touchblood (40);
  30.                         SpawnChunk (self.origin,self.velocity);
  31.                         other.punchangle_x = -20;
  32.                         self.velocity = self.velocity * -0.1;
  33.                         self.avelocity = '0 0 0';
  34.                         other.axhitme = 1;
  35.                         T_Damage (other, self, self.owner, 40);
  36.                 }
  37.                 else
  38.                 {
  39.                         other.punchangle_x = -10;
  40.                         spawn_touchblood (15);
  41.                         self.velocity = self.velocity * -0.1;
  42.                         self.avelocity = '0 0 0';
  43.                         other.axhitme = 1;
  44.                         T_Damage (other, self, self.owner, 8);
  45.                 }
  46.         }
  47.         else if (!other.takedamage)
  48.         {
  49.                 clink = random() * 2;
  50.                 if (clink <=1)
  51.                 sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
  52.                 else
  53.                 sound (self, CHAN_WEAPON, "weapons/tink1.wav", 1, ATTN_NORM);
  54.         }
  55.         self.num_bounces = self.num_bounces + 1;
  56.         if (self.num_bounces > 22)
  57.                 SUB_Remove();
  58. };
  59.  
  60. void() W_ThrowAxe =
  61. {
  62.         local   entity missile;
  63.  
  64.         sound (self, CHAN_WEAPON, "weapons/woosh.wav", 1, ATTN_NORM);
  65.         self.punchangle_x = -6;
  66.     missile = spawn ();
  67.     missile.owner = self;
  68.         missile.movetype = MOVETYPE_FLYMISSILE;
  69.         missile.solid = SOLID_TRIGGER;
  70.         makevectors (self.v_angle);
  71.         missile.velocity = aim(self, 10000);
  72.         missile.angles = vectoangles(missile.velocity);
  73.         missile.velocity = missile.velocity * 600;
  74.         missile.touch = AxeTouch;
  75.         missile.nextthink = time + 600;
  76.         missile.think = SUB_Remove;
  77.         setmodel (missile, "progs/throwaxe.mdl");
  78.         setsize (missile, '0 0 0' , '0 0 0');
  79.         setorigin (missile, self.origin + v_forward*2 + '0 0 16');
  80.         missile.avelocity ='-500 0 0';
  81.         missile.num_bounces = 0;
  82.         self.num_axes = self.num_axes - 1;
  83.         self.currentammo = self.num_axes;
  84.         W_SetCurrentAmmo ();
  85. };
  86.  
  87.  
  88.