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

  1. void(vector org) spawn_hfog =
  2. {
  3.     s = spawn ();
  4.     s.origin = org;
  5.     s.nextthink = time + 0.2;
  6.  
  7.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  8.     WriteByte (MSG_BROADCAST, TE_TELEPORT);
  9.     WriteCoord (MSG_BROADCAST, org_x);
  10.     WriteCoord (MSG_BROADCAST, org_y);
  11.     WriteCoord (MSG_BROADCAST, org_z);
  12.     remove (s);
  13. };
  14.  
  15.  
  16. void(entity ex) hologram_explode =
  17. {
  18.     if (ex.owner.camera >= 1)  //Check to see if the camera is on.
  19.     {
  20.         ex.owner.camera = 0;              //Set the camera_on variable to 0 for off
  21.         CameraOff(ex.owner); //and turn the camera off.
  22.      }
  23.      ex.owner.holo = 0;   //set the self.holo to 0 so that
  24.                                    //the player can re-activate the
  25.                                    //hologram.
  26.  
  27.      makevectors(ex.angles);
  28.      sound (self, CHAN_VOICE, "player/holooff.wav", 1, ATTN_NORM);
  29.      spawn_hfog (ex.origin);
  30.      ex.nextthink = time + 0.1;
  31.      ex.think = SUB_Remove;
  32. };
  33.  
  34. void() holo_touch =
  35. {
  36.         makevectors(self.angles);
  37.         if (other == self.owner)
  38.                 sound (self, CHAN_AUTO, "player/hologon.wav", 1, ATTN_NORM);
  39.         else
  40.                 sound (self, CHAN_AUTO, "items/Inv1.wav", 1, ATTN_NORM);
  41.         spawn_hfog (self.origin);
  42. };
  43.  
  44. void() holo_i =
  45. {
  46.         self.holo = self.holo + 1;
  47.         if (self.holo >= 300)      //Check if it is time to self-terminate
  48.                                     //the hologram program.
  49.           {
  50.            sprint (self.owner,"Hologram shutdown...\n");
  51.            hologram_explode(self);
  52.           }
  53.     else
  54.     {
  55.          self.frame = self.frame + 1;
  56.          if (self.frame < 12 || self.frame > 16)
  57.                 self.frame = 12;
  58.          self.skin = self.owner.skin;
  59.          self.colormap = self.owner.colormap;
  60.          self.nextthink = time + 0.1;
  61.          self.think = holo_i;
  62.     }
  63. };
  64.  
  65. void(vector org, vector dir) launch_hologram =
  66. {
  67.    if (self.holo > 0)
  68.       {
  69.         sprint (self,"The hologram is already running.\n");
  70.         return;
  71.       }
  72.         hologram = spawn ();
  73.         hologram.owner = self;
  74.         self.holo = 1;
  75.         self.myhologram = hologram;
  76.         hologram.flags = FL_ITEM;
  77.         hologram.movetype = MOVETYPE_STEP;
  78.         hologram.solid = SOLID_TRIGGER;
  79.         hologram.angles = vectoangles(dir);
  80.         hologram.touch = holo_touch;
  81.         setmodel (hologram, "progs/player.mdl");
  82.         hologram.skin = self.skin;
  83.         hologram.colormap = self.colormap;
  84.         setsize (hologram, '-16 -16 -24', '16 16 40');
  85.         setorigin (hologram, org);
  86.         hologram.velocity = dir * 10;
  87.         hologram.frame = 13;  //Once the mdl file is displayed, I use
  88.                               //this to tell which frame to display
  89.         hologram.classname = "hologram";  //This is very important so that
  90.                                           //later on you can refer to the
  91.                                           //entity as a "hologram"
  92.         hologram.nextthink = time + 1;
  93.         hologram.think = holo_i;//This is the start of the
  94.                                           //bobbing up and down.
  95.         sprint (self, "Hologram launched...\n");
  96. };
  97.