home *** CD-ROM | disk | FTP | other *** search
- /*
-
- ==============================================================================
-
- HOLOGRAPHIC SELF
-
- ==============================================================================
-
- Procedure for integrating this rc file with the others
- 1. Put this file in the same directory with the other .qc files
- 2. In Progs.src add a new line "holo.qc" right before the line "weapons.qc"
- 3. In weapons.qc, add "CheckHoloCommand ();" as the first line in the function
- ImpulseCommands
- 4. Recompile
- 5. Bind key to Impulse 99
-
- */
-
-
- float ACTIVATE_HOLO = 99; // impulse constant
- float IT_HOLO = 8388608; // holo bit mask flag
- float IT_HOLO_neg = 8388607; // negative holo bit mask flag
-
-
- //--------------------------------------------------------------------
- // When time expires holograph gets deactivated
- //--------------------------------------------------------------------
- void() RemoveHolo =
- {
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_TELEPORT);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
- sound (self, CHAN_BODY, "misc/r_tele1.wav", 1, ATTN_NORM);
- SUB_Remove();
- self.owner.items = self.owner.items & IT_HOLO_neg;
- sprint(self.owner,"holograph expired\n");
- };
-
-
-
- //--------------------------------------------------------------------
- // Spawns holograph self
- //--------------------------------------------------------------------
- void(entity myself) ActivateHolo =
- {
- local entity newholo;
-
- newholo = spawn();
- newholo.solid = SOLID_NOT;
- newholo.movetype = MOVETYPE_NOCLIP;
- newholo.origin = myself.origin;
- newholo.angles = myself.angles;
- newholo.colormap = myself.colormap;
- setmodel (newholo, "progs/player.mdl");
- newholo.classname = "holo";
- newholo.owner=myself;
- newholo.frame=13;
- newholo.nextthink = time + 10;
- newholo.think = RemoveHolo;
- myself.currentammo = myself.ammo_cells = myself.ammo_cells - 10;
- myself.items = myself.items | IT_HOLO;
- stuffcmd (newholo.owner, "bf\n");
- sprint(newholo.owner,"holograph activated\n");
- };
-
-
-
- //--------------------------------------------------------------------
- // Checks if holograph should be activated
- //--------------------------------------------------------------------
- void() CheckHoloCommand =
- {
- if (self.impulse != ACTIVATE_HOLO )
- return;
-
- if ((self.items & IT_HOLO) == IT_HOLO)
- {
- sprint(self,"holograph active\n");
- return;
- }
-
- if (self.ammo_cells < 10)
- {
- sprint(self,"cells are low\n");
- return;
- }
-
- ActivateHolo (self);
- };