Rune Central
http://runequake.com/forums/

Teleporting Holograms
http://runequake.com/forums/viewtopic.php?f=2&t=1002
Page 1 of 1

Author:  IEEE 802.11 [ Sun Dec 04, 2005 9:27 pm ]
Post subject:  Teleporting Holograms

Just an alternative to normal/exploding holograms. Think of it like Dual Recall with 5 different places to teleport between.

This modification lets you swap places one at a time with each of your placed Holograms. They now all face the same direction you're looking in to make it hard to tell when you've switched. They also will have the same special effects your player has (like when shooting).

This code does not support telefragging, but it's easy to add. (I forgot to add it, but I'm tired now).

runes20.qc
Code:
void ()
Holo_Think =
{
   //IEEE ADD
   if (self.owner.runevector_x == self.runevector_x  && self.owner.runevector_y == 1)
      {
      local vector lastspot;
      lastspot = self.owner.origin;//Get the player's last location
      setorigin (self.owner, self.origin);//Move the player to the hologram
      setorigin (self, lastspot);//Move the hologram to where the player was
      self.owner.runevector_y = 0;//Reset the owner's teleport trigger
      self.runetime = time + 30;//Reset the time as if you spawned another one.
      }

   if (self.runetime < time)
   {
      if (maybe_update_trap_count (self.owner, RN_HOLO))
         sprint (self.owner, "A hologram burned out\n");

      spawn_tfog (self.origin);
      //IEEE ADD Subtract to get the correct number of holograms
      self.owner.runevector_x = self.owner.runevector_x - 1;

      remove (self);
      return;
   }

   //IEEE ADD Give the hologram the same effects to make them harder to tell which are fake
   //(Also used in Beatdown Alley)
   if (self.effects != self.owner.effects)
      self.effects = self.owner.effects;

   self.angles = self.owner.angles;
   //IEEE REMOVE This code is no longer needed
   //self.angles_y = self.angles_y + self.runevar;
   self.frame = self.owner.frame;
   self.nextthink = time + sys_ticrate;
};

void (float riders, entity of_e)
Rune_Holo_sprint =
{
   rprint_numdesc (self, riders, of_e.runevar, "hologram");
   rprint (self, riders, " active\n");
};

void ()
Rune_Holo =
{
   local entity hologram;

   //IEEE ADD Used for numbering the Holograms and for cycling through them when teleporting
   self.runevector_x = self.runevector_x + 1;

   if (self.runevar >= MAX_HOLO)
   {
      //IEEE ADD
      self.runevector_y = 1;//Used as a trigger in Holo_Think
      if (self.runevector_x >= MAX_HOLO)
         self.runevector_x = 1;//Reset to start teleporting at the start
      
      //IEEE REMOVE Not needed now
      //centerprint (self, "Too many fakes!");
      return;
   }


   self.runevar = self.runevar + 1;


   hologram = spawn ();

   //IEEE ADD
   hologram.runevector = self.runevector;//Number the holograms starting with 1

   hologram.movetype = MOVETYPE_NONE;
   hologram.solid = SOLID_NOT;
   hologram.owner = self;
   hologram.classname = "hologram";
   setmodel (hologram, "progs/player.mdl");
   setorigin (hologram, self.origin);
   setsize (hologram, VEC_ORIGIN, VEC_ORIGIN);
   hologram.angles = self.angles;
   hologram.colormap = self.colormap;
   hologram.think = Holo_Think;
   hologram.nextthink = time;
   sound (hologram, CHAN_BODY, "misc/basekey.wav", 1, ATTN_NORM);
   hologram.runetime = time + 30;

   //IEEE REMOVE To simplify flawless direction/angle switching
   //hologram.runevar = crandom ()*360;

};


Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/