Inside3D tutorials.
Created By: | DarkSide (and me.. a little) |
eMail: | darkside@inficad.com |
Difficulty Scale: | Easy |
void() W_FireLightning = { local vector org; local float cells,damage=0; local entity head; self.punchangle_x = -2; self.currentammo = self.ammo_cells = self.ammo_cells - 1; org = self.origin + '0 0 16'; if (self.ammo_cells < 1) // Change to other weapon if not enough cells { self.weapon = W_BestWeapon (); W_SetCurrentAmmo (); return; } if (self.waterlevel > 1) // explode in water { cells = self.ammo_cells; self.ammo_cells = 0; W_SetCurrentAmmo (); T_RadiusDamage (self, self, 35*cells, world); return; } head = findradius(self.origin, 250); // finds all entitys within 250 (2.5 meters?) while (head) { if (head.takedamage) { if(head != self) // if the entity (head) is you (self), skip { WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_LIGHTNING2); WriteEntity (MSG_BROADCAST, head); // Start position for lightning WriteCoord (MSG_BROADCAST, org_x); // Your position WriteCoord (MSG_BROADCAST, org_y); WriteCoord (MSG_BROADCAST, org_z); WriteCoord (MSG_BROADCAST, head.origin_x); // entity's position WriteCoord (MSG_BROADCAST, head.origin_y); WriteCoord (MSG_BROADCAST, head.origin_z); sound (head, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM); damage = 40 + random()*20; T_Damage (head, self, self.owner, damage); } } head = head.chain; // cycle to next head (entity) } };