Thunder Grenades
Created By: | Dr DooMer |
eMail: | drdoomer@cross-bones.co.uk |
Difficulty Scale: | Easy |
missile.nextthink = time + 0.1;And change it's "missile.think" line into:
missile.think = GrenadeZap;Now, all we have done here is to tell the grenade that it should next think in 0.1 seconds time, and when it does think, to call the function GrenadeZap.
void() GrenadeZap = { local vector org; self.count = self.count + 1; // This bit is here to count if (self.count > 40) // how long the grenade { // has been lingering. GrenadeExplode(); // After forty 1/10 second return; // counts, the grenade } // just goes boom normally sound (self.owner, CHAN_VOICE, "weapons/lhit.wav", 1, ATTN_NORM); self.nextthink = time + 0.1; self.think = GrenadeZap; // Repeat the function org = self.origin + '0 0 3'; traceline (org, self.owner.origin + '0 0 10', TRUE, self); WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_LIGHTNING2); WriteEntity (MSG_BROADCAST, self); WriteCoord (MSG_BROADCAST, org_x); WriteCoord (MSG_BROADCAST, org_y); WriteCoord (MSG_BROADCAST, org_z); WriteCoord (MSG_BROADCAST, trace_endpos_x); WriteCoord (MSG_BROADCAST, trace_endpos_y); WriteCoord (MSG_BROADCAST, trace_endpos_z); // Now, all this complicated bit of code does is draw // a beam of lightning from one place to another LightningDamage (org, trace_endpos + v_forward*5, self.owner, 15); // This is standard lightning gun code, and 15 the the amount of damage done. };Well, that's it! If you've done all that right, compile, run, and have fun! Try shooting grenades over a monster, and if you feel especially nasty, up the damage!