ew-progs/ew/monsters/mercs.qc
2011-09-06 00:00:00 +00:00

451 lines
18 KiB
C++

/*
==============================================================================
Mercenary S
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 run01 run02 run03 run04 run05 run06
$frame walk01 walk02 walk03 walk04 walk05 walk06 walk07 walk08 walk09 walk10
$frame walk11 walk12
$frame attacks101 attacks102 attacks103 attacks104 attacks105 attacks106 attacks107
$frame attacks201 attacks202 attacks203 attacks204 attacks205 attacks206 attacks207 attacks208
$frame attacks301 attacks302 attacks303 attacks304 attacks305 attacks306 attacks307
$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 block101 block102 block103 block104 block105 block106 block107
$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() mercs_stand1 =[ $idle101, mercs_stand2 ] {ai_stand();merc_idlesound();};
void() mercs_stand2 =[ $idle102, mercs_stand3 ] {ai_stand();};
void() mercs_stand3 =[ $idle103, mercs_stand4 ] {ai_stand();};
void() mercs_stand4 =[ $idle104, mercs_stand5 ] {ai_stand();};
void() mercs_stand5 =[ $idle105, mercs_stand6 ] {ai_stand();};
void() mercs_stand6 =[ $idle106, mercs_stand7 ] {ai_stand();};
void() mercs_stand7 =[ $idle107, mercs_stand8 ] {ai_stand();};
void() mercs_stand8 =[ $idle108, mercs_stand9 ] {ai_stand();};
void() mercs_stand9 =[ $idle109, mercs_stand10 ] {ai_stand();};
void() mercs_stand10 =[ $idle110, mercs_stand11 ] {ai_stand();};
void() mercs_stand11 =[ $idle111, mercs_stand12 ] {ai_stand();};
void() mercs_stand12 =[ $idle112, mercs_stand13 ] {ai_stand();};
void() mercs_stand13 =[ $idle113, mercs_stand14 ] {ai_stand();};
void() mercs_stand14 =[ $idle114, mercs_stand15 ] {ai_stand();};
void() mercs_stand15 =[ $idle115, mercs_stand16 ] {ai_stand();};
void() mercs_stand16 =[ $idle116, mercs_stand17 ] {ai_stand();};
void() mercs_stand17 =[ $idle117, mercs_stand18 ] {ai_stand();};
void() mercs_stand18 =[ $idle118, mercs_stand19 ] {ai_stand();};
void() mercs_stand19 =[ $idle119, mercs_stand20 ] {ai_stand();};
void() mercs_stand20 =[ $idle120, mercs_stand1 ] {ai_stand();};
//===========================================================================
void() mercs_walk1 =[ $walk01, mercs_walk2 ] {ai_walk(3);merc_idlesound();merc_step();};
void() mercs_walk2 =[ $walk02, mercs_walk3 ] {ai_walk(2);};
void() mercs_walk3 =[ $walk03, mercs_walk4 ] {ai_walk(3);};
void() mercs_walk4 =[ $walk04, mercs_walk5 ] {ai_walk(4);};
void() mercs_walk5 =[ $walk05, mercs_walk6 ] {ai_walk(3);};
void() mercs_walk6 =[ $walk06, mercs_walk7 ] {ai_walk(3);};
void() mercs_walk7 =[ $walk07, mercs_walk8 ] {ai_walk(3);merc_step();};
void() mercs_walk8 =[ $walk08, mercs_walk9 ] {ai_walk(4);};
void() mercs_walk9 =[ $walk09, mercs_walk10 ] {ai_walk(3);};
void() mercs_walk10 =[ $walk10, mercs_walk11 ] {ai_walk(3);};
void() mercs_walk11 =[ $walk11, mercs_walk12 ] {ai_walk(2);};
void() mercs_walk12 =[ $walk12, mercs_walk1 ] {ai_walk(3);};
//===========================================================================
void() mercs_run1 =[ $run01, mercs_run2 ] {ai_run(16);merc_tauntsound();merc_step();};
void() mercs_run2 =[ $run02, mercs_run3 ] {ai_run(20);};
void() mercs_run3 =[ $run03, mercs_run4 ] {ai_run(13);};
void() mercs_run4 =[ $run04, mercs_run5 ] {ai_run(7);};
void() mercs_run5 =[ $run05, mercs_run6 ] {ai_run(16);};
void() mercs_run6 =[ $run06, mercs_run1 ] {ai_run(20);};
//===========================================================================
void() mercs_runatk1 =[ $attacks101, mercs_runatk2 ] {ai_charge(20);merc_tauntsound();merc_step();};
void() mercs_runatk2 =[ $attacks102, mercs_runatk3 ] {ai_charge_side();};
void() mercs_runatk3 =[ $attacks103, mercs_runatk4 ] {ai_charge_side();};
void() mercs_runatk4 =[ $attacks104, mercs_runatk5 ] {ai_charge_side();};
void() mercs_runatk5 =[ $attacks105, mercs_runatk6 ] {ai_melee_side();};
void() mercs_runatk6 =[ $attacks106, mercs_runatk7 ] {ai_melee_side();};
void() mercs_runatk7 =[ $attacks107, mercs_run1 ] {ai_charge(10);};
//===========================================================================
void() mercs_atk1 =[ $attacks201, mercs_atk2 ] {ai_charge(0);merc_tauntsound();merc_step();};
void() mercs_atk2 =[ $attacks202, mercs_atk3 ] {ai_charge(7);};
void() mercs_atk3 =[ $attacks203, mercs_atk4 ] {ai_charge(4);};
void() mercs_atk4 =[ $attacks204, mercs_atk5 ] {ai_charge(0);};
void() mercs_atk5 =[ $attacks205, mercs_atk6 ] {ai_charge(3);ai_melee();};
void() mercs_atk6 =[ $attacks206, mercs_atk7 ] {ai_charge(4);ai_melee();};
void() mercs_atk7 =[ $attacks207, mercs_atk8 ] {ai_charge(2);ai_melee();};
void() mercs_atk8 =[ $attacks208, mercs_run1 ] {ai_charge(5);};
//===========================================================================
void() mercs_throw1 =[ $throw101, mercs_throw2 ] {ai_face();};
void() mercs_throw2 =[ $throw102, mercs_throw3 ] {ai_face();};
void() mercs_throw3 =[ $throw103, mercs_throw4 ] {ai_face();};
void() mercs_throw4 =[ $throw104, mercs_throw5 ] {ai_face();};
void() mercs_throw5 =[ $throw105, mercs_throw6 ] {ai_face();};
void() mercs_throw6 =[ $throw106, mercs_throw7 ] {ai_face();};
void() mercs_throw7 =[ $throw107, mercs_throw8 ] {ai_face();};
void() mercs_throw8 =[ $throw108, mercs_throw9 ] {ai_face();};
void() mercs_throw9 =[ $throw109, mercs_throw10 ] {ai_face();};
void() mercs_throw10 =[ $throw110, mercs_throw11 ] {ai_face();};
void() mercs_throw11 =[ $throw111, mercs_throw12 ] {ai_face();};
void() mercs_throw12 =[ $throw201, mercs_throw13 ] {ai_face();};
void() mercs_throw13 =[ $throw202, mercs_throw14 ] {ai_face();};
void() mercs_throw14 =[ $throw203, mercs_throw15 ] {ai_face();};
void() mercs_throw15 =[ $throw204, mercs_throw16 ] {ai_face();};
void() mercs_throw16 =[ $throw205, mercs_throw17 ] {ai_face();};
void() mercs_throw17 =[ $throw206, mercs_throw18 ] {ai_face();ThrowFlask();};
void() mercs_throw18 =[ $throw207, mercs_throw19 ] {ai_face();};
void() mercs_throw19 =[ $throw208, mercs_throw20 ] {ai_face();};
void() mercs_throw20 =[ $throw209, mercs_throw21 ] {ai_face();};
void() mercs_throw21 =[ $throw210, mercs_throw22 ] {ai_face();};
void() mercs_throw22 =[ $throw211, mercs_throw23 ] {ai_face();};
void() mercs_throw23 =[ $throw301, mercs_throw24 ] {ai_face();ai_back(6);};
void() mercs_throw24 =[ $throw302, mercs_throw25 ] {ai_face();ai_back(7);};
void() mercs_throw25 =[ $throw303, mercs_throw26 ] {ai_face();ai_back(5);};
void() mercs_throw26 =[ $throw304, mercs_throw27 ] {ai_face();ai_back(4);};
void() mercs_throw27 =[ $throw305, mercs_throw28 ] {ai_face();ai_back(2);};
void() mercs_throw28 =[ $throw306, mercs_throw29 ] {ai_face();ai_back(4);};
void() mercs_throw29 =[ $throw307, mercs_throw30 ] {ai_face();ai_back(3);};
void() mercs_throw30 =[ $throw308, mercs_throw31 ] {ai_face();ai_back(6);};
void() mercs_throw31 =[ $throw309, mercs_throw32 ] {ai_face();ai_back(7);};
void() mercs_throw32 =[ $throw310, mercs_run1 ] {ai_face();ai_back(5);};
//===========================================================================
void() mercs_paina1 =[ $pain101, mercs_paina2 ] {};
void() mercs_paina2 =[ $pain102, mercs_paina3 ] {};
void() mercs_paina3 =[ $pain103, mercs_paina4 ] {};
void() mercs_paina4 =[ $pain104, mercs_run1 ] {};
//===========================================================================
void() mercs_painb1 =[ $pain201, mercs_painb2 ] {};
void() mercs_painb2 =[ $pain202, mercs_painb3 ] {};
void() mercs_painb3 =[ $pain203, mercs_painb4 ] {};
void() mercs_painb4 =[ $pain204, mercs_painb5 ] {};
void() mercs_painb5 =[ $pain205, mercs_painb6 ] {};
void() mercs_painb6 =[ $pain206, mercs_run1 ] {};
//===========================================================================
void() mercs_painc1 =[ $pain301, mercs_painc2 ] {};
void() mercs_painc2 =[ $pain302, mercs_painc3 ] {};
void() mercs_painc3 =[ $pain303, mercs_painc4 ] {};
void() mercs_painc4 =[ $pain304, mercs_run1 ] {};
//===========================================================================
void() mercs_paind1 =[ $pain401, mercs_paind2 ] {};
void() mercs_paind2 =[ $pain402, mercs_paind3 ] {};
void() mercs_paind3 =[ $pain403, mercs_paind4 ] {};
void() mercs_paind4 =[ $pain404, mercs_paind5 ] {};
void() mercs_paind5 =[ $pain405, mercs_paind6 ] {};
void() mercs_paind6 =[ $pain406, mercs_paind7 ] {};
void() mercs_paind7 =[ $pain407, mercs_paind8 ] {};
void() mercs_paind8 =[ $pain408, mercs_paind9 ] {};
void() mercs_paind9 =[ $pain409, mercs_paind10 ] {};
void() mercs_paind10 =[ $pain410, mercs_paind11 ] {};
void() mercs_paind11 =[ $pain411, mercs_paind12 ] {};
void() mercs_paind12 =[ $pain412, mercs_run1 ] {};
void(entity attacker, float damage) mercs_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)
mercs_paina1 ();
else if(r < 0.50)
mercs_painb1 ();
else if(r < 0.75)
mercs_painc1 ();
else
mercs_paind1 ();
self.pain_finished = time + 1;
};
//===========================================================================
void() mercs_diea1 =[ $death101, mercs_diea2 ] {};
void() mercs_diea2 =[ $death102, mercs_diea3 ] {};
void() mercs_diea3 =[ $death103, mercs_diea4 ] {self.solid = SOLID_NOT;};
void() mercs_diea4 =[ $death104, mercs_diea5 ] {};
void() mercs_diea5 =[ $death105, mercs_diea6 ] {};
void() mercs_diea6 =[ $death106, mercs_diea7 ] {};
void() mercs_diea7 =[ $death107, mercs_diea8 ] {};
void() mercs_diea8 =[ $death108, mercs_diea9 ] {};
void() mercs_diea9 =[ $death109, mercs_diea9 ] {banish_monster();};
//===========================================================================
void() mercs_dieb1 =[ $death201, mercs_dieb2 ] {};
void() mercs_dieb2 =[ $death202, mercs_dieb3 ] {};
void() mercs_dieb3 =[ $death203, mercs_dieb4 ] {self.solid = SOLID_NOT;};
void() mercs_dieb4 =[ $death204, mercs_dieb5 ] {};
void() mercs_dieb5 =[ $death205, mercs_dieb6 ] {};
void() mercs_dieb6 =[ $death206, mercs_dieb6 ] {banish_monster();};
//===========================================================================
void() mercs_diec1 =[ $death301, mercs_diec2 ] {};
void() mercs_diec2 =[ $death302, mercs_diec3 ] {};
void() mercs_diec3 =[ $death303, mercs_diec4 ] {self.solid = SOLID_NOT;};
void() mercs_diec4 =[ $death304, mercs_diec5 ] {};
void() mercs_diec5 =[ $death305, mercs_diec6 ] {};
void() mercs_diec6 =[ $death306, mercs_diec7 ] {};
void() mercs_diec7 =[ $death307, mercs_diec8 ] {};
void() mercs_diec8 =[ $death308, mercs_diec9 ] {};
void() mercs_diec9 =[ $death309, mercs_diec10 ] {};
void() mercs_diec10 =[ $death310, mercs_diec11 ] {};
void() mercs_diec11 =[ $death311, mercs_diec12 ] {};
void() mercs_diec12 =[ $death312, mercs_diec13 ] {};
void() mercs_diec13 =[ $death313, mercs_diec14 ] {};
void() mercs_diec14 =[ $death314, mercs_diec15 ] {};
void() mercs_diec15 =[ $death315, mercs_diec16 ] {};
void() mercs_diec16 =[ $death316, mercs_diec17 ] {};
void() mercs_diec17 =[ $death317, mercs_diec17 ] {banish_monster();};
//===========================================================================
void() mercs_died1 =[ $death401, mercs_died2 ] {};
void() mercs_died2 =[ $death402, mercs_died3 ] {};
void() mercs_died3 =[ $death403, mercs_died4 ] {self.solid = SOLID_NOT;};
void() mercs_died4 =[ $death404, mercs_died5 ] {};
void() mercs_died5 =[ $death405, mercs_died6 ] {};
void() mercs_died6 =[ $death406, mercs_died7 ] {};
void() mercs_died7 =[ $death407, mercs_died8 ] {};
void() mercs_died8 =[ $death408, mercs_died9 ] {};
void() mercs_died9 =[ $death409, mercs_died10 ] {};
void() mercs_died10 =[ $death410, mercs_died11 ] {};
void() mercs_died11 =[ $death411, mercs_died12 ] {};
void() mercs_died12 =[ $death412, mercs_died13 ] {};
void() mercs_died13 =[ $death413, mercs_died14 ] {};
void() mercs_died14 =[ $death414, mercs_died15 ] {};
void() mercs_died15 =[ $death415, mercs_died16 ] {};
void() mercs_died16 =[ $death416, mercs_died17 ] {};
void() mercs_died17 =[ $death417, mercs_died18 ] {};
void() mercs_died18 =[ $death418, mercs_died19 ] {};
void() mercs_died19 =[ $death419, mercs_died20 ] {};
void() mercs_died20 =[ $death420, mercs_died20 ] {banish_monster();};
void() mercs_die =
{
local float r;
//make some noise
merc_deathsound();
//set up random variable
r = random();
//play random death animation
if (r < 0.25)
mercs_diea1 ();
else if (r < 0.50)
mercs_dieb1 ();
else if (r < 0.75)
mercs_diec1 ();
else
mercs_died1 ();
};
//===========================================================================
void() mercs_attack =
{
local float len;
// decide if now is a good swing time
len = vlen(self.enemy.origin+self.enemy.view_ofs - (self.origin+self.view_ofs));
if (len<80)
{
sound (self, CHAN_WEAPON, "enemy/mercenary/slash1.wav", 1, ATTN_NORM);
mercs_atk1 ();
}
else
{
sound (self, CHAN_WEAPON, "enemy/mercenary/slash2.wav", 1, ATTN_NORM);
mercs_runatk1 ();
}
};
void() mercs_missile =
{
//sword mercenaries shouldnt rely on flasks too much
if (random() <= 0.3)
{
sound (self, CHAN_WEAPON, "enemy/mercenary/chop1.wav", 1, ATTN_NORM);
mercs_throw1();
}
};
//===========================================================================
void() mercs_precache =
{
//mercs graphics
precache_model ("models/enemies/merc_s.md2");
precache_model ("models/holy/g_flask.md2");
//mercs 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/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/slash1.wav");
precache_sound ("enemy/mercenary/slash2.wav");
precache_sound ("enemy/mercenary/step1.wav");
precache_sound ("enemy/mercenary/step2.wav");
precache_sound ("enemy/mercenary/taunt1.wav");
};
/*EWED monster_mercs (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_mercs =
{
local float r;
if (deathmatch)
{
remove(self);
return;
}
//if we are put in the level directly then call mercs_precache
if (self.classname != "monster_knight")
mercs_precache();
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "models/enemies/merc_s.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 = mercs_stand1;
self.th_walk = mercs_walk1;
self.th_run = mercs_run1;
self.th_melee = mercs_attack;
self.th_missile = mercs_missile;
self.th_pain = mercs_pain;
self.th_die = mercs_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_mercs";
//set up our monflag
self.monflag = "TRUE";
walkmonster_start ();
};