Inside3D tutorials.
Created By: | Drywall |
eMail: | drywall@telefragged.com |
Difficulty Scale: | Easy |
/* =============== launch_spike Used for both the player and the ogre =============== */ void(vector org, vector dir) launch_spike = { newmis = spawn (); newmis.owner = self; newmis.movetype = MOVETYPE_FLYMISSILE; newmis.solid = SOLID_BBOX; newmis.angles = vectoangles(dir); newmis.touch = spike_touchl; newmis.classname = "spike"; newmis.think = SUB_Remove; newmis.nextthink = time + 6; setmodel (newmis, "progs/spike.mdl"); setsize (newmis, VEC_ORIGIN, VEC_ORIGIN); setorigin (newmis, org); newmis.velocity = dir * 1000; newmis.effects = newmis.effects | EF_BRIGHTFIELD // Spikes will now // have a glowing field around it };Now you may be wondering what you just did. Well, I won't tell you. Hehe just kidding. What you just did was add a 'brightfield' effect to the spike. The EF_BRIGHTFIELD effect puts a bunch of yellow spots around the object. No, I don't believe the color can be changed. The 'brightfield's are useful for creating weapons that are supposed to have a poisonous or hallucinogenic effect. And yes, I can't spell :) If you like this effect, compile and run. If not, scrap it and go on to Step 3.
/* ================ W_FireRocket ================ */ void() W_FireRocket = { local entity missile, mpuff; self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM); self.punchangle_x = -2; missile = spawn (); missile.owner = self; missile.movetype = MOVETYPE_FLYMISSILE; missile.solid = SOLID_BBOX; missile.classname = "missile"; // set missile speed makevectors (self.v_angle); missile.velocity = aim(self, 1000); missile.velocity = missile.velocity * 1000; missile.angles = vectoangles(missile.velocity); missile.touch = T_MissileTouch; // set missile duration missile.nextthink = time + 5; missile.think = SUB_Remove; missile.effects = missile.effects | EF_BRIGHTLIGHT // Makes the rocket shiny (or use EF_DIMLIGHT) setmodel (missile, "progs/missile.mdl"); setsize (missile, '0 0 0', '0 0 0'); setorigin (missile, self.origin + v_forward*8 + '0 0 16'); };Alright, what did you do? Well, this is another simple lighting effect, that causes, obvioulsy, a bright light. This is great for flares, but that's honestly just about it. If you like nice shiny rockets, save & comiple. Otherwise, um I dunno, if you don't like this, why did you bother programming it ? :)
/* =============== launch_spike Used for both the player and the ogre =============== */ void(vector org, vector dir) launch_spike = { newmis = spawn (); newmis.owner = self; newmis.movetype = MOVETYPE_FLYMISSILE; newmis.solid = SOLID_BBOX; newmis.angles = vectoangles(dir); newmis.touch = spike_touch; newmis.classname = "spike"; newmis.think = SUB_Remove; newmis.nextthink = time + 6; setmodel (newmis, "progs/spike.mdl"); setsize (newmis, VEC_ORIGIN, VEC_ORIGIN); setorigin (newmis, org); newmis.velocity = dir * 1000; newmis.effects = newmis.effects | EF_BRIGHTFIELD | EF_MUZZLEFLASH // Spikes will now have //a glowing field around it, and briefly make a light in the room. };Alright, here's what you just did. The " | "s mean 'and', and so you said 'make the effects what they were, plus the bright lights, plus the muzzle flash. Now the nailgun will light up when shooting nails, and the nails will be all funky lookin :)