/* ============================================================================== Apprentice coded by Michael Rogers a.k.a Xsniper http://xsniper.virtualave.net/ some code done by iD software ============================================================================== */ $cd /models/enemies $origin 0 0 24 $base base $skin base $frame idle001 idle002 idle003 idle004 idle005 idle006 idle007 idle008 idle009 idle010 $frame idle011 idle012 idle013 idle014 idle015 idle016 idle017 idle018 idle019 idle020 $frame idle021 idle022 idle023 idle024 idle025 idle026 idle027 idle028 idle029 idle030 $frame idle031 idle032 idle033 idle034 idle035 idle036 idle037 idle038 idle039 idle040 $frame idle041 idle042 idle043 idle044 idle045 idle046 idle047 idle048 idle049 idle050 $frame idle051 idle052 idle053 idle054 idle055 idle056 idle057 idle058 idle059 idle060 $frame idle061 idle062 idle063 idle064 idle065 idle066 idle067 idle068 idle069 idle070 $frame idle071 idle072 idle073 idle074 idle075 idle076 idle077 idle078 idle079 idle080 $frame idle081 idle082 idle083 idle084 idle085 idle086 idle087 idle088 idle089 idle090 $frame idle091 idle092 idle093 idle094 idle095 idle096 idle097 idle098 idle099 idle100 $frame fly001 fly002 fly003 fly004 fly005 fly006 fly007 fly008 fly009 fly010 $frame fly011 fly012 fly013 fly014 fly015 fly016 fly017 fly018 fly019 fly020 $frame teleport001 teleport002 teleport003 teleport004 teleport005 teleport006 teleport007 teleport008 teleport009 teleport010 $frame attack001 attack002 attack003 attack004 attack005 attack006 attack007 attack008 attack009 attack010 $frame block001 block002 block003 block004 block005 block006 block007 block008 block009 block010 $frame pain001 pain002 pain003 pain004 $frame death1001 death1002 death1003 death1004 death1005 death1006 death1007 death1008 death1009 death1010 $frame death2001 death2002 death2003 death2004 death2005 death2006 death2007 death2008 death2009 death2010 $frame death2011 death2012 death2013 death2014 death2015 death2016 death2017 death2018 death2019 death2020 $frame death2021 death2022 death2023 death2024 death2025 death2026 death2027 death2028 death2029 death2030 $frame death2031 death2032 death2033 death2034 death2035 death2036 death2037 death2038 death2039 death2040 $frame death2041 death2042 death2043 death2044 death2045 death2046 death2047 death2048 death2049 death2050 /* ============= LaunchMissile Sets the given entities velocity and angles so that it will hit self.enemy if self.enemy maintains it's current velocity 0.1 is moderately accurate, 0.0 is totally accurate ============= */ void(entity missile, float mspeed, float accuracy) LaunchMissile = { local vector vec, move; local float fly; makevectors (self.angles); // set missile speed vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin; // calc aproximate time for missile to reach vec fly = vlen (vec) / mspeed; // get the entities xy velocity move = self.enemy.velocity; move_z = 0; // project the target forward in time vec = vec + move * fly; vec = normalize(vec); vec = vec + accuracy*v_up*(random()- 0.5) + accuracy*v_right*(random()- 0.5); missile.velocity = vec * mspeed; missile.angles = '0 0 0'; missile.angles_y = vectoyaw(missile.velocity); // set missile duration missile.nextthink = time + 5; missile.think = SUB_Remove; }; void() apprent_run1; void() apprent_side1; /* ================= ApprenticeCheckAttack ================= */ float() ApprenticeCheckAttack = { local vector spot1, spot2; local entity targ; local float chance; if (time < self.attack_finished) return FALSE; if (!enemy_vis) return FALSE; if (enemy_range == RANGE_FAR) { if (self.attack_state != AS_STRAIGHT) { self.attack_state = AS_STRAIGHT; apprent_run1 (); } return FALSE; } targ = self.enemy; // see if any entities are in the way of the shot spot1 = self.origin + self.view_ofs; spot2 = targ.origin + targ.view_ofs; traceline (spot1, spot2, FALSE, self); if (trace_ent != targ) { // don't have a clear shot, so move to a side if (self.attack_state != AS_STRAIGHT) { self.attack_state = AS_STRAIGHT; apprent_run1 (); } return FALSE; } if (enemy_range == RANGE_MELEE) chance = 0.9; else if (enemy_range == RANGE_NEAR) chance = 0.6; else if (enemy_range == RANGE_MID) chance = 0.2; else chance = 0; if (random () < chance) { self.attack_state = AS_MISSILE; return TRUE; } if (enemy_range == RANGE_MID) { if (self.attack_state != AS_STRAIGHT) { self.attack_state = AS_STRAIGHT; apprent_run1 (); } } else { if (self.attack_state != AS_SLIDING) { self.attack_state = AS_SLIDING; apprent_side1 (); } } return FALSE; }; /* ================= ApprenticeAttackFinished ================= */ float() ApprenticeAttackFinished = { if (enemy_range >= RANGE_MID || !enemy_vis) { self.attack_state = AS_STRAIGHT; self.think = apprent_run1; } else { self.attack_state = AS_SLIDING; self.think = apprent_side1; } }; /* ============================================================================== FAST ATTACKS ============================================================================== */ void() ApprentAcidTouch = { if (other == self.owner) return; // don't explode on owner T_RadiusDamage (self, self.owner, (20 + (random() * 10)), world); //play random acid sound if (random() <= 0.5) sound (self, CHAN_WEAPON, "weapons/demon/acidhit1.wav", 1, ATTN_NORM); else sound (self, CHAN_WEAPON, "weapons/demon/acidhit2.wav", 1, ATTN_NORM); remove(self); }; void() ApprentSkullTouch = { if (other == self.owner) return; // don't explode on owner T_RadiusDamage (self, self.owner, (20 + (random() * 10)), world); sound (self, CHAN_WEAPON, "weapons/lock4.wav", 1, ATTN_NORM); remove(self); }; void() Apprent_AcidAttack = { local vector vec; local vector dst; if (self.owner.health > 0) { self.owner.effects = self.owner.effects | EF_MUZZLEFLASH; makevectors (self.enemy.angles); dst = self.enemy.origin - 13*self.movedir; vec = normalize(dst - self.origin); launch_spike (self.origin, vec); newmis.velocity = vec*600; newmis.owner = self.owner; newmis.classname = "apprentacid"; setmodel (newmis, "models/weapons/gfx/acid.mdl"); setsize (newmis, VEC_ORIGIN, VEC_ORIGIN); newmis.touch = ApprentAcidTouch; } remove (self); }; void() Apprent_SkullAttack = { local vector vec; local vector dst; if (self.owner.health > 0) { self.owner.effects = self.owner.effects | EF_MUZZLEFLASH; makevectors (self.enemy.angles); dst = self.enemy.origin - 13*self.movedir; vec = normalize(dst - self.origin); launch_spike (self.origin, vec); newmis.velocity = vec*600; newmis.owner = self.owner; newmis.classname = "apprentskull"; setmodel (newmis, "models/weapons/gfx/skullblast.md2"); setsize (newmis, VEC_ORIGIN, VEC_ORIGIN); newmis.touch = ApprentSkullTouch; newmis.alpha = 0.4; } remove (self); }; void() Boss_SkullAttack = { local vector vec; local vector dst; if (self.owner.health > 0) { self.owner.effects = self.owner.effects | EF_MUZZLEFLASH; makevectors (self.enemy.angles); dst = self.enemy.origin - 13*self.movedir; vec = normalize(dst - self.origin); launch_spike (self.origin, vec); newmis.velocity = vec*2400; newmis.owner = self.owner; newmis.classname = "bossskull"; setmodel (newmis, "models/weapons/gfx/skullblast.md2"); setsize (newmis, VEC_ORIGIN, VEC_ORIGIN); newmis.touch = ApprentSkullTouch; newmis.alpha = 0.4; } remove (self); }; //====================================== void(float atype) Apprent_StartMissile = //This function starts the apprentice's missile attack, the variable "atype" that is passed to this function controls //what type of attack will be selected. //0 = Acid Attack //1 = Skull Blast //2 = Boss Fast Skull Blast //====================================== { local entity missile; sound (self, CHAN_WEAPON, "enemy/apprent/ability.wav", 1, ATTN_NORM); self.v_angle = self.angles; makevectors (self.angles); missile = spawn (); missile.owner = self; missile.nextthink = time + 0.6; setsize (missile, '0 0 0', '0 0 0'); //new origin setorigin (missile, self.origin + '0 0 15' + (v_right * 26)); //15 units up + 26 units to his right //old origin commented out now //setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right*14); missile.enemy = self.enemy; missile.nextthink = time + 0.8; //Three different attack types, either Acid, Skullblast, or Boss Skullblast if (atype == 0) missile.think = Apprent_AcidAttack; else if (atype == 1) missile.think = Apprent_SkullAttack; else if (atype == 2) missile.think = Boss_SkullAttack; missile.movedir = v_right; missile = spawn (); missile.owner = self; missile.nextthink = time + 1; setsize (missile, '0 0 0', '0 0 0'); //new origin setorigin (missile, self.origin + '0 0 15' + (v_right * 26)); //15 units up + 26 units to his right //old origin commented out now //setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right* -14); missile.enemy = self.enemy; missile.nextthink = time + 0.3; //Three different attack types, either Acid, Skullblast, or Boss Skullblast if (atype == 0) missile.think = Apprent_AcidAttack; else if (atype == 1) missile.think = Apprent_SkullAttack; else if (atype == 2) missile.think = Boss_SkullAttack; missile.movedir = VEC_ORIGIN - v_right; }; void() apprent_idlesound = { local float r; r = random(); if (self.waitmin < time) { self.waitmin = time + 2; if ( r <= 0.20) sound (self, CHAN_VOICE, "enemy/apprent/idle1.wav", 1, ATTN_IDLE); else if ( r <= 0.40) sound (self, CHAN_VOICE, "enemy/apprent/idle2.wav", 1, ATTN_IDLE); else if ( r <= 0.60) sound (self, CHAN_VOICE, "enemy/apprent/idle3.wav", 1, ATTN_IDLE); else if ( r <= 0.80) sound (self, CHAN_VOICE, "enemy/apprent/idle4.wav", 1, ATTN_IDLE); else sound (self, CHAN_VOICE, "enemy/apprent/idle5.wav", 1, ATTN_IDLE); } return; }; //=========================================================================== void() apprent_idle001 =[ $idle001, apprent_idle002 ] {ai_stand();}; void() apprent_idle002 =[ $idle002, apprent_idle003 ] {ai_stand();}; void() apprent_idle003 =[ $idle003, apprent_idle004 ] {ai_stand();}; void() apprent_idle004 =[ $idle004, apprent_idle005 ] {ai_stand();}; void() apprent_idle005 =[ $idle005, apprent_idle006 ] {ai_stand();}; void() apprent_idle006 =[ $idle006, apprent_idle007 ] {ai_stand();}; void() apprent_idle007 =[ $idle007, apprent_idle008 ] {ai_stand();}; void() apprent_idle008 =[ $idle008, apprent_idle009 ] {ai_stand();}; void() apprent_idle009 =[ $idle009, apprent_idle010 ] {ai_stand();}; void() apprent_idle010 =[ $idle010, apprent_idle011 ] {ai_stand();}; void() apprent_idle011 =[ $idle011, apprent_idle012 ] {ai_stand();}; void() apprent_idle012 =[ $idle012, apprent_idle013 ] {ai_stand();}; void() apprent_idle013 =[ $idle013, apprent_idle014 ] {ai_stand();}; void() apprent_idle014 =[ $idle014, apprent_idle015 ] {ai_stand();}; void() apprent_idle015 =[ $idle015, apprent_idle016 ] {ai_stand();}; void() apprent_idle016 =[ $idle016, apprent_idle017 ] {ai_stand();}; void() apprent_idle017 =[ $idle017, apprent_idle018 ] {ai_stand();}; void() apprent_idle018 =[ $idle018, apprent_idle019 ] {ai_stand();}; void() apprent_idle019 =[ $idle019, apprent_idle020 ] {ai_stand();}; void() apprent_idle020 =[ $idle020, apprent_idle021 ] {ai_stand();}; void() apprent_idle021 =[ $idle021, apprent_idle022 ] {ai_stand();}; void() apprent_idle022 =[ $idle022, apprent_idle023 ] {ai_stand();}; void() apprent_idle023 =[ $idle023, apprent_idle024 ] {ai_stand();}; void() apprent_idle024 =[ $idle024, apprent_idle025 ] {ai_stand();}; void() apprent_idle025 =[ $idle025, apprent_idle026 ] {ai_stand();}; void() apprent_idle026 =[ $idle026, apprent_idle027 ] {ai_stand();}; void() apprent_idle027 =[ $idle027, apprent_idle028 ] {ai_stand();}; void() apprent_idle028 =[ $idle028, apprent_idle029 ] {ai_stand();}; void() apprent_idle029 =[ $idle029, apprent_idle030 ] {ai_stand();}; void() apprent_idle030 =[ $idle030, apprent_idle031 ] {ai_stand();}; void() apprent_idle031 =[ $idle031, apprent_idle032 ] {ai_stand();}; void() apprent_idle032 =[ $idle032, apprent_idle033 ] {ai_stand();}; void() apprent_idle033 =[ $idle033, apprent_idle034 ] {ai_stand();}; void() apprent_idle034 =[ $idle034, apprent_idle035 ] {ai_stand();}; void() apprent_idle035 =[ $idle035, apprent_idle036 ] {ai_stand();}; void() apprent_idle036 =[ $idle036, apprent_idle037 ] {ai_stand();}; void() apprent_idle037 =[ $idle037, apprent_idle038 ] {ai_stand();}; void() apprent_idle038 =[ $idle038, apprent_idle039 ] {ai_stand();}; void() apprent_idle039 =[ $idle039, apprent_idle040 ] {ai_stand();}; void() apprent_idle040 =[ $idle040, apprent_idle041 ] {ai_stand();}; void() apprent_idle041 =[ $idle041, apprent_idle042 ] {ai_stand();}; void() apprent_idle042 =[ $idle042, apprent_idle043 ] {ai_stand();}; void() apprent_idle043 =[ $idle043, apprent_idle044 ] {ai_stand();}; void() apprent_idle044 =[ $idle044, apprent_idle045 ] {ai_stand();}; void() apprent_idle045 =[ $idle045, apprent_idle046 ] {ai_stand();}; void() apprent_idle046 =[ $idle046, apprent_idle047 ] {ai_stand();}; void() apprent_idle047 =[ $idle047, apprent_idle048 ] {ai_stand();}; void() apprent_idle048 =[ $idle048, apprent_idle049 ] {ai_stand();}; void() apprent_idle049 =[ $idle049, apprent_idle050 ] {ai_stand();}; void() apprent_idle050 =[ $idle050, apprent_idle051 ] {ai_stand();}; void() apprent_idle051 =[ $idle051, apprent_idle052 ] {ai_stand();}; void() apprent_idle052 =[ $idle052, apprent_idle053 ] {ai_stand();}; void() apprent_idle053 =[ $idle053, apprent_idle054 ] {ai_stand();}; void() apprent_idle054 =[ $idle054, apprent_idle055 ] {ai_stand();}; void() apprent_idle055 =[ $idle055, apprent_idle056 ] {ai_stand();}; void() apprent_idle056 =[ $idle056, apprent_idle057 ] {ai_stand();}; void() apprent_idle057 =[ $idle057, apprent_idle058 ] {ai_stand();}; void() apprent_idle058 =[ $idle058, apprent_idle059 ] {ai_stand();}; void() apprent_idle059 =[ $idle059, apprent_idle060 ] {ai_stand();}; void() apprent_idle060 =[ $idle060, apprent_idle061 ] {ai_stand();}; void() apprent_idle061 =[ $idle061, apprent_idle062 ] {ai_stand();}; void() apprent_idle062 =[ $idle062, apprent_idle063 ] {ai_stand();}; void() apprent_idle063 =[ $idle063, apprent_idle064 ] {ai_stand();}; void() apprent_idle064 =[ $idle064, apprent_idle065 ] {ai_stand();}; void() apprent_idle065 =[ $idle065, apprent_idle066 ] {ai_stand();}; void() apprent_idle066 =[ $idle066, apprent_idle067 ] {ai_stand();}; void() apprent_idle067 =[ $idle067, apprent_idle068 ] {ai_stand();}; void() apprent_idle068 =[ $idle068, apprent_idle069 ] {ai_stand();}; void() apprent_idle069 =[ $idle069, apprent_idle070 ] {ai_stand();}; void() apprent_idle070 =[ $idle070, apprent_idle071 ] {ai_stand();}; void() apprent_idle071 =[ $idle071, apprent_idle072 ] {ai_stand();}; void() apprent_idle072 =[ $idle072, apprent_idle073 ] {ai_stand();}; void() apprent_idle073 =[ $idle073, apprent_idle074 ] {ai_stand();}; void() apprent_idle074 =[ $idle074, apprent_idle075 ] {ai_stand();}; void() apprent_idle075 =[ $idle075, apprent_idle076 ] {ai_stand();}; void() apprent_idle076 =[ $idle076, apprent_idle077 ] {ai_stand();}; void() apprent_idle077 =[ $idle077, apprent_idle078 ] {ai_stand();}; void() apprent_idle078 =[ $idle078, apprent_idle079 ] {ai_stand();}; void() apprent_idle079 =[ $idle079, apprent_idle080 ] {ai_stand();}; void() apprent_idle080 =[ $idle080, apprent_idle081 ] {ai_stand();}; void() apprent_idle081 =[ $idle081, apprent_idle082 ] {ai_stand();}; void() apprent_idle082 =[ $idle082, apprent_idle083 ] {ai_stand();}; void() apprent_idle083 =[ $idle083, apprent_idle084 ] {ai_stand();}; void() apprent_idle084 =[ $idle084, apprent_idle085 ] {ai_stand();}; void() apprent_idle085 =[ $idle085, apprent_idle086 ] {ai_stand();}; void() apprent_idle086 =[ $idle086, apprent_idle087 ] {ai_stand();}; void() apprent_idle087 =[ $idle087, apprent_idle088 ] {ai_stand();}; void() apprent_idle088 =[ $idle088, apprent_idle089 ] {ai_stand();}; void() apprent_idle089 =[ $idle089, apprent_idle090 ] {ai_stand();}; void() apprent_idle090 =[ $idle090, apprent_idle091 ] {ai_stand();}; void() apprent_idle091 =[ $idle091, apprent_idle092 ] {ai_stand();}; void() apprent_idle092 =[ $idle092, apprent_idle093 ] {ai_stand();}; void() apprent_idle093 =[ $idle093, apprent_idle094 ] {ai_stand();}; void() apprent_idle094 =[ $idle094, apprent_idle095 ] {ai_stand();}; void() apprent_idle095 =[ $idle095, apprent_idle096 ] {ai_stand();}; void() apprent_idle096 =[ $idle096, apprent_idle097 ] {ai_stand();}; void() apprent_idle097 =[ $idle097, apprent_idle098 ] {ai_stand();}; void() apprent_idle098 =[ $idle098, apprent_idle099 ] {ai_stand();}; void() apprent_idle099 =[ $idle099, apprent_idle100 ] {ai_stand();}; void() apprent_idle100 =[ $idle100, apprent_idle001 ] {ai_stand();}; //=========================================================================== void() apprent_fly001 =[ $fly001, apprent_fly002 ] { ai_walk(8); apprent_idlesound(); }; void() apprent_fly002 =[ $fly002, apprent_fly003 ] {ai_walk(8);}; void() apprent_fly003 =[ $fly003, apprent_fly004 ] {ai_walk(8);}; void() apprent_fly004 =[ $fly004, apprent_fly005 ] {ai_walk(8);}; void() apprent_fly005 =[ $fly005, apprent_fly006 ] {ai_walk(8);}; void() apprent_fly006 =[ $fly006, apprent_fly007 ] {ai_walk(8);}; void() apprent_fly007 =[ $fly007, apprent_fly008 ] {ai_walk(8);}; void() apprent_fly008 =[ $fly008, apprent_fly009 ] {ai_walk(8);}; void() apprent_fly009 =[ $fly009, apprent_fly010 ] {ai_walk(8);}; void() apprent_fly010 =[ $fly010, apprent_fly011 ] {ai_walk(8);}; void() apprent_fly011 =[ $fly011, apprent_fly012 ] {ai_walk(8);}; void() apprent_fly012 =[ $fly012, apprent_fly013 ] {ai_walk(8);}; void() apprent_fly013 =[ $fly013, apprent_fly014 ] {ai_walk(8);}; void() apprent_fly014 =[ $fly014, apprent_fly015 ] {ai_walk(8);}; void() apprent_fly015 =[ $fly015, apprent_fly016 ] {ai_walk(8);}; void() apprent_fly016 =[ $fly016, apprent_fly017 ] {ai_walk(8);}; void() apprent_fly017 =[ $fly017, apprent_fly018 ] {ai_walk(8);}; void() apprent_fly018 =[ $fly018, apprent_fly019 ] {ai_walk(8);}; void() apprent_fly019 =[ $fly019, apprent_fly020 ] {ai_walk(8);}; void() apprent_fly020 =[ $fly020, apprent_fly001 ] {ai_walk(8);}; //=========================================================================== void() apprent_side1 =[ $fly001, apprent_side2 ] { ai_run(8); apprent_idlesound(); }; void() apprent_side2 =[ $fly002, apprent_side3 ] {ai_run(8);}; void() apprent_side3 =[ $fly003, apprent_side4 ] {ai_run(8);}; void() apprent_side4 =[ $fly004, apprent_side5 ] {ai_run(8);}; void() apprent_side5 =[ $fly005, apprent_side6 ] {ai_run(8);}; void() apprent_side6 =[ $fly006, apprent_side7 ] {ai_run(8);}; void() apprent_side7 =[ $fly007, apprent_side8 ] {ai_run(8);}; void() apprent_side8 =[ $fly008, apprent_side9 ] {ai_run(8);}; void() apprent_side9 =[ $fly009, apprent_side10 ] {ai_run(8);}; void() apprent_side10 =[ $fly010, apprent_side11 ] {ai_run(8);}; void() apprent_side11 =[ $fly011, apprent_side12 ] {ai_run(8);}; void() apprent_side12 =[ $fly012, apprent_side13 ] {ai_run(8);}; void() apprent_side13 =[ $fly013, apprent_side14 ] {ai_run(8);}; void() apprent_side14 =[ $fly014, apprent_side15 ] {ai_run(8);}; void() apprent_side15 =[ $fly015, apprent_side16 ] {ai_run(8);}; void() apprent_side16 =[ $fly016, apprent_side17 ] {ai_run(8);}; void() apprent_side17 =[ $fly017, apprent_side18 ] {ai_run(8);}; void() apprent_side18 =[ $fly018, apprent_side19 ] {ai_run(8);}; void() apprent_side19 =[ $fly019, apprent_side20 ] {ai_run(8);}; void() apprent_side20 =[ $fly020, apprent_side1 ] {ai_run(8);}; //=========================================================================== void() apprent_run1 =[ $fly001, apprent_run2 ] { ai_run(16); apprent_idlesound(); }; void() apprent_run2 =[ $fly002, apprent_run3 ] {ai_run(16);}; void() apprent_run3 =[ $fly003, apprent_run4 ] {ai_run(16);}; void() apprent_run4 =[ $fly004, apprent_run5 ] {ai_run(16);}; void() apprent_run5 =[ $fly005, apprent_run6 ] {ai_run(16);}; void() apprent_run6 =[ $fly006, apprent_run7 ] {ai_run(16);}; void() apprent_run7 =[ $fly007, apprent_run8 ] {ai_run(16);}; void() apprent_run8 =[ $fly008, apprent_run9 ] {ai_run(16);}; void() apprent_run9 =[ $fly009, apprent_run10 ] {ai_run(16);}; void() apprent_run10 =[ $fly010, apprent_run11 ] {ai_run(16);}; void() apprent_run11 =[ $fly011, apprent_run12 ] {ai_run(16);}; void() apprent_run12 =[ $fly012, apprent_run13 ] {ai_run(16);}; void() apprent_run13 =[ $fly013, apprent_run14 ] {ai_run(16);}; void() apprent_run14 =[ $fly014, apprent_run15 ] {ai_run(16);}; void() apprent_run15 =[ $fly015, apprent_run16 ] {ai_run(16);}; void() apprent_run16 =[ $fly016, apprent_run17 ] {ai_run(16);}; void() apprent_run17 =[ $fly017, apprent_run18 ] {ai_run(16);}; void() apprent_run18 =[ $fly018, apprent_run19 ] {ai_run(16);}; void() apprent_run19 =[ $fly019, apprent_run20 ] {ai_run(16);}; void() apprent_run20 =[ $fly020, apprent_run1 ] {ai_run(16);}; //=========================================================================== void() apprent_acid1 =[ $attack001, apprent_acid2 ] { ai_face(); Apprent_StartMissile(0); }; void() apprent_acid2 =[ $attack002, apprent_acid3 ] {ai_face();}; void() apprent_acid3 =[ $attack003, apprent_acid4 ] {ai_face();}; void() apprent_acid4 =[ $attack004, apprent_acid5 ] {ai_face();}; void() apprent_acid5 =[ $attack005, apprent_acid6 ] {ai_face();}; void() apprent_acid6 =[ $attack006, apprent_acid7 ] {ai_face();}; void() apprent_acid7 =[ $attack007, apprent_acid8 ] {ai_face();}; void() apprent_acid8 =[ $attack008, apprent_acid9 ] {ai_face();}; void() apprent_acid9 =[ $attack009, apprent_acid10 ] {ai_face();}; void() apprent_acid10 =[ $attack010, apprent_run1 ] { ai_face(); SUB_AttackFinished(2); ApprenticeAttackFinished (); }; //=========================================================================== void() apprent_skull1 =[ $attack001, apprent_skull2 ] { ai_face(); Apprent_StartMissile(1); }; void() apprent_skull2 =[ $attack002, apprent_skull3 ] {ai_face();}; void() apprent_skull3 =[ $attack003, apprent_skull4 ] {ai_face();}; void() apprent_skull4 =[ $attack004, apprent_skull5 ] {ai_face();}; void() apprent_skull5 =[ $attack005, apprent_skull6 ] {ai_face();}; void() apprent_skull6 =[ $attack006, apprent_skull7 ] {ai_face();}; void() apprent_skull7 =[ $attack007, apprent_skull8 ] {ai_face();}; void() apprent_skull8 =[ $attack008, apprent_skull9 ] {ai_face();}; void() apprent_skull9 =[ $attack009, apprent_skull10 ] {ai_face();}; void() apprent_skull10 =[ $attack010, apprent_run1 ] { ai_face(); SUB_AttackFinished(2); ApprenticeAttackFinished (); }; //=========================================================================== void() apprent_pain1 =[ $pain001, apprent_pain2 ] {}; void() apprent_pain2 =[ $pain002, apprent_pain3 ] {}; void() apprent_pain3 =[ $pain003, apprent_pain4 ] {}; void() apprent_pain4 =[ $pain004, apprent_run1 ] {}; void(entity attacker, float damage) apprent_Pain = { sound (self, CHAN_VOICE, "enemy/apprent/pain.wav", 1, ATTN_NORM); if (random()*70 > damage) return; // didn't flinch apprent_pain1 (); }; //=========================================================================== void() apprent_death1 =[ $death1001, apprent_death2 ] { self.velocity_x = -200 + 400*random(); self.velocity_y = -200 + 400*random(); self.velocity_z = 100 + 100*random(); self.flags = self.flags - (self.flags & FL_ONGROUND); sound (self, CHAN_VOICE, "enemy/apprent/death.wav", 1, ATTN_NORM); }; void() apprent_death2 =[ $death1002, apprent_death3 ] {}; void() apprent_death3 =[ $death1003, apprent_death4 ] {self.solid = SOLID_NOT;}; void() apprent_death4 =[ $death1004, apprent_death5 ] {}; void() apprent_death5 =[ $death1005, apprent_death6 ] {}; void() apprent_death6 =[ $death1006, apprent_death7 ] {}; void() apprent_death7 =[ $death1007, apprent_death8 ] {}; void() apprent_death8 =[ $death1008, apprent_death9 ] {}; void() apprent_death9 =[ $death1009, apprent_death10 ] {}; void() apprent_death10 =[ $death1010, apprent_death10 ] {banish_monster();}; void() apprent_die = { apprent_death1 (); }; //=========================================================================== void() apprent_Missile = { //Two attack types, choose between Acid attack, or Skull Blast if (random() <= 0.5) apprent_acid1(); else apprent_skull1(); }; void() apprentice_precache = { //apprentice graphics precache_model ("models/enemies/apprent.md2"); precache_model ("models/weapons/gfx/acid.mdl"); precache_model ("models/weapons/gfx/skullblast.md2"); //apprentice sounds precache_sound ("enemy/apprent/ability.wav"); precache_sound ("enemy/apprent/death.wav"); precache_sound ("enemy/apprent/idle1.wav"); precache_sound ("enemy/apprent/idle2.wav"); precache_sound ("enemy/apprent/idle3.wav"); precache_sound ("enemy/apprent/idle4.wav"); precache_sound ("enemy/apprent/idle5.wav"); precache_sound ("enemy/apprent/pain.wav"); precache_sound ("enemy/apprent/sight.wav"); precache_sound ("weapons/demon/acidhit1.wav"); precache_sound ("weapons/demon/acidhit2.wav"); precache_sound ("weapons/lock4.wav"); //used for missile touch function }; /*EWED monster_apprentice (1 0 0) (-16 -16 -24) (16 16 40) Ambush */ void() monster_apprentice = { if (deathmatch) { remove(self); return; } //if we are put in the level directly then call apprentice_precache if (self.classname != "monster_wizard") apprentice_precache(); self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; setmodel (self, "models/enemies/apprent.md2"); setsize (self, '-16 -16 -24', '16 16 40'); // setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX); self.health = set_health(80); self.speed = set_speed(0); //variable velocity system, not a factor for flying monster self.dtype = 3; //dodge type teleport self.alpha = 1; //we aren't transparent self.th_stand = apprent_idle001; self.th_walk = apprent_fly001; self.th_run = apprent_run1; self.th_missile = apprent_Missile; self.th_pain = apprent_Pain; self.th_die = apprent_die; //my new classname is? self.classname = "monster_apprentice"; //set up our monflag self.monflag = "TRUE"; flymonster_start (); };