/* ============================================================================== DOG ============================================================================== */ $cd /raid/UNTITLED-GAME//id1/models/dog $origin 0 0 24 $base base $skin skin $frame dogc $frame dogd void() dog_leap1; void() dog_run1; /* ================ dog_bite ================ */ void() dog_bite= { local vector delta; local float ldmg; if (!self.enemy) return; ai_charge(10); if (!CanDamage (self.enemy, self)) return; delta = self.enemy.origin - self.origin; if (vlen(delta) > 100) return; ldmg = (random() + random() + random()) * 8; T_Damage (self.enemy, self, self, ldmg); }; void() Dog_JumpTouch= { local float ldmg; if (self.health <= 0) return; if (other.takedamage) { if ( vlen(self.velocity) > 300 ) { ldmg = 10 + 10*random(); T_Damage (other, self, self, ldmg); } } if (!checkbottom(self)) { if (self.flags & FL_ONGROUND) { // jump randomly to not get hung up //dprint ("popjump\n"); self.touch = SUB_Null; self.think = dog_leap1; self.nextthink = time + 0.1; // self.velocity_x = (random() - 0.5) * 600; // self.velocity_y = (random() - 0.5) * 600; // self.velocity_z = 200; // self.flags = self.flags - FL_ONGROUND; } return; // not on ground yet } self.touch = SUB_Null; self.think = dog_run1; self.nextthink = time + 0.1; }; void() dog_stand1=[ $dogc, dog_stand2 ] {ai_stand();}; void() dog_stand2=[ $dogc, dog_stand3 ] {ai_stand();}; void() dog_stand3=[ $dogc, dog_stand4 ] {ai_stand();}; void() dog_stand4=[ $dogc, dog_stand5 ] {ai_stand();}; void() dog_stand5=[ $dogc, dog_stand6 ] {ai_stand();}; void() dog_stand6=[ $dogc, dog_stand7 ] {ai_stand();}; void() dog_stand7=[ $dogc, dog_stand8 ] {ai_stand();}; void() dog_stand8=[ $dogc, dog_stand9 ] {ai_stand();}; void() dog_stand9=[ $dogc, dog_stand1 ] {ai_stand();}; void() dog_walk1=[ $dogc , dog_walk2 ] { if (random() < 0.2) sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE); ai_walk(8);}; void() dog_walk2=[ $dogc , dog_walk3 ] {ai_walk(8);}; void() dog_walk3=[ $dogc , dog_walk4 ] {ai_walk(8);}; void() dog_walk4=[ $dogc , dog_walk5 ] {ai_walk(8);}; void() dog_walk5=[ $dogc , dog_walk6 ] {ai_walk(8);}; void() dog_walk6=[ $dogc , dog_walk7 ] {ai_walk(8);}; void() dog_walk7=[ $dogc , dog_walk8 ] {ai_walk(8);}; void() dog_walk8=[ $dogc , dog_walk1 ] {ai_walk(8);}; void() dog_run1=[ $dogc , dog_run2 ] { if (random() < 0.2) sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE); ai_run(16);}; void() dog_run2=[ $dogc , dog_run3 ] {ai_run(32);}; void() dog_run3=[ $dogc , dog_run4 ] {ai_run(32);}; void() dog_run4=[ $dogc , dog_run5 ] {ai_run(20);}; void() dog_run5=[ $dogc , dog_run6 ] {ai_run(64);}; void() dog_run6=[ $dogc , dog_run7 ] {ai_run(32);}; void() dog_run7=[ $dogc , dog_run8 ] {ai_run(16);}; void() dog_run8=[ $dogc , dog_run9 ] {ai_run(32);}; void() dog_run9=[ $dogc , dog_run10 ] {ai_run(32);}; void() dog_run10=[ $dogc , dog_run11 ] {ai_run(20);}; void() dog_run11=[ $dogc , dog_run12 ] {ai_run(64);}; void() dog_run12=[ $dogc , dog_run1 ] {ai_run(32);}; void() dog_atta1=[ $dogc, dog_atta2 ] {ai_charge(10);}; void() dog_atta2=[ $dogc, dog_atta3 ] {ai_charge(10);}; void() dog_atta3=[ $dogc, dog_atta4 ] {ai_charge(10);}; void() dog_atta4=[ $dogc, dog_atta5 ] { sound (self, CHAN_VOICE, "dog/dattack1.wav", 1, ATTN_NORM); dog_bite();}; void() dog_atta5=[ $dogc, dog_atta6 ] {ai_charge(10);}; void() dog_atta6=[ $dogc, dog_atta7 ] {ai_charge(10);}; void() dog_atta7=[ $dogc, dog_atta8 ] {ai_charge(10);}; void() dog_atta8=[ $dogc, dog_run1 ] {ai_charge(10);}; void() dog_leap1=[ $dogc, dog_leap2 ] {ai_face();}; void() dog_leap2=[ $dogc, dog_leap3 ] { ai_face(); self.touch = Dog_JumpTouch; makevectors (self.angles); self.origin_z = self.origin_z + 1; self.velocity = v_forward * 300 + '0 0 200'; if (self.flags & FL_ONGROUND) self.flags = self.flags - FL_ONGROUND; }; void() dog_leap3=[ $dogc, dog_leap4 ] {}; void() dog_leap4=[ $dogc, dog_leap5 ] {}; void() dog_leap5=[ $dogc, dog_leap6 ] {}; void() dog_leap6=[ $dogc, dog_leap7 ] {}; void() dog_leap7=[ $dogc, dog_leap8 ] {}; void() dog_leap8=[ $dogc, dog_leap9 ] {}; void() dog_leap9=[ $dogc, dog_leap9 ] {}; void() dog_pain1=[ $dogc , dog_pain2 ] {}; void() dog_pain2=[ $dogc , dog_pain3 ] {}; void() dog_pain3=[ $dogc , dog_pain4 ] {}; void() dog_pain4=[ $dogc , dog_pain5 ] {}; void() dog_pain5=[ $dogc , dog_pain6 ] {}; void() dog_pain6=[ $dogc , dog_run1 ] {}; void() dog_painb1=[ $dogc , dog_painb2 ] {}; void() dog_painb2=[ $dogc , dog_painb3 ] {}; void() dog_painb3=[ $dogc , dog_painb4 ] {ai_pain(4);}; void() dog_painb4=[ $dogc , dog_painb5 ] {ai_pain(12);}; void() dog_painb5=[ $dogc , dog_painb6 ] {ai_pain(12);}; void() dog_painb6=[ $dogc , dog_painb7 ] {ai_pain(2);}; void() dog_painb7=[ $dogc , dog_painb8 ] {}; void() dog_painb8=[ $dogc , dog_painb9 ] {ai_pain(4);}; void() dog_painb9=[ $dogc , dog_painb10 ] {}; void() dog_painb10=[ $dogc , dog_painb11 ] {ai_pain(10);}; void() dog_painb11=[ $dogc , dog_painb12 ] {}; void() dog_painb12=[ $dogc , dog_painb13 ] {}; void() dog_painb13=[ $dogc , dog_painb14 ] {}; void() dog_painb14=[ $dogc , dog_painb15 ] {}; void() dog_painb15=[ $dogc , dog_painb16 ] {}; void() dog_painb16=[ $dogc , dog_run1 ] {}; void() dog_pain= { sound (self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM); if (random() > 0.5) dog_pain1 (); else dog_painb1 (); }; void() dog_die1=[ $dogd, dog_die2 ] {}; void() dog_die2=[ $dogd, dog_die3 ] {}; void() dog_die3=[ $dogd, dog_die4 ] {}; void() dog_die4=[ $dogd, dog_die5 ] {}; void() dog_die5=[ $dogd, dog_die6 ] {}; void() dog_die6=[ $dogd, dog_die7 ] {}; void() dog_die7=[ $dogd, dog_die8 ] {}; void() dog_die8=[ $dogd, dog_die9 ] {}; void() dog_die9=[ $dogd, dog_die9 ] {}; void() dog_dieb1=[ $dogd, dog_dieb2 ] {}; void() dog_dieb2=[ $dogd, dog_dieb3 ] {}; void() dog_dieb3=[ $dogd, dog_dieb4 ] {}; void() dog_dieb4=[ $dogd, dog_dieb5 ] {}; void() dog_dieb5=[ $dogd, dog_dieb6 ] {}; void() dog_dieb6=[ $dogd, dog_dieb7 ] {}; void() dog_dieb7=[ $dogd, dog_dieb8 ] {}; void() dog_dieb8=[ $dogd, dog_dieb9 ] {}; void() dog_dieb9=[ $dogd, dog_dieb9 ] {}; void() dog_die= { // check for gib if (self.health < -35) { sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); ThrowGib ("progs/gib3.mdl", self.health); ThrowGib ("progs/gib3.mdl", self.health); ThrowGib ("progs/gib3.mdl", self.health); ThrowHead ("progs/h_dog.mdl", self.health); return; } // regular death sound (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM); self.solid = SOLID_NOT; if (random() > 0.5) dog_die1 (); else dog_dieb1 (); }; //============================================================================ /* ============== CheckDogMelee Returns TRUE if a melee attack would hit right now ============== */ float() CheckDogMelee= { if (enemy_range == RANGE_MELEE) { // FIXME: check canreach self.attack_state = AS_MELEE; return TRUE; } return FALSE; }; /* ============== CheckDogJump ============== */ float() CheckDogJump= { local vector dist; local float d; if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z + 0.75 * self.enemy.size_z) return FALSE; if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z + 0.25 * self.enemy.size_z) return FALSE; dist = self.enemy.origin - self.origin; dist_z = 0; d = vlen(dist); if (d < 80) return FALSE; if (d > 150) return FALSE; return TRUE; }; float() DogCheckAttack= { local vector vec; // if close enough for slashing, go for it if (CheckDogMelee ()) { self.attack_state = AS_MELEE; return TRUE; } if (CheckDogJump ()) { self.attack_state = AS_MISSILE; return TRUE; } return FALSE; }; //=========================================================================== /*UNTITLED-GAME/D monster_dog (1 0 0) (-32 -32 -24) (32 32 40) Ambush */ void() monster_dog= { if (deathmatch) { remove(self); return; } precache_model ("progs/h_dog.mdl"); precache_model ("progs/dog.mdl"); precache_sound ("dog/dattack1.wav"); precache_sound ("dog/ddeath.wav"); precache_sound ("dog/dpain1.wav"); precache_sound ("dog/dsight.wav"); precache_sound ("dog/idle.wav"); self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; setmodel (self, "progs/dog.mdl"); setsize (self, '-32 -32 -24', '32 32 40'); self.health = 25; self.th_stand = dog_stand1; self.th_walk = dog_walk1; self.th_run = dog_run1; self.th_pain = dog_pain; self.th_die = dog_die; self.th_melee = dog_atta1; self.th_missile = dog_leap1; walkmonster_start(); };