607 lines
22 KiB
C++
607 lines
22 KiB
C++
/*
|
|
==============================================================================
|
|
|
|
Mercenary A
|
|
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 idle101 idle102 idle103 idle104 idle105 idle106 idle107 idle108 idle109 idle110
|
|
$frame idle111 idle112 idle113 idle114 idle115 idle116 idle117 idle118 idle119 idle120
|
|
|
|
$frame idle201 idle202 idle203 idle204 idle205 idle206 idle207 idle208 idle209 idle210
|
|
$frame idle211 idle212 idle213 idle214 idle215 idle216 idle217 idle218 idle219 idle220
|
|
|
|
$frame idle301 idle302
|
|
|
|
$frame idle401 idle402 idle403 idle404 idle405 idle406 idle407
|
|
|
|
$frame idle501 idle502
|
|
|
|
$frame idle601 idle602 idle603 idle604 idle605 idle606 idle607 idle608 idle609 idle610
|
|
$frame idle611 idle612 idle613 idle614 idle615 idle616 idle617 idle618 idle619 idle620
|
|
$frame idle621 idle622 idle623 idle624 idle625 idle626 idle627 idle628 idle629 idle630
|
|
$frame idle631 idle632 idle633 idle634 idle635 idle636 idle637 idle638 idle639 idle640
|
|
|
|
$frame run01 run02 run03 run04 run05 run06
|
|
|
|
$frame walk01 walk02 walk03 walk04 walk05 walk06 walk07 walk08 walk09 walk10
|
|
$frame walk11 walk12
|
|
|
|
$frame attacka101 attacka102 attacka103 attacka104 attacka105 attacka106 attacka107 attacka108
|
|
|
|
$frame attacka201 attacka202 attacka203 attacka204 attacka205 attacka206 attacka207 attacka208 attacka209 attacka210
|
|
|
|
$frame pain101 pain102 pain103 pain104
|
|
|
|
$frame pain201 pain202 pain203 pain204 pain205 pain206
|
|
|
|
$frame pain301 pain302 pain303 pain304
|
|
|
|
$frame pain401 pain402 pain403 pain404 pain405 pain406 pain407 pain408 pain409 pain410
|
|
$frame pain411 pain412
|
|
|
|
$frame death101 death102 death103 death104 death105 death106 death107 death108 death109
|
|
|
|
$frame death201 death202 death203 death204 death205 death206
|
|
|
|
$frame death301 death302 death303 death304 death305 death306 death307 death308 death309 death310
|
|
$frame death311 death312 death313 death314 death315 death316 death317
|
|
|
|
$frame death401 death402 death403 death404 death405 death406 death407 death408 death409 death410
|
|
$frame death411 death412 death413 death414 death415 death416 death417 death418 death419 death420
|
|
|
|
$frame death5001 death5002 death5003 death5004 death5005 death5006 death5007 death5008 death5009 death5010
|
|
$frame death5011 death5012 death5013 death5014 death5015 death5016 death5017 death5018 death5019 death5020
|
|
$frame death5021 death5022 death5023 death5024 death5025 death5026 death5027 death5028 death5029 death5030
|
|
$frame death5031 death5032 death5033 death5034 death5035 death5036
|
|
|
|
$frame throw101 throw102 throw103 throw104 throw105 throw106 throw107 throw108 throw109 throw110
|
|
$frame throw111
|
|
|
|
$frame throw201 throw202 throw203 throw204 throw205 throw206 throw207 throw208 throw209 throw210
|
|
$frame throw211
|
|
|
|
$frame throw301 throw302 throw303 throw304 throw305 throw306 throw307 throw308 throw309 throw310
|
|
|
|
$frame limp101 limp102 limp103 limp104 limp105 limp106 limp107 limp108 limp109
|
|
|
|
void() ThrowFlask;
|
|
void() merc_painsound;
|
|
void() merc_deathsound;
|
|
void() merc_idlesound;
|
|
void() merc_tauntsound;
|
|
void() merc_step;
|
|
//===========================================================================
|
|
|
|
void() merca_stand1 =[ $idle101, merca_stand2 ] {ai_stand();merc_idlesound();};
|
|
void() merca_stand2 =[ $idle102, merca_stand3 ] {ai_stand();};
|
|
void() merca_stand3 =[ $idle103, merca_stand4 ] {ai_stand();};
|
|
void() merca_stand4 =[ $idle104, merca_stand5 ] {ai_stand();};
|
|
void() merca_stand5 =[ $idle105, merca_stand6 ] {ai_stand();};
|
|
void() merca_stand6 =[ $idle106, merca_stand7 ] {ai_stand();};
|
|
void() merca_stand7 =[ $idle107, merca_stand8 ] {ai_stand();};
|
|
void() merca_stand8 =[ $idle108, merca_stand9 ] {ai_stand();};
|
|
void() merca_stand9 =[ $idle109, merca_stand10 ] {ai_stand();};
|
|
void() merca_stand10 =[ $idle110, merca_stand11 ] {ai_stand();};
|
|
void() merca_stand11 =[ $idle111, merca_stand12 ] {ai_stand();};
|
|
void() merca_stand12 =[ $idle112, merca_stand13 ] {ai_stand();};
|
|
void() merca_stand13 =[ $idle113, merca_stand14 ] {ai_stand();};
|
|
void() merca_stand14 =[ $idle114, merca_stand15 ] {ai_stand();};
|
|
void() merca_stand15 =[ $idle115, merca_stand16 ] {ai_stand();};
|
|
void() merca_stand16 =[ $idle116, merca_stand17 ] {ai_stand();};
|
|
void() merca_stand17 =[ $idle117, merca_stand18 ] {ai_stand();};
|
|
void() merca_stand18 =[ $idle118, merca_stand19 ] {ai_stand();};
|
|
void() merca_stand19 =[ $idle119, merca_stand20 ] {ai_stand();};
|
|
void() merca_stand20 =[ $idle120, merca_stand1 ] {ai_stand();};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_walk1 =[ $walk01, merca_walk2 ] {ai_walk(3);merc_idlesound();merc_step();};
|
|
void() merca_walk2 =[ $walk02, merca_walk3 ] {ai_walk(2);};
|
|
void() merca_walk3 =[ $walk03, merca_walk4 ] {ai_walk(3);};
|
|
void() merca_walk4 =[ $walk04, merca_walk5 ] {ai_walk(4);};
|
|
void() merca_walk5 =[ $walk05, merca_walk6 ] {ai_walk(3);};
|
|
void() merca_walk6 =[ $walk06, merca_walk7 ] {ai_walk(3);};
|
|
void() merca_walk7 =[ $walk07, merca_walk8 ] {ai_walk(3);merc_step();};
|
|
void() merca_walk8 =[ $walk08, merca_walk9 ] {ai_walk(4);};
|
|
void() merca_walk9 =[ $walk09, merca_walk10 ] {ai_walk(3);};
|
|
void() merca_walk10 =[ $walk10, merca_walk11 ] {ai_walk(3);};
|
|
void() merca_walk11 =[ $walk11, merca_walk12 ] {ai_walk(2);};
|
|
void() merca_walk12 =[ $walk12, merca_walk1 ] {ai_walk(3);};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_run1 =[ $run01, merca_run2 ] {ai_run(16);merc_tauntsound();merc_step();};
|
|
void() merca_run2 =[ $run02, merca_run3 ] {ai_run(20);};
|
|
void() merca_run3 =[ $run03, merca_run4 ] {ai_run(13);};
|
|
void() merca_run4 =[ $run04, merca_run5 ] {ai_run(7);};
|
|
void() merca_run5 =[ $run05, merca_run6 ] {ai_run(16);};
|
|
void() merca_run6 =[ $run06, merca_run1 ] {ai_run(20);};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_runatk1 =[ $attacka101, merca_runatk2 ] {ai_charge(20);merc_tauntsound();merc_step();};
|
|
void() merca_runatk2 =[ $attacka102, merca_runatk3 ] {ai_charge_side();};
|
|
void() merca_runatk3 =[ $attacka103, merca_runatk4 ] {ai_charge_side();};
|
|
void() merca_runatk4 =[ $attacka104, merca_runatk5 ] {ai_charge_side();};
|
|
void() merca_runatk5 =[ $attacka105, merca_runatk6 ] {ai_melee_side();};
|
|
void() merca_runatk6 =[ $attacka106, merca_runatk7 ] {ai_melee_side();};
|
|
void() merca_runatk7 =[ $attacka107, merca_runatk8 ] {ai_melee_side();};
|
|
void() merca_runatk8 =[ $attacka108, merca_run1 ] {ai_charge(10);};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_atk1 =[ $attacka201, merca_atk2 ] {ai_charge(5);merc_tauntsound();merc_step();};
|
|
void() merca_atk2 =[ $attacka202, merca_atk3 ] {ai_charge(7);};
|
|
void() merca_atk3 =[ $attacka203, merca_atk4 ] {ai_charge(4);};
|
|
void() merca_atk4 =[ $attacka204, merca_atk5 ] {ai_charge(6);};
|
|
void() merca_atk5 =[ $attacka205, merca_atk6 ] {ai_charge(3);};
|
|
void() merca_atk6 =[ $attacka206, merca_atk7 ] {ai_charge(4);ai_melee();merc_step();};
|
|
void() merca_atk7 =[ $attacka207, merca_atk8 ] {ai_charge(4);ai_melee();};
|
|
void() merca_atk8 =[ $attacka208, merca_atk9 ] {ai_charge(3);ai_melee();};
|
|
void() merca_atk9 =[ $attacka209, merca_atk10 ] {ai_charge(6);};
|
|
void() merca_atk10 =[ $attacka210, merca_run1 ] {ai_charge(5);};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_paina1 =[ $pain101, merca_paina2 ] {};
|
|
void() merca_paina2 =[ $pain102, merca_paina3 ] {};
|
|
void() merca_paina3 =[ $pain103, merca_paina4 ] {};
|
|
void() merca_paina4 =[ $pain104, merca_run1 ] {};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_painb1 =[ $pain201, merca_painb2 ] {};
|
|
void() merca_painb2 =[ $pain202, merca_painb3 ] {};
|
|
void() merca_painb3 =[ $pain203, merca_painb4 ] {};
|
|
void() merca_painb4 =[ $pain204, merca_painb5 ] {};
|
|
void() merca_painb5 =[ $pain205, merca_painb6 ] {};
|
|
void() merca_painb6 =[ $pain206, merca_run1 ] {};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_painc1 =[ $pain301, merca_painc2 ] {};
|
|
void() merca_painc2 =[ $pain302, merca_painc3 ] {};
|
|
void() merca_painc3 =[ $pain303, merca_painc4 ] {};
|
|
void() merca_painc4 =[ $pain304, merca_run1 ] {};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_paind1 =[ $pain401, merca_paind2 ] {};
|
|
void() merca_paind2 =[ $pain402, merca_paind3 ] {};
|
|
void() merca_paind3 =[ $pain403, merca_paind4 ] {};
|
|
void() merca_paind4 =[ $pain404, merca_paind5 ] {};
|
|
void() merca_paind5 =[ $pain405, merca_paind6 ] {};
|
|
void() merca_paind6 =[ $pain406, merca_paind7 ] {};
|
|
void() merca_paind7 =[ $pain407, merca_paind8 ] {};
|
|
void() merca_paind8 =[ $pain408, merca_paind9 ] {};
|
|
void() merca_paind9 =[ $pain409, merca_paind10 ] {};
|
|
void() merca_paind10 =[ $pain410, merca_paind11 ] {};
|
|
void() merca_paind11 =[ $pain411, merca_paind12 ] {};
|
|
void() merca_paind12 =[ $pain412, merca_run1 ] {};
|
|
|
|
void(entity attacker, float damage) merca_pain =
|
|
{
|
|
local float r;
|
|
|
|
if (self.pain_finished > time)
|
|
return;
|
|
|
|
//make some noise
|
|
merc_painsound();
|
|
|
|
//set up random variable
|
|
r = random();
|
|
|
|
//play random pain animation
|
|
if (r < 0.25)
|
|
merca_paina1 ();
|
|
else if(r < 0.50)
|
|
merca_painb1 ();
|
|
else if(r < 0.75)
|
|
merca_painc1 ();
|
|
else
|
|
merca_paind1 ();
|
|
|
|
self.pain_finished = time + 1;
|
|
};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_throw1 =[ $throw101, merca_throw2 ] {ai_face();};
|
|
void() merca_throw2 =[ $throw102, merca_throw3 ] {ai_face();};
|
|
void() merca_throw3 =[ $throw103, merca_throw4 ] {ai_face();};
|
|
void() merca_throw4 =[ $throw104, merca_throw5 ] {ai_face();};
|
|
void() merca_throw5 =[ $throw105, merca_throw6 ] {ai_face();};
|
|
void() merca_throw6 =[ $throw106, merca_throw7 ] {ai_face();};
|
|
void() merca_throw7 =[ $throw107, merca_throw8 ] {ai_face();};
|
|
void() merca_throw8 =[ $throw108, merca_throw9 ] {ai_face();};
|
|
void() merca_throw9 =[ $throw109, merca_throw10 ] {ai_face();};
|
|
void() merca_throw10 =[ $throw110, merca_throw11 ] {ai_face();};
|
|
void() merca_throw11 =[ $throw111, merca_throw12 ] {ai_face();};
|
|
void() merca_throw12 =[ $throw201, merca_throw13 ] {ai_face();};
|
|
void() merca_throw13 =[ $throw202, merca_throw14 ] {ai_face();};
|
|
void() merca_throw14 =[ $throw203, merca_throw15 ] {ai_face();};
|
|
void() merca_throw15 =[ $throw204, merca_throw16 ] {ai_face();};
|
|
void() merca_throw16 =[ $throw205, merca_throw17 ] {ai_face();};
|
|
void() merca_throw17 =[ $throw206, merca_throw18 ] {ai_face();ThrowFlask();};
|
|
void() merca_throw18 =[ $throw207, merca_throw19 ] {ai_face();};
|
|
void() merca_throw19 =[ $throw208, merca_throw20 ] {ai_face();};
|
|
void() merca_throw20 =[ $throw209, merca_throw21 ] {ai_face();};
|
|
void() merca_throw21 =[ $throw210, merca_throw22 ] {ai_face();};
|
|
void() merca_throw22 =[ $throw211, merca_throw23 ] {ai_face();};
|
|
void() merca_throw23 =[ $throw301, merca_throw24 ] {ai_face();ai_back(6);};
|
|
void() merca_throw24 =[ $throw302, merca_throw25 ] {ai_face();ai_back(7);};
|
|
void() merca_throw25 =[ $throw303, merca_throw26 ] {ai_face();ai_back(5);};
|
|
void() merca_throw26 =[ $throw304, merca_throw27 ] {ai_face();ai_back(4);};
|
|
void() merca_throw27 =[ $throw305, merca_throw28 ] {ai_face();ai_back(2);};
|
|
void() merca_throw28 =[ $throw306, merca_throw29 ] {ai_face();ai_back(4);};
|
|
void() merca_throw29 =[ $throw307, merca_throw30 ] {ai_face();ai_back(3);};
|
|
void() merca_throw30 =[ $throw308, merca_throw31 ] {ai_face();ai_back(6);};
|
|
void() merca_throw31 =[ $throw309, merca_throw32 ] {ai_face();ai_back(7);};
|
|
void() merca_throw32 =[ $throw310, merca_run1 ] {ai_face();ai_back(5);};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_diea1 =[ $death101, merca_diea2 ] {};
|
|
void() merca_diea2 =[ $death102, merca_diea3 ] {};
|
|
void() merca_diea3 =[ $death103, merca_diea4 ] {self.solid = SOLID_NOT;};
|
|
void() merca_diea4 =[ $death104, merca_diea5 ] {};
|
|
void() merca_diea5 =[ $death105, merca_diea6 ] {};
|
|
void() merca_diea6 =[ $death106, merca_diea7 ] {};
|
|
void() merca_diea7 =[ $death107, merca_diea8 ] {};
|
|
void() merca_diea8 =[ $death108, merca_diea9 ] {};
|
|
void() merca_diea9 =[ $death109, merca_diea9 ] {banish_monster();};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_dieb1 =[ $death201, merca_dieb2 ] {};
|
|
void() merca_dieb2 =[ $death202, merca_dieb3 ] {};
|
|
void() merca_dieb3 =[ $death203, merca_dieb4 ] {self.solid = SOLID_NOT;};
|
|
void() merca_dieb4 =[ $death204, merca_dieb5 ] {};
|
|
void() merca_dieb5 =[ $death205, merca_dieb6 ] {};
|
|
void() merca_dieb6 =[ $death206, merca_dieb6 ] {banish_monster();};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_diec1 =[ $death301, merca_diec2 ] {};
|
|
void() merca_diec2 =[ $death302, merca_diec3 ] {};
|
|
void() merca_diec3 =[ $death303, merca_diec4 ] {self.solid = SOLID_NOT;};
|
|
void() merca_diec4 =[ $death304, merca_diec5 ] {};
|
|
void() merca_diec5 =[ $death305, merca_diec6 ] {};
|
|
void() merca_diec6 =[ $death306, merca_diec7 ] {};
|
|
void() merca_diec7 =[ $death307, merca_diec8 ] {};
|
|
void() merca_diec8 =[ $death308, merca_diec9 ] {};
|
|
void() merca_diec9 =[ $death309, merca_diec10 ] {};
|
|
void() merca_diec10 =[ $death310, merca_diec11 ] {};
|
|
void() merca_diec11 =[ $death311, merca_diec12 ] {};
|
|
void() merca_diec12 =[ $death312, merca_diec13 ] {};
|
|
void() merca_diec13 =[ $death313, merca_diec14 ] {};
|
|
void() merca_diec14 =[ $death314, merca_diec15 ] {};
|
|
void() merca_diec15 =[ $death315, merca_diec16 ] {};
|
|
void() merca_diec16 =[ $death316, merca_diec17 ] {};
|
|
void() merca_diec17 =[ $death317, merca_diec17 ] {banish_monster();};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_died1 =[ $death401, merca_died2 ] {};
|
|
void() merca_died2 =[ $death402, merca_died3 ] {};
|
|
void() merca_died3 =[ $death403, merca_died4 ] {self.solid = SOLID_NOT;};
|
|
void() merca_died4 =[ $death404, merca_died5 ] {};
|
|
void() merca_died5 =[ $death405, merca_died6 ] {};
|
|
void() merca_died6 =[ $death406, merca_died7 ] {};
|
|
void() merca_died7 =[ $death407, merca_died8 ] {};
|
|
void() merca_died8 =[ $death408, merca_died9 ] {};
|
|
void() merca_died9 =[ $death409, merca_died10 ] {};
|
|
void() merca_died10 =[ $death410, merca_died11 ] {};
|
|
void() merca_died11 =[ $death411, merca_died12 ] {};
|
|
void() merca_died12 =[ $death412, merca_died13 ] {};
|
|
void() merca_died13 =[ $death413, merca_died14 ] {};
|
|
void() merca_died14 =[ $death414, merca_died15 ] {};
|
|
void() merca_died15 =[ $death415, merca_died16 ] {};
|
|
void() merca_died16 =[ $death416, merca_died17 ] {};
|
|
void() merca_died17 =[ $death417, merca_died18 ] {};
|
|
void() merca_died18 =[ $death418, merca_died19 ] {};
|
|
void() merca_died19 =[ $death419, merca_died20 ] {};
|
|
void() merca_died20 =[ $death420, merca_died20 ] {banish_monster();};
|
|
|
|
void() merca_die =
|
|
{
|
|
local float r;
|
|
|
|
//make some noise
|
|
merc_deathsound();
|
|
|
|
//set up random variable
|
|
r = random();
|
|
|
|
//play random death animation
|
|
if (r < 0.25)
|
|
merca_diea1 ();
|
|
else if(r < 0.50)
|
|
merca_dieb1 ();
|
|
else if(r < 0.75)
|
|
merca_diec1 ();
|
|
else
|
|
merca_died1 ();
|
|
};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_attack =
|
|
{
|
|
local float len;
|
|
local float r;
|
|
|
|
// decide if now is a good swing time
|
|
len = vlen(self.enemy.origin+self.enemy.view_ofs - (self.origin+self.view_ofs));
|
|
|
|
//play a random attack sound
|
|
r = random();
|
|
if (r <= 0.25)
|
|
sound (self, CHAN_WEAPON, "enemy/mercenary/chop1.wav", 1, ATTN_NORM);
|
|
else if (r <= 0.5)
|
|
sound (self, CHAN_WEAPON, "enemy/mercenary/chop2.wav", 1, ATTN_NORM);
|
|
else if (r <= 0.75)
|
|
sound (self, CHAN_WEAPON, "enemy/mercenary/chop3.wav", 1, ATTN_NORM);
|
|
else
|
|
sound (self, CHAN_WEAPON, "enemy/mercenary/chop4.wav", 1, ATTN_NORM);
|
|
|
|
if (len<80)
|
|
merca_atk1 ();
|
|
else
|
|
merca_runatk1 ();
|
|
};
|
|
|
|
void() merca_missile =
|
|
{
|
|
//axe mercenaries shouldnt rely on flasks too much
|
|
if (random() <= 0.3)
|
|
{
|
|
sound (self, CHAN_WEAPON, "enemy/mercenary/chop1.wav", 1, ATTN_NORM);
|
|
merca_throw1();
|
|
}
|
|
};
|
|
|
|
void() merc_painsound =
|
|
{
|
|
local float r;
|
|
|
|
r = random();
|
|
|
|
if (r < 0.33)
|
|
sound (self, CHAN_BODY, "enemy/mercenary/pain1.wav", 1, ATTN_NORM);
|
|
else if(r < 0.66)
|
|
sound (self, CHAN_BODY, "enemy/mercenary/pain2.wav", 1, ATTN_NORM);
|
|
else
|
|
sound (self, CHAN_BODY, "enemy/mercenary/pain3.wav", 1, ATTN_NORM);
|
|
};
|
|
|
|
void() merc_deathsound =
|
|
{
|
|
local float r;
|
|
|
|
r = random();
|
|
|
|
if (r < 0.33)
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/death1.wav", 1, ATTN_NORM);
|
|
else if(r < 0.66)
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/death4.wav", 1, ATTN_NORM);
|
|
else
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/death5.wav", 1, ATTN_NORM);
|
|
};
|
|
|
|
void() merc_idlesound =
|
|
{
|
|
local float r;
|
|
|
|
if (time > self.ltime)
|
|
{
|
|
self.ltime = time + 3 + random() + random() + random();
|
|
|
|
if (random() <= 0.4)
|
|
{
|
|
//set up random variable
|
|
r = random();
|
|
|
|
if (r <= 0.33)
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/chatter1.wav", 1, ATTN_IDLE);
|
|
else if (r <= 0.66)
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/chatter2.wav", 1, ATTN_IDLE);
|
|
else
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/chatter3.wav", 1, ATTN_IDLE);
|
|
}
|
|
}
|
|
};
|
|
|
|
void() merc_tauntsound =
|
|
{
|
|
if (time > self.ltime)
|
|
{
|
|
self.ltime = time + 6 + random();
|
|
|
|
if (random() <= 0.6)
|
|
sound (self, CHAN_VOICE, "enemy/mercenary/taunt1.wav", 1, ATTN_NORM);
|
|
}
|
|
};
|
|
|
|
float merc_stepsound;
|
|
|
|
void() merc_step =
|
|
{
|
|
//play step sounds in sequence, step1, step2, step1, step2, etc
|
|
merc_stepsound = merc_stepsound + 1;
|
|
|
|
if (merc_stepsound == 1)
|
|
sound (self, CHAN_BODY, "enemy/mercenary/step1.wav", 1, ATTN_IDLE);
|
|
else
|
|
{
|
|
sound (self, CHAN_BODY, "enemy/mercenary/step2.wav", 1, ATTN_IDLE);
|
|
merc_stepsound = 0;
|
|
}
|
|
};
|
|
|
|
//===========================================================================
|
|
|
|
void() merca_precache =
|
|
{
|
|
//merca graphics
|
|
precache_model ("models/enemies/merc_a.md2");
|
|
precache_model ("models/holy/g_flask.md2");
|
|
|
|
//merca sounds
|
|
precache_sound ("weapons/flaskexplode.wav");
|
|
precache_sound ("enemy/mercenary/alert1.wav");
|
|
precache_sound ("enemy/mercenary/alert2.wav");
|
|
precache_sound ("enemy/mercenary/chatter1.wav");
|
|
precache_sound ("enemy/mercenary/chatter2.wav");
|
|
precache_sound ("enemy/mercenary/chatter3.wav");
|
|
precache_sound ("enemy/mercenary/chop1.wav");
|
|
precache_sound ("enemy/mercenary/chop2.wav");
|
|
precache_sound ("enemy/mercenary/chop3.wav");
|
|
precache_sound ("enemy/mercenary/chop4.wav");
|
|
precache_sound ("enemy/mercenary/death1.wav");
|
|
precache_sound ("enemy/mercenary/death4.wav");
|
|
precache_sound ("enemy/mercenary/death5.wav");
|
|
precache_sound ("enemy/mercenary/pain1.wav");
|
|
precache_sound ("enemy/mercenary/pain2.wav");
|
|
precache_sound ("enemy/mercenary/pain3.wav");
|
|
precache_sound ("enemy/mercenary/step1.wav");
|
|
precache_sound ("enemy/mercenary/step2.wav");
|
|
precache_sound ("enemy/mercenary/taunt1.wav");
|
|
};
|
|
|
|
/*EWED monster_merca (1 0 0) (-16 -16 -24) (16 16 40) Ambush
|
|
*/
|
|
void() monster_merca =
|
|
{
|
|
local float r;
|
|
|
|
if (deathmatch)
|
|
{
|
|
remove(self);
|
|
return;
|
|
}
|
|
|
|
//if we are put in the level directly then call merca_precache
|
|
if (self.classname != "monster_knight")
|
|
merca_precache();
|
|
|
|
self.solid = SOLID_SLIDEBOX;
|
|
self.movetype = MOVETYPE_STEP;
|
|
|
|
setmodel (self, "models/enemies/merc_a.md2");
|
|
|
|
setsize (self, '-16 -16 -24', '16 16 40');
|
|
// setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
|
|
self.health = set_health(75);
|
|
self.speed = set_speed(500);
|
|
self.dtype = 2; //dodge type forward_strafe
|
|
self.alpha = 1; //we aren't transparent
|
|
|
|
self.th_stand = merca_stand1;
|
|
self.th_walk = merca_walk1;
|
|
self.th_run = merca_run1;
|
|
self.th_melee = merca_attack;
|
|
self.th_missile = merca_missile;
|
|
self.th_pain = merca_pain;
|
|
self.th_die = merca_die;
|
|
|
|
//pick a random skin
|
|
r = random();
|
|
if (r <= 0.25)
|
|
self.skin = 0;
|
|
else if (r <= 0.5)
|
|
self.skin = 1;
|
|
else if (r <= 0.75)
|
|
self.skin = 2;
|
|
else
|
|
self.skin = 3;
|
|
|
|
//my new classname is?
|
|
self.classname = "monster_merca";
|
|
|
|
//set up our monflag
|
|
self.monflag = "TRUE";
|
|
|
|
walkmonster_start ();
|
|
};
|
|
|
|
/*
|
|
=================
|
|
create_mercabot
|
|
|
|
Creates an Axe Mercenary at the specified 'spot'.
|
|
This is used by the Captain, he summons Hell Hounds, Dwellers, and Axe Mercenaries.
|
|
=================
|
|
*/
|
|
void(vector spot) create_mercabot =
|
|
{
|
|
local entity bot;
|
|
local float r;
|
|
|
|
// start entity and place it in world
|
|
bot = spawn();
|
|
bot.angles = self.angles;
|
|
setorigin (bot, spot);
|
|
bot.fixangle = TRUE;
|
|
spawn_tfog (bot.origin);
|
|
spawn_tdeath (bot.origin, bot);
|
|
|
|
// set size and shape
|
|
bot.solid = SOLID_SLIDEBOX;
|
|
bot.movetype = MOVETYPE_STEP;
|
|
setmodel (bot, "models/enemies/merc_a.md2");
|
|
setsize (bot, '-16 -16 -24', '16 16 40');
|
|
bot.flags = bot.flags | FL_MONSTER;
|
|
bot.takedamage = DAMAGE_AIM;
|
|
|
|
// define his animation
|
|
bot.th_stand = merca_stand1;
|
|
bot.th_walk = merca_walk1;
|
|
bot.th_run = merca_run1;
|
|
bot.th_die = merca_die;
|
|
bot.th_melee = merca_attack;
|
|
bot.th_missile = merca_missile;
|
|
bot.th_pain = merca_pain;
|
|
bot.health = set_health(75);
|
|
bot.speed = set_speed(500);
|
|
bot.dtype = 2; //dodge type forward_strafe
|
|
bot.alpha = 1; //we aren't transparent
|
|
|
|
// polish him up
|
|
bot.classname = "monster_merca";
|
|
bot.ideal_yaw = bot.angles * '0 1 0';
|
|
bot.yaw_speed = 120;
|
|
bot.view_ofs = '0 0 22';
|
|
|
|
//set up our monflag
|
|
bot.monflag = "TRUE";
|
|
|
|
//pick a random skin
|
|
r = random();
|
|
if (r <= 0.25)
|
|
bot.skin = 0;
|
|
else if (r <= 0.5)
|
|
bot.skin = 1;
|
|
else if (r <= 0.75)
|
|
bot.skin = 2;
|
|
else
|
|
bot.skin = 3;
|
|
|
|
// begin his thinking
|
|
bot.nextthink = time + 0.1 + random();
|
|
bot.think = th_stuck;
|
|
|
|
};
|
|
|
|
|