home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / sgqcver2 / hologram.qc < prev    next >
Encoding:
Text File  |  1996-08-18  |  3.1 KB  |  95 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, "misc/R_tele5.wav", 1, ATTN_NORM);
  29.      spawn_hfog (ex.origin + v_forward*20);
  30.      ex.nextthink = time + 0.1;
  31.      ex.think = SUB_Remove;
  32. };
  33.  
  34. void() holo_touch =
  35. {
  36.         makevectors(self.angles);
  37.         sound (self, CHAN_AUTO, "items/Inv1.wav", 1, ATTN_NORM);
  38.         spawn_hfog (self.origin + v_forward*20);
  39. };
  40.  
  41. void() holo_i =
  42. {
  43.         self.holo = self.holo + 1;
  44.         if (self.holo >= 300)      //Check if it is time to self-terminate
  45.                                     //the hologram program.
  46.           {
  47.            sprint (self.owner,"Hologram shutdown...\n");
  48.            hologram_explode(self);
  49.           }
  50.     else
  51.     {
  52.          self.frame = self.frame + 1;
  53.          if (self.frame < 12 || self.frame > 16)
  54.                 self.frame = 12;
  55.          self.skin = self.owner.skin;
  56.          self.colormap = self.owner.colormap;
  57.          self.nextthink = time + 0.1;
  58.          self.think = holo_i;
  59.     }
  60. };
  61.  
  62. void(vector org, vector dir) launch_hologram =
  63. {
  64.    if (self.holo > 0)
  65.       {
  66.         sprint (self,"The hologram is already running.\n");
  67.         return;
  68.       }
  69.         hologram = spawn ();
  70.         hologram.owner = self;
  71.         self.holo = 1;
  72.         self.myhologram = hologram;
  73.         hologram.flags = FL_ITEM;
  74.         hologram.movetype = MOVETYPE_STEP;
  75.         hologram.solid = SOLID_TRIGGER;
  76.         hologram.angles = vectoangles(dir);
  77.         hologram.touch = holo_touch;
  78.         setmodel (hologram, "progs/player.mdl");
  79.         hologram.skin = self.skin;
  80.         hologram.colormap = self.colormap;
  81.         setsize (hologram, '-16 -16 -24', '16 16 40');
  82.         setorigin (hologram, org);
  83.         hologram.velocity = dir * 10;
  84.         hologram.frame = 13;  //Once the mdl file is displayed, I use
  85.                               //this to tell which frame to display
  86.         hologram.classname = "hologram";  //This is very important so that
  87.                                           //later on you can refer to the
  88.                                           //entity as a "hologram"
  89.         hologram.nextthink = time + 1;
  90.         hologram.think = holo_i;//This is the start of the
  91.                                           //bobbing up and down.
  92.         sound (self, CHAN_AUTO, "items/Itembk2.wav", 1, ATTN_NORM);
  93.         sprint (self, "Hologram launched...\n");
  94. };
  95.