Created By: | Jared Balloutd> |
eMail: | jballou@mdqnet.net |
Difficulty Scale: | Super Easy |
In this tut, I'm gonna show ya how to make the EnergyBeamWeaponTron500 (yes, it's long, but if ya play Quake Mechs you'd know why) I made a whackass damage so that it would act like radius damage but do MUCH more damage by direct hit void(entity inflictor, entity attacker, float damage, entity ignore) T_PlasmaDamage = { local float points; local entity head; local vector org; head = findradius(inflictor.origin, damage); while (head) { if (head != ignore) { if (head.takedamage) { org = head.origin + (head.mins + head.maxs)*0.5; points = 0.5*vlen (inflictor.origin - org); if (points < 0) points = 0; points = damage - points; if (head == attacker) points = points * 0.5; if (points > 0) { if (CanDamage (head, inflictor)) { T_Damage (head, inflictor, attacker, points*10); } } } } head = head.chain; } }; Next, we need a touch function. void() energy_touch = { local float rand; if (other == self.owner) return; if (other.solid == SOLID_TRIGGER) return; // trigger field, do nothing if (pointcontents(self.origin) == CONTENT_SKY) { remove(self); return; } // hit something that bleeds T_PlasmaDamage (self, self.owner, 15, self.owner); remove(self); }; Here's the nift-spiffy particle tracer.... void() EnergyThink = { self.effects = self.effects | EF_BRIGHTLIGHT; particle (self.origin, '1 4 -7', 208, 2); particle (self.origin, '3 -5 2', 208, 2); particle (self.origin, '4 -1 4', 208, 2); particle (self.origin, '-7 -3 3', 208, 2); particle (self.origin, '2 -5 4', 208, 2); particle (self.origin, '6 7 1', 208, 2); particle (self.origin, '-3 8 -6', 208, 2); particle (self.origin, '8 -1 3', 208, 2); particle (self.origin, '1 4 -5', 208, 2); self.nextthink = time + 0.01; self.think=EnergyThink; }; void() W_FireEnergy = { local entity missile; self.currentammo = self.ammo_cells = self.ammo_cells - 0.01; sound (self, CHAN_WEAPON, "weapons/energy.wav", 1, ATTN_NORM); //This is from Quake Mechs, get the sound out of PAK or make yer own missile = spawn (); missile.owner = self; missile.movetype = MOVETYPE_FLYMISSILE; missile.solid = SOLID_BBOX; missile.classname = "energybeam"; // set missile speed makevectors (self.v_angle); missile.velocity = aim(self, 2000); missile.velocity = missile.velocity * 2000; missile.angles = vectoangles(missile.velocity); missile.touch = energy_touch; //Particles missile.nextthink = time + 0.01; missile.think = EnergyThink; setorigin (missile, self.origin + v_forward*8 + v_right*25 +'0 0 18'); //This makes it shoot out from player's right shoulder, we made the view higher. Adapt to your own liking }; And that's it! A neato energy weapon that will devestate anything that moves!
Tutorial html
coding by Achilles.