home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / qwiz12 / pforce.qc < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.2 KB  |  82 lines

  1. //---------------------------
  2. //    Phantasmal Force spell
  3. //
  4. //----------------------------
  5.  
  6.  
  7. float    IT_PFORCE = 8388608;    // illusion mask flag
  8. float   IT_PFORCE_neg = 8388607;    // negative illusion bit mask flag
  9.  
  10.  
  11. //--------------------------------------------------------------------
  12. // When time expires spell is finished
  13. //--------------------------------------------------------------------
  14. void() RemovePforce =
  15. {
  16.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  17.         WriteByte (MSG_BROADCAST, TE_TELEPORT);
  18.         WriteCoord (MSG_BROADCAST, self.origin_x);
  19.         WriteCoord (MSG_BROADCAST, self.origin_y);
  20.         WriteCoord (MSG_BROADCAST, self.origin_z);
  21.         sound (self, CHAN_BODY, "misc/r_tele3.wav", 1, ATTN_NORM);
  22.  
  23.     SUB_Remove();
  24.     self.owner.items = self.owner.items & IT_PFORCE_neg;
  25.     sprint(self.owner,"Your phantasm has expired\n");
  26. };
  27.  
  28.  
  29.  
  30. //--------------------------------------------------------------------
  31. // Cast spell
  32. //--------------------------------------------------------------------
  33. void(entity myself) ActivatePforce =
  34. {
  35.     local entity    pforce;
  36.  
  37.     pforce = spawn();
  38. //    pforce.solid = SOLID_NOT;
  39.     pforce.solid = SOLID_BBOX;
  40.  
  41.     pforce.movetype = MOVETYPE_NOCLIP;
  42.  
  43.     pforce.origin = (self.origin + v_forward*100 + '0 0 0');
  44. //    pforce.origin = myself.origin;
  45.     pforce.angles = myself.angles;
  46.     pforce.colormap = 00;
  47.     setmodel (pforce, "progs/player.mdl");
  48.     pforce.classname = "pforce";
  49.     pforce.owner=myself;
  50.     pforce.frame=30;
  51.     pforce.nextthink = time + 10;    
  52.     pforce.think = RemovePforce;
  53.     myself.items = myself.items | IT_PFORCE;
  54.     stuffcmd (pforce.owner, "bf\n");
  55.     sprint(pforce.owner,"Phantasmal Force has been cast\n");
  56. };
  57.  
  58.  
  59.  
  60. //--------------------------------------------------------------------
  61. // Checks if spell can be cast
  62. //--------------------------------------------------------------------
  63. void() PforceC = 
  64. {
  65.     if ((self.items & IT_PFORCE) == IT_PFORCE)
  66.     {
  67.         sprint(self,"An illusion has already been cast\n");
  68.         return;
  69.     }
  70.  
  71.     if (self.ammo_cells < 10)
  72.     {
  73.         sprint(self,"cells are low\n");
  74.         return;
  75.     }
  76.       self.currentammo = self.ammo_cells = self.ammo_cells - 10;
  77.     W_SetCurrentAmmo();
  78.  
  79.     sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
  80.     ActivatePforce (self);
  81. }; 
  82.