Inside3D tutorials.
Created By: | SHaDoW.STaLKeR (Evan) |
eMail: | evan@patriot.net |
Difficulty Scale: | Easy |
if (self.impulse == 40) //If IMPULSE 40 is typed at console { if (holoOn == 0) //If the float holoOn is equal to 0 { holo (); //Call the function holo to create a hologram holoOn = 1; //Set holoOn to 1 to indicate the hologram is activated } else //If holoOn is not equal to 0 sprint (self,"Hologram Already Activated...\n"); //Print an error message } if (self.impulse == 41) //If IMPULSE 41 { if (holoOn == 1) //If the holoOn is set to 1 { DetHolo (); //Call the DetHolo function to detonate a hologram holoOn = 0; //Sets holoOn to 0 to indicate there is no longer a hologram active } else //If holoOn is not set to 1 sprint (self,"No Hologram Activated...\n"); //Print an error message }
float holoOn = 0; //This float will act as an indicator 0 means //that the hologram is off, 1 meaning it is on
void () holo = { local entity hologram; //Declares an entity called hologram hologram = spawn (); //Spawns the entity with the following settings hologram.origin = self.origin; //Spawns it at the player's current position hologram.velocity = aim (self, 1000); //Gives the object a velocity hologram.velocity = (hologram.velocity * 550); //Makes velocity slow so it moves slightly hologram.solid = SOLID_BBOX; //Makes the hologram solid to object other than yourself hologram.movetype = MOVETYPE_TOSS; //Tosses the hologram setmodel (hologram,"progs/player.mdl"); //Set it to look like the player hologram.frame = 13; //Frame 13 is the player stand position setsize (hologram,VEC_HULL_MIN,'16 16 40'); //Sets size of hologram hologram.owner = self; //Marks it as yours hologram.classname = "hologram"; //Give the object the classname "hologram" hologram.think = GrenadeExplode; //called when the command to nextthink is given sprint (self,"Hologram Activated...\n"); //Print to screen that the Hologram is Activated };
void() DetHolo = { local entity holo; //Declares the entity holo holo = findradius (self.origin, 10000); //Finds everything within a 10000 radius while(holo) //Loops through everything put in the missile entity { if((holo.classname == "hologram") && (holo.owner == self)) //Checks holo owner holo.nextthink = time; //sends the message that it is time to react holo = holo.chain; //links every hologram found so they all go BOOM! } };