/* ============================================================================== ZOMBIE ============================================================================== */ $cd UGmodels/zombie $origin 0 0 24 $base base $skin skin $frame zombiec $frame zombie2c float SPAWN_CRUCIFIED = 1; //============================================================================= .float inpain; void() zombie_stand1 =[ $zombiec, zombie_stand2 ] {ai_stand();}; void() zombie_stand2 =[ $zombiec, zombie_stand3 ] {ai_stand();}; void() zombie_stand3 =[ $zombiec, zombie_stand4 ] {ai_stand();}; void() zombie_stand4 =[ $zombiec, zombie_stand5 ] {ai_stand();}; void() zombie_stand5 =[ $zombiec, zombie_stand6 ] {ai_stand();}; void() zombie_stand6 =[ $zombiec, zombie_stand7 ] {ai_stand();}; void() zombie_stand7 =[ $zombiec, zombie_stand8 ] {ai_stand();}; void() zombie_stand8 =[ $zombiec, zombie_stand9 ] {ai_stand();}; void() zombie_stand9 =[ $zombiec, zombie_stand10 ] {ai_stand();}; void() zombie_stand10 =[ $zombiec, zombie_stand11 ] {ai_stand();}; void() zombie_stand11 =[ $zombiec, zombie_stand12 ] {ai_stand();}; void() zombie_stand12 =[ $zombiec, zombie_stand13 ] {ai_stand();}; void() zombie_stand13 =[ $zombiec, zombie_stand14 ] {ai_stand();}; void() zombie_stand14 =[ $zombiec, zombie_stand15 ] {ai_stand();}; void() zombie_stand15 =[ $zombiec, zombie_stand1 ] {ai_stand();}; void() zombie_cruc1 = [ $zombie2c, zombie_cruc2 ] { if (random() < 0.1) sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);}; void() zombie_cruc2 = [ $zombie2c, zombie_cruc3 ] {self.nextthink = time + 0.1 + random()*0.1;}; void() zombie_cruc3 = [ $zombie2c, zombie_cruc4 ] {self.nextthink = time + 0.1 + random()*0.1;}; void() zombie_cruc4 = [ $zombie2c, zombie_cruc5 ] {self.nextthink = time + 0.1 + random()*0.1;}; void() zombie_cruc5 = [ $zombie2c, zombie_cruc6 ] {self.nextthink = time + 0.1 + random()*0.1;}; void() zombie_cruc6 = [ $zombie2c, zombie_cruc1 ] {self.nextthink = time + 0.1 + random()*0.1;}; void() zombie_walk1 =[ $zombiec, zombie_walk2 ] {ai_walk(0);}; void() zombie_walk2 =[ $zombiec, zombie_walk3 ] {ai_walk(2);}; void() zombie_walk3 =[ $zombiec, zombie_walk4 ] {ai_walk(3);}; void() zombie_walk4 =[ $zombiec, zombie_walk5 ] {ai_walk(2);}; void() zombie_walk5 =[ $zombiec, zombie_walk6 ] {ai_walk(1);}; void() zombie_walk6 =[ $zombiec, zombie_walk7 ] {ai_walk(0);}; void() zombie_walk7 =[ $zombiec, zombie_walk8 ] {ai_walk(0);}; void() zombie_walk8 =[ $zombiec, zombie_walk9 ] {ai_walk(0);}; void() zombie_walk9 =[ $zombiec, zombie_walk10 ] {ai_walk(0);}; void() zombie_walk10 =[ $zombiec, zombie_walk11 ] {ai_walk(0);}; void() zombie_walk11 =[ $zombiec, zombie_walk12 ] {ai_walk(2);}; void() zombie_walk12 =[ $zombiec, zombie_walk13 ] {ai_walk(2);}; void() zombie_walk13 =[ $zombiec, zombie_walk14 ] {ai_walk(1);}; void() zombie_walk14 =[ $zombiec, zombie_walk15 ] {ai_walk(0);}; void() zombie_walk15 =[ $zombiec, zombie_walk16 ] {ai_walk(0);}; void() zombie_walk16 =[ $zombiec, zombie_walk17 ] {ai_walk(0);}; void() zombie_walk17 =[ $zombiec, zombie_walk18 ] {ai_walk(0);}; void() zombie_walk18 =[ $zombiec, zombie_walk19 ] {ai_walk(0);}; void() zombie_walk19 =[ $zombiec, zombie_walk1 ] { ai_walk(0); if (random() < 0.2) sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);}; void() zombie_run1 =[ $zombiec, zombie_run2 ] {ai_run(1);self.inpain = 0;}; void() zombie_run2 =[ $zombiec, zombie_run3 ] {ai_run(1);}; void() zombie_run3 =[ $zombiec, zombie_run4 ] {ai_run(0);}; void() zombie_run4 =[ $zombiec, zombie_run5 ] {ai_run(1);}; void() zombie_run5 =[ $zombiec, zombie_run6 ] {ai_run(2);}; void() zombie_run6 =[ $zombiec, zombie_run7 ] {ai_run(3);}; void() zombie_run7 =[ $zombiec, zombie_run8 ] {ai_run(4);}; void() zombie_run8 =[ $zombiec, zombie_run9 ] {ai_run(4);}; void() zombie_run9 =[ $zombiec, zombie_run10 ] {ai_run(2);}; void() zombie_run10 =[ $zombiec, zombie_run11 ] {ai_run(0);}; void() zombie_run11 =[ $zombiec, zombie_run12 ] {ai_run(0);}; void() zombie_run12 =[ $zombiec, zombie_run13 ] {ai_run(0);}; void() zombie_run13 =[ $zombiec, zombie_run14 ] {ai_run(2);}; void() zombie_run14 =[ $zombiec, zombie_run15 ] {ai_run(4);}; void() zombie_run15 =[ $zombiec, zombie_run16 ] {ai_run(6);}; void() zombie_run16 =[ $zombiec, zombie_run17 ] {ai_run(7);}; void() zombie_run17 =[ $zombiec, zombie_run18 ] {ai_run(3);}; void() zombie_run18 =[ $zombiec, zombie_run1 ] { ai_run(8); if (random() < 0.2) sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE); if (random() > 0.8) sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE); }; /* ============================================================================= ATTACKS ============================================================================= */ void() ZombieGrenadeTouch = { if (other == self.owner) return; // don't explode on owner if (other.takedamage) { T_Damage (other, self, self.owner, 10 ); sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM); remove (self); return; } sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound self.velocity = '0 0 0'; self.avelocity = '0 0 0'; self.touch = SUB_Remove; }; /* ================ ZombieFireGrenade ================ */ void(vector st) ZombieFireGrenade = { local entity missile, mpuff; local vector org; sound (self, CHAN_WEAPON, "zombie/z_shot1.wav", 1, ATTN_NORM); missile = spawn (); missile.owner = self; missile.movetype = MOVETYPE_BOUNCE; missile.solid = SOLID_BBOX; // calc org org = self.origin + st_x * v_forward + st_y * v_right + (st_z - 24) * v_up; // set missile speed makevectors (self.angles); missile.velocity = normalize(self.enemy.origin - org); missile.velocity = missile.velocity * 600; missile.velocity_z = 200; missile.avelocity = '3000 1000 2000'; missile.touch = ZombieGrenadeTouch; // set missile duration missile.nextthink = time + 2.5; missile.think = SUB_Remove; // setmodel (missile, "progs/zom_gib.mdl"); setsize (missile, '0 0 0', '0 0 0'); setorigin (missile, org); }; void() zombie_atta1 =[ $zombiec, zombie_atta2 ] {ai_face();}; void() zombie_atta2 =[ $zombiec, zombie_atta3 ] {ai_face();}; void() zombie_atta3 =[ $zombiec, zombie_atta4 ] {ai_face();}; void() zombie_atta4 =[ $zombiec, zombie_atta5 ] {ai_face();}; void() zombie_atta5 =[ $zombiec, zombie_atta6 ] {ai_face();}; void() zombie_atta6 =[ $zombiec, zombie_atta7 ] {ai_face();}; void() zombie_atta7 =[ $zombiec, zombie_atta8 ] {ai_face();}; void() zombie_atta8 =[ $zombiec, zombie_atta9 ] {ai_face();}; void() zombie_atta9 =[ $zombiec, zombie_atta10 ] {ai_face();}; void() zombie_atta10 =[ $zombiec, zombie_atta11 ] {ai_face();}; void() zombie_atta11 =[ $zombiec, zombie_atta12 ] {ai_face();}; void() zombie_atta12 =[ $zombiec, zombie_atta13 ] {ai_face();}; void() zombie_atta13 =[ $zombiec, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -22 30');}; void() zombie_attb1 =[ $zombiec, zombie_attb2 ] {ai_face();}; void() zombie_attb2 =[ $zombiec, zombie_attb3 ] {ai_face();}; void() zombie_attb3 =[ $zombiec, zombie_attb4 ] {ai_face();}; void() zombie_attb4 =[ $zombiec, zombie_attb5 ] {ai_face();}; void() zombie_attb5 =[ $zombiec, zombie_attb6 ] {ai_face();}; void() zombie_attb6 =[ $zombiec, zombie_attb7 ] {ai_face();}; void() zombie_attb7 =[ $zombiec, zombie_attb8 ] {ai_face();}; void() zombie_attb8 =[ $zombiec, zombie_attb9 ] {ai_face();}; void() zombie_attb9 =[ $zombiec, zombie_attb10 ] {ai_face();}; void() zombie_attb10 =[ $zombiec, zombie_attb11 ] {ai_face();}; void() zombie_attb11 =[ $zombiec, zombie_attb12 ] {ai_face();}; void() zombie_attb12 =[ $zombiec, zombie_attb13 ] {ai_face();}; void() zombie_attb13 =[ $zombiec, zombie_attb14 ] {ai_face();}; void() zombie_attb14 =[ $zombiec, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -24 29');}; void() zombie_attc1 =[ $zombiec, zombie_attc2 ] {ai_face();}; void() zombie_attc2 =[ $zombiec, zombie_attc3 ] {ai_face();}; void() zombie_attc3 =[ $zombiec, zombie_attc4 ] {ai_face();}; void() zombie_attc4 =[ $zombiec, zombie_attc5 ] {ai_face();}; void() zombie_attc5 =[ $zombiec, zombie_attc6 ] {ai_face();}; void() zombie_attc6 =[ $zombiec, zombie_attc7 ] {ai_face();}; void() zombie_attc7 =[ $zombiec, zombie_attc8 ] {ai_face();}; void() zombie_attc8 =[ $zombiec, zombie_attc9 ] {ai_face();}; void() zombie_attc9 =[ $zombiec, zombie_attc10 ] {ai_face();}; void() zombie_attc10 =[ $zombiec, zombie_attc11 ] {ai_face();}; void() zombie_attc11 =[ $zombiec, zombie_attc12 ] {ai_face();}; void() zombie_attc12 =[ $zombiec, zombie_run1 ] {ai_face();ZombieFireGrenade('-12 -19 29');}; void() zombie_missile = { local float r; r = random(); if (r < 0.3) zombie_atta1 (); else if (r < 0.6) zombie_attb1 (); else zombie_attc1 (); }; /* ============================================================================= PAIN ============================================================================= */ void() zombie_paina1 =[ $zombiec, zombie_paina2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);}; void() zombie_paina2 =[ $zombiec, zombie_paina3 ] {ai_painforward(3);}; void() zombie_paina3 =[ $zombiec, zombie_paina4 ] {ai_painforward(1);}; void() zombie_paina4 =[ $zombiec, zombie_paina5 ] {ai_pain(1);}; void() zombie_paina5 =[ $zombiec, zombie_paina6 ] {ai_pain(3);}; void() zombie_paina6 =[ $zombiec, zombie_paina7 ] {ai_pain(1);}; void() zombie_paina7 =[ $zombiec, zombie_paina8 ] {}; void() zombie_paina8 =[ $zombiec, zombie_paina9 ] {}; void() zombie_paina9 =[ $zombiec, zombie_paina10 ] {}; void() zombie_paina10 =[ $zombiec, zombie_paina11 ] {}; void() zombie_paina11 =[ $zombiec, zombie_paina12 ] {}; void() zombie_paina12 =[ $zombiec, zombie_run1 ] {}; void() zombie_painb1 =[ $zombiec, zombie_painb2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);}; void() zombie_painb2 =[ $zombiec, zombie_painb3 ] {ai_pain(2);}; void() zombie_painb3 =[ $zombiec, zombie_painb4 ] {ai_pain(8);}; void() zombie_painb4 =[ $zombiec, zombie_painb5 ] {ai_pain(6);}; void() zombie_painb5 =[ $zombiec, zombie_painb6 ] {ai_pain(2);}; void() zombie_painb6 =[ $zombiec, zombie_painb7 ] {}; void() zombie_painb7 =[ $zombiec, zombie_painb8 ] {}; void() zombie_painb8 =[ $zombiec, zombie_painb9 ] {}; void() zombie_painb9 =[ $zombiec, zombie_painb10 ] {sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);}; void() zombie_painb10 =[ $zombiec, zombie_painb11 ] {}; void() zombie_painb11 =[ $zombiec, zombie_painb12 ] {}; void() zombie_painb12 =[ $zombiec, zombie_painb13 ] {}; void() zombie_painb13 =[ $zombiec, zombie_painb14 ] {}; void() zombie_painb14 =[ $zombiec, zombie_painb15 ] {}; void() zombie_painb15 =[ $zombiec, zombie_painb16 ] {}; void() zombie_painb16 =[ $zombiec, zombie_painb17 ] {}; void() zombie_painb17 =[ $zombiec, zombie_painb18 ] {}; void() zombie_painb18 =[ $zombiec, zombie_painb19 ] {}; void() zombie_painb19 =[ $zombiec, zombie_painb20 ] {}; void() zombie_painb20 =[ $zombiec, zombie_painb21 ] {}; void() zombie_painb21 =[ $zombiec, zombie_painb22 ] {}; void() zombie_painb22 =[ $zombiec, zombie_painb23 ] {}; void() zombie_painb23 =[ $zombiec, zombie_painb24 ] {}; void() zombie_painb24 =[ $zombiec, zombie_painb25 ] {}; void() zombie_painb25 =[ $zombiec, zombie_painb26 ] {ai_painforward(1);}; void() zombie_painb26 =[ $zombiec, zombie_painb27 ] {}; void() zombie_painb27 =[ $zombiec, zombie_painb28 ] {}; void() zombie_painb28 =[ $zombiec, zombie_run1 ] {}; void() zombie_painc1 =[ $zombiec, zombie_painc2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);}; void() zombie_painc2 =[ $zombiec, zombie_painc3 ] {}; void() zombie_painc3 =[ $zombiec, zombie_painc4 ] {ai_pain(3);}; void() zombie_painc4 =[ $zombiec, zombie_painc5 ] {ai_pain(1);}; void() zombie_painc5 =[ $zombiec, zombie_painc6 ] {}; void() zombie_painc6 =[ $zombiec, zombie_painc7 ] {}; void() zombie_painc7 =[ $zombiec, zombie_painc8 ] {}; void() zombie_painc8 =[ $zombiec, zombie_painc9 ] {}; void() zombie_painc9 =[ $zombiec, zombie_painc10 ] {}; void() zombie_painc10 =[ $zombiec, zombie_painc11 ] {}; void() zombie_painc11 =[ $zombiec, zombie_painc12 ] {ai_painforward(1);}; void() zombie_painc12 =[ $zombiec, zombie_painc13 ] {ai_painforward(1);}; void() zombie_painc13 =[ $zombiec, zombie_painc14 ] {}; void() zombie_painc14 =[ $zombiec, zombie_painc15 ] {}; void() zombie_painc15 =[ $zombiec, zombie_painc16 ] {}; void() zombie_painc16 =[ $zombiec, zombie_painc17 ] {}; void() zombie_painc17 =[ $zombiec, zombie_painc18 ] {}; void() zombie_painc18 =[ $zombiec, zombie_run1 ] {}; void() zombie_paind1 =[ $zombiec, zombie_paind2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);}; void() zombie_paind2 =[ $zombiec, zombie_paind3 ] {}; void() zombie_paind3 =[ $zombiec, zombie_paind4 ] {}; void() zombie_paind4 =[ $zombiec, zombie_paind5 ] {}; void() zombie_paind5 =[ $zombiec, zombie_paind6 ] {}; void() zombie_paind6 =[ $zombiec, zombie_paind7 ] {}; void() zombie_paind7 =[ $zombiec, zombie_paind8 ] {}; void() zombie_paind8 =[ $zombiec, zombie_paind9 ] {}; void() zombie_paind9 =[ $zombiec, zombie_paind10 ] {ai_pain(1);}; void() zombie_paind10 =[ $zombiec, zombie_paind11 ] {}; void() zombie_paind11 =[ $zombiec, zombie_paind12 ] {}; void() zombie_paind12 =[ $zombiec, zombie_paind13 ] {}; void() zombie_paind13 =[ $zombiec, zombie_run1 ] {}; void() zombie_paine1 =[ $zombiec, zombie_paine2 ] { sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM); self.health = 60; }; void() zombie_paine2 =[ $zombiec, zombie_paine3 ] {ai_pain(8);}; void() zombie_paine3 =[ $zombiec, zombie_paine4 ] {ai_pain(5);}; void() zombie_paine4 =[ $zombiec, zombie_paine5 ] {ai_pain(3);}; void() zombie_paine5 =[ $zombiec, zombie_paine6 ] {ai_pain(1);}; void() zombie_paine6 =[ $zombiec, zombie_paine7 ] {ai_pain(2);}; void() zombie_paine7 =[ $zombiec, zombie_paine8 ] {ai_pain(1);}; void() zombie_paine8 =[ $zombiec, zombie_paine9 ] {ai_pain(1);}; void() zombie_paine9 =[ $zombiec, zombie_paine10 ] {ai_pain(2);}; void() zombie_paine10 =[ $zombiec, zombie_paine11 ] { sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM); self.solid = SOLID_NOT; }; void() zombie_paine11 =[ $zombiec, zombie_paine12 ] {self.nextthink = self.nextthink + 5;self.health = 60;}; void() zombie_paine12 =[ $zombiec, zombie_paine13 ]{ // see if ok to stand up self.health = 60; sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE); self.solid = SOLID_SLIDEBOX; if (!walkmove (0, 0)) { self.think = zombie_paine11; self.solid = SOLID_NOT; return; } }; void() zombie_paine13 =[ $zombiec, zombie_paine14 ] {}; void() zombie_paine14 =[ $zombiec, zombie_paine15 ] {}; void() zombie_paine15 =[ $zombiec, zombie_paine16 ] {}; void() zombie_paine16 =[ $zombiec, zombie_paine17 ] {}; void() zombie_paine17 =[ $zombiec, zombie_paine18 ] {}; void() zombie_paine18 =[ $zombiec, zombie_paine19 ] {}; void() zombie_paine19 =[ $zombiec, zombie_paine20 ] {}; void() zombie_paine20 =[ $zombiec, zombie_paine21 ] {}; void() zombie_paine21 =[ $zombiec, zombie_paine22 ] {}; void() zombie_paine22 =[ $zombiec, zombie_paine23 ] {}; void() zombie_paine23 =[ $zombiec, zombie_paine24 ] {}; void() zombie_paine24 =[ $zombiec, zombie_paine25 ] {}; void() zombie_paine25 =[ $zombiec, zombie_paine26 ] {ai_painforward(5);}; void() zombie_paine26 =[ $zombiec, zombie_paine27 ] {ai_painforward(3);}; void() zombie_paine27 =[ $zombiec, zombie_paine28 ] {ai_painforward(1);}; void() zombie_paine28 =[ $zombiec, zombie_paine29 ] {ai_pain(1);}; void() zombie_paine29 =[ $zombiec, zombie_paine30 ] {}; void() zombie_paine30 =[ $zombiec, zombie_run1 ] {}; void() zombie_die = { sound (self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM); ThrowHead ("progs/h_zombie.mdl", self.health); ThrowGib ("progs/gib1.mdl", self.health); ThrowGib ("progs/gib2.mdl", self.health); ThrowGib ("progs/gib3.mdl", self.health); }; /* ================= zombie_pain Zombies can only be killed (gibbed) by doing 60 hit points of damage in a single frame (rockets, grenades, quad shotgun, quad nailgun). A hit of 25 points or more (super shotgun, quad nailgun) will allways put it down to the ground. A hit of from 10 to 40 points in one frame will cause it to go down if it has been twice in two seconds, otherwise it goes into one of the four fast pain frames. A hit of less than 10 points of damage (winged by a shotgun) will be ignored. FIXME: don't use pain_finished because of nightmare hack ================= */ void(entity attacker, float take) zombie_pain = { local float r; self.health = 60; // allways reset health if (take < 9) return; // totally ignore if (self.inpain == 2) return; // down on ground, so don't reset any counters // go down immediately if a big enough hit if (take >= 25) { self.inpain = 2; zombie_paine1 (); return; } if (self.inpain) { // if hit again in next gre seconds while not in pain frames, definately drop self.pain_finished = time + 3; return; // currently going through an animation, don't change } if (self.pain_finished > time) { // hit again, so drop down self.inpain = 2; zombie_paine1 (); return; } // gp into one of the fast pain animations self.inpain = 1; r = random(); if (r < 0.25) zombie_paina1 (); else if (r < 0.5) zombie_painb1 (); else if (r < 0.75) zombie_painc1 (); else zombie_paind1 (); }; //============================================================================ /*UNTITLED-GAME/D monster_zombie (1 0 0) (-16 -16 -24) (16 16 32) Crucified ambush If crucified, stick the bounding box 12 pixels back into a wall to look right. */ void() monster_zombie = { if (deathmatch) { remove(self); return; } precache_model ("progs/zombie.mdl"); precache_model ("progs/h_zombie.mdl"); precache_model ("progs/zom_gib.mdl"); precache_sound ("zombie/z_idle.wav"); precache_sound ("zombie/z_idle1.wav"); precache_sound ("zombie/z_shot1.wav"); precache_sound ("zombie/z_gib.wav"); precache_sound ("zombie/z_pain.wav"); precache_sound ("zombie/z_pain1.wav"); precache_sound ("zombie/z_fall.wav"); precache_sound ("zombie/z_miss.wav"); precache_sound ("zombie/z_hit.wav"); precache_sound ("zombie/idle_w2.wav"); self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; setmodel (self, "progs/zombie.mdl"); setsize (self, '-16 -16 -24', '16 16 40'); self.health = 60; self.th_stand = zombie_stand1; self.th_walk = zombie_walk1; self.th_run = zombie_run1; self.th_pain = zombie_pain; self.th_die = zombie_die; self.th_missile = zombie_missile; if (self.spawnflags & SPAWN_CRUCIFIED) { self.movetype = MOVETYPE_NONE; zombie_cruc1 (); } else walkmonster_start(); };