Originally posted by JDSTONER
View Post

void() spike_enemy_touch; //ooppee addon, need to make enemy projectiles (knight and scrag projectils use a copy of the id1 code WITHOUT the stuck in walls code) /* =============== start OoPpEe Launch enemy spike! Needs to be different so it DOESNT call "spike_touch" which results in stuck in walls =============== */ void(vector org, vector dir) launch_enemy_spike = { newmis = spawn (); newmis.owner = self; newmis.movetype = MOVETYPE_FLYMISSILE; newmis.solid = SOLID_BBOX; newmis.angles = vectoangles(dir); newmis.touch = spike_enemy_touch; //OoPpEe no more calling the in wall code now :D 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; }; //end ooppee /* =============== 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; }; void() W_FireSuperSpikes = { local vector dir; local entity old; sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM); self.attack_finished = time + 0.2; self.currentammo = self.ammo_nails = self.ammo_nails - 2; dir = aim (self, 1000); launch_spike (self.origin + self.view_ofs + v_up * -8 , dir); newmis.touch = superspike_touch; setmodel (newmis, "progs/s_spike.mdl"); setsize (newmis, VEC_ORIGIN, VEC_ORIGIN); self.punchangle_x = -2; }; void(float ox) W_FireSpikes = { local vector dir; local entity old; makevectors (self.v_angle); if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN) { W_FireSuperSpikes (); return; } if (self.ammo_nails < 1) { self.weapon = W_BestWeapon (); W_SetCurrentAmmo (); return; } sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM); self.attack_finished = time + 0.2; self.currentammo = self.ammo_nails = self.ammo_nails - 1; dir = aim (self, 1000); launch_spike (self.origin + self.view_ofs + v_up * -8 + v_right*ox, dir); self.punchangle_x = -2; }; .float hit_z; void() spike_stuck_think = { if (self.aflag <= time) { remove (self); return; } setorigin(self, self.pos1 + self.owner.origin - self.pos2); self.nextthink = time; }; //OoPpEe - now to copy over the old id1 code that DOESNT stick in walls. A simple copy and paste void() spike_enemy_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) { spawn_touchblood (9); T_Damage (other, self, self.owner, 9); } else { WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); if (self.classname == "wizspike") WriteByte (MSG_BROADCAST, TE_WIZSPIKE); else if (self.classname == "knightspike") WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE); else WriteByte (MSG_BROADCAST, TE_SPIKE); WriteCoord (MSG_BROADCAST, self.origin_x); WriteCoord (MSG_BROADCAST, self.origin_y); WriteCoord (MSG_BROADCAST, self.origin_z); } remove(self); }; //OoPpEe end void() spike_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) { spawn_touchblood (9); T_Damage (other, self, self.owner, 9); remove(self); //add this so they don't float... return; //add this to avoid errors } else if (other.solid != SOLID_BSP) { remove(self); return; } WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); if (self.classname == "wizspike") WriteByte (MSG_BROADCAST, TE_WIZSPIKE); else if (self.classname == "knightspike") WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE); else WriteByte (MSG_BROADCAST, TE_SPIKE); WriteCoord (MSG_BROADCAST, self.origin_x); WriteCoord (MSG_BROADCAST, self.origin_y); WriteCoord (MSG_BROADCAST, self.origin_z); self.solid = SOLID_NOT; self.movetype = MOVETYPE_NONE; setorigin (self, self.origin - normalize(self.velocity) * 3); self.velocity = '0 0 0'; //add this, it makes the nail stop if (other.solid == SOLID_BSP && other != world) { self.owner = other; self.pos1 = self.origin; self.pos2 = other.origin; self.aflag = time + 10; self.think = spike_stuck_think; self.nextthink = time; } else { self.nextthink = time + 20; //add this, to prevent packet overflows self.think = SUB_Remove; //add this for same reason as above } }; void() superspike_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) { spawn_touchblood (18); T_Damage (other, self, self.owner, 18); remove(self); //add this so they don't float... return; //add this to avoid errors } else if (other.solid != SOLID_BSP) { remove(self); return; } WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_SUPERSPIKE); WriteCoord (MSG_BROADCAST, self.origin_x); WriteCoord (MSG_BROADCAST, self.origin_y); WriteCoord (MSG_BROADCAST, self.origin_z); self.solid = SOLID_NOT; self.movetype = MOVETYPE_NONE; setorigin (self, self.origin - normalize(self.velocity) * 3); self.velocity = '0 0 0'; //add this, it makes the nail stop if (other.solid == SOLID_BSP && other != world) { self.owner = other; self.pos1 = self.origin; self.pos2 = other.origin; self.aflag = time + 10; self.think = spike_stuck_think; self.nextthink = time; } else { self.nextthink = time + 20; //add this, to prevent packet overflows self.think = SUB_Remove; //add this for same reason as above } };
launch_spike (org, vec); newmis.classname = "knightspike";
//launch_spike (org, vec); //ooppee well we know the drill.... launch_enemy_spike (org, vec); //ooppee volia!
launch_spike (self.origin, vec);
//launch_spike (self.origin, vec); //ooppee - GASP!!! again? launch_enemy_spike (self.origin, vec); //ooppee and again fixed :D
launch_spike (org, vec);
//launch_spike (org, vec); //ooppee - yes even Chthon's lavaball sticks in walls. Let's make him use the launch_enemy_spike :) launch_enemy_spike (org, vec); //ooppee there we go :D
Comment