Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ==============================================================================
- BFG
- ==============================================================================
- */
- //BFG explosion sprites
- void() bfgexpl1 = [0, bfgexpl2] {};
- void() bfgexpl2 = [1, bfgexpl3] {};
- void() bfgexpl3 = [2, bfgexpl4] {};
- void() bfgexpl4 = [3, bfgexpl5] {};
- void() bfgexpl5 = [4, SUB_Remove] {};
- //BFG blast sprites
- void() bfgblast1 = [4, bfgblast2] {};
- void() bfgblast2 = [0, bfgblast3] {};
- void() bfgblast3 = [1, bfgblast4] {};
- void() bfgblast4 = [2, bfgblast5] {};
- void() bfgblast5 = [3, SUB_Remove] {};
- void() bfg_ball_think =
- {
- //continuous lightning bolt targetting nearby ennemies from BFG orb
- local vector org;
- //local float cells,damage=0;
- local entity head;
- local float damage;
- local entity lightcont;
- org = self.origin;
- head = findradius(self.origin, 250); // finds all entitys within 250 (2.5 meters?)
- while (head)
- {
- if (head.takedamage)
- {
- if(head != self.owner) // if the entity (head) is you (self.owner as stated in BFG_Shot), 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 = 20; //40 + random()*20
- T_Damage (head, lightcont, lightcont.owner, damage);
- }
- }
- head = head.chain; // cycle to next head (entity)
- }
- };
- //BFG orb sprites
- void() bfgshot1 = [0, bfgshot2] {self.nextthink = time + 0.05;bfg_ball_think();};
- void() bfgshot2 = [1, bfgshot1] {self.nextthink = time + 0.05;bfg_ball_think();};
- void(vector org) BFG_Blast =
- {
- local entity newent;
- newent = spawn(); //create new entity to become the blast
- newent.origin = org; //set location to the ending of the lightning
- newent.movetype = MOVETYPE_NONE;
- newent.velocity = '0 0 0';
- newent.touch = SUB_Null;
- setmodel (newent, "progs/bfgblst.spr"); //self
- newent.solid = SOLID_NOT;
- //bfgblast1();
- newent.nextthink = time + 0.01;
- newent.think = bfgblast1;
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
- WriteCoord (MSG_BROADCAST, org_x); //self.origin, org_
- WriteCoord (MSG_BROADCAST, org_y);
- WriteCoord (MSG_BROADCAST, org_z);
- WriteByte (MSG_BROADCAST, 246);
- WriteByte (MSG_BROADCAST, 1);
- sound (newent, CHAN_WEAPON, "weapons/bfgblast.wav", 1, ATTN_NORM);
- };
- void() BFG_Expl =
- {
- local vector org;
- local entity head;
- local float damage;
- local entity bfgexpl;
- self.movetype = MOVETYPE_NONE;
- self.velocity = '0 0 0';
- self.touch = SUB_Null;
- setmodel (self, "progs/bfgexpl.spr"); //self
- self.solid = SOLID_NOT;
- //bfgexpl1();
- self.nextthink = time + 0.01;
- self.think = bfgexpl1;
- //the bfg blast fires deadlier lightning bolts to nearby enemies, comes from BFG orb on impact
- org = self.origin;
- head = findradius(self.origin, 300);
- while (head)
- {
- if (head.takedamage)
- {
- if(head != self.owner) // if the entity (head) is you (self.owner as stated in BFG_Shot), 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);
- damage = 150;
- T_Damage (head, self, self.owner, damage);
- BFG_Blast(head.origin);
- }
- }
- head = head.chain; // cycle to next head (entity)
- }
- };
- void() BFG_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
- if (other.takedamage)
- {
- if (other.health < 265)
- {
- spawn_touchblood (32);
- T_Damage (other, self, self.owner, 300); //most monsters would gib on impact, so it will keep going. If the body's still in one piece when dying, the orb should explode as they're solid.
- }
- else
- {
- //spawn_touchblood (16);
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
- WriteByte (MSG_BROADCAST, 246);
- WriteByte (MSG_BROADCAST, 1);
- sound (self, CHAN_WEAPON, "weapons/bfgexp.wav", 1, ATTN_NORM);
- T_Damage (other, self, self.owner, 300);
- BFG_Expl();
- remove(self);
- }
- }
- else
- {
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
- WriteByte (MSG_BROADCAST, 246);
- WriteByte (MSG_BROADCAST, 1);
- sound (self, CHAN_WEAPON, "weapons/bfgexp.wav", 1, ATTN_NORM);
- BFG_Expl();
- remove(self);
- }
- };
- void(vector org, vector vec) BFGShot =
- {
- local vector vec;
- local entity bfgsphere;
- vec = normalize(vec);
- bfgsphere = spawn();
- bfgsphere.owner = self;
- bfgsphere.movetype = MOVETYPE_FLY;
- bfgsphere.solid = SOLID_BBOX;
- bfgsphere.effects = EF_DIMLIGHT;
- setmodel (bfgsphere, "progs/bfgshot.spr");
- setsize (bfgsphere, '0 0 0', '0 0 0');
- bfgsphere.think = bfgshot1;
- setorigin (bfgsphere, org);
- bfgsphere.velocity = vec * 800; //600
- bfgsphere.angles = vectoangles(bfgsphere.velocity);
- //bfgsphere.nextthink = time + 5;
- //bfgsphere.think = SUB_Remove;
- //bfgsphere.nextthink = time + 0.3; //how often lightning strikes
- //bfgsphere.think = bfg_ball_think; //keep repeating
- bfgsphere.nextthink = time + 0.1;
- bfgsphere.think = bfgshot1;
- //for nextthinks: the greater values ust be put at first
- bfgsphere.touch = BFG_Touch;
- };
- void() W_Bfg_Fire =
- {
- local vector org;
- self.effects = self.effects | EF_MUZZLEFLASH;
- makevectors (self.v_angle); //v_xxx refers to the player's facing direction
- org = self.origin + v_forward * 30 + '0 0 16'; //org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
- sound (self, CHAN_WEAPON, "weapons/bfgfire1.wav", 1, ATTN_NORM);
- BFGShot(org, v_forward);
- self.currentammo = self.ammo_cells = self.ammo_cells - 30;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement