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

428 lines
16 KiB
C++

/*
==============================================================================
Mercenary X
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 attack101 attack102 attack103 attack104 attack105 attack106 attack107 attack108 attack109 attack110
$frame attack111
$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 death5037 death5038 death5039 death5040
$frame death5041 death5042 death5043 death5044 death5045 death5046 death5047 death5048
$frame limp101 limp102 limp103 limp104 limp105 limp106 limp107 limp108 limp109
void() arrow_touch;
void() merc_painsound;
void() merc_deathsound;
void() merc_idlesound;
void() merc_tauntsound;
void() merc_step;
//===========================================================================
void(vector org, vector vec) FireArrow =
{
local vector vec;
local float r;
r = random();
vec = normalize(vec);
newmis = spawn();
newmis.owner = self;
newmis.movetype = MOVETYPE_FLY;
newmis.solid = SOLID_BBOX;
setmodel (newmis, "models/items/v_bolt.md2");
setsize (newmis, '0 0 0', '0 0 0');
setorigin (newmis, org);
newmis.velocity = (vec * 400) * (r * 20);
newmis.angles = vectoangles(newmis.velocity);
newmis.nextthink = time + 5;
newmis.think = SUB_Remove;
newmis.touch = arrow_touch;
sound (self, CHAN_WEAPON, "weapons/holy/arrowb1.wav", 1, ATTN_NORM);
};
void() mercx_fire =
{
local vector org;
makevectors (self.angles);
org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
sound (self, CHAN_WEAPON, "weapons/xbowfire.wav", 1, ATTN_NORM);
FireArrow(org, self.enemy.origin - self.origin);
};
//============================================================================
void() mercx_stand1 =[ $idle101, mercx_stand2 ] {ai_stand();merc_idlesound();};
void() mercx_stand2 =[ $idle102, mercx_stand3 ] {ai_stand();};
void() mercx_stand3 =[ $idle103, mercx_stand4 ] {ai_stand();};
void() mercx_stand4 =[ $idle104, mercx_stand5 ] {ai_stand();};
void() mercx_stand5 =[ $idle105, mercx_stand6 ] {ai_stand();};
void() mercx_stand6 =[ $idle106, mercx_stand7 ] {ai_stand();};
void() mercx_stand7 =[ $idle107, mercx_stand8 ] {ai_stand();};
void() mercx_stand8 =[ $idle108, mercx_stand9 ] {ai_stand();};
void() mercx_stand9 =[ $idle109, mercx_stand10 ] {ai_stand();};
void() mercx_stand10 =[ $idle110, mercx_stand11 ] {ai_stand();};
void() mercx_stand11 =[ $idle111, mercx_stand12 ] {ai_stand();};
void() mercx_stand12 =[ $idle112, mercx_stand13 ] {ai_stand();};
void() mercx_stand13 =[ $idle113, mercx_stand14 ] {ai_stand();};
void() mercx_stand14 =[ $idle114, mercx_stand15 ] {ai_stand();};
void() mercx_stand15 =[ $idle115, mercx_stand16 ] {ai_stand();};
void() mercx_stand16 =[ $idle116, mercx_stand17 ] {ai_stand();};
void() mercx_stand17 =[ $idle117, mercx_stand18 ] {ai_stand();};
void() mercx_stand18 =[ $idle118, mercx_stand19 ] {ai_stand();};
void() mercx_stand19 =[ $idle119, mercx_stand20 ] {ai_stand();};
void() mercx_stand20 =[ $idle120, mercx_stand1 ] {ai_stand();};
//============================================================================
void() mercx_walk1 =[ $walk01 , mercx_walk2 ] {ai_walk(2);merc_idlesound();merc_step();};
void() mercx_walk2 =[ $walk02, mercx_walk3 ] {ai_walk(4);};
void() mercx_walk3 =[ $walk03, mercx_walk4 ] {ai_walk(4);};
void() mercx_walk4 =[ $walk04, mercx_walk5 ] {ai_walk(3);};
void() mercx_walk5 =[ $walk05, mercx_walk6 ] {ai_walk(1);};
void() mercx_walk6 =[ $walk06, mercx_walk7 ] {ai_walk(2);};
void() mercx_walk7 =[ $walk07, mercx_walk8 ] {ai_walk(2);merc_step();};
void() mercx_walk8 =[ $walk08, mercx_walk9 ] {ai_walk(1);};
void() mercx_walk9 =[ $walk09, mercx_walk10 ] {ai_walk(2);};
void() mercx_walk10 =[ $walk10, mercx_walk11 ] {ai_walk(4);};
void() mercx_walk11 =[ $walk11, mercx_walk12 ] {ai_walk(4);};
void() mercx_walk12 =[ $walk12, mercx_walk1 ] {ai_walk(1);};
//============================================================================
void() mercx_run1 =[ $run01, mercx_run2 ] {ai_run(18);merc_tauntsound();merc_step();};
void() mercx_run2 =[ $run02, mercx_run3 ] {ai_run(14);};
void() mercx_run3 =[ $run03, mercx_run4 ] {ai_run(7);};
void() mercx_run4 =[ $run04, mercx_run5 ] {ai_run(12);};
void() mercx_run5 =[ $run05, mercx_run6 ] {ai_run(14);};
void() mercx_run6 =[ $run06, mercx_run1 ] {ai_run(14);};
//============================================================================
void() mercx_atka1 =[ $attack101, mercx_atka2 ] {ai_face();};
void() mercx_atka2 =[ $attack102, mercx_atka3 ] {ai_face();};
void() mercx_atka3 =[ $attack103, mercx_atka4 ] {ai_face();};
void() mercx_atka4 =[ $attack104, mercx_atka5 ] {ai_face();};
void() mercx_atka5 =[ $attack105, mercx_atka6 ] {ai_face();};
void() mercx_atka6 =[ $attack106, mercx_atka7 ] {mercx_fire();};
void() mercx_atka7 =[ $attack107, mercx_atka8 ] {ai_face();};
void() mercx_atka8 =[ $attack108, mercx_atka9 ] {ai_face();};
void() mercx_atka9 =[ $attack109, mercx_atka10 ] {ai_face();};
void() mercx_atka10 =[ $attack110, mercx_atka11 ] {ai_face();};
void() mercx_atka11 =[ $attack111, mercx_run1 ]
{
ai_face();
SUB_CheckRefire (mercx_atka1);
};
//============================================================================
void() mercx_atkb1 =[ $attack101, mercx_atkb2 ] {ai_face();};
void() mercx_atkb2 =[ $attack102, mercx_atkb3 ] {ai_face();};
void() mercx_atkb3 =[ $attack103, mercx_atkb4 ] {ai_face();};
void() mercx_atkb4 =[ $attack104, mercx_atkb5 ] {ai_face();};
void() mercx_atkb5 =[ $attack105, mercx_atkb6 ] {ai_face();};
void() mercx_atkb6 =[ $attack106, mercx_atkb7 ] {mercx_fire();};
void() mercx_atkb7 =[ $attack107, mercx_atkb8 ] {mercx_fire();};
void() mercx_atkb8 =[ $attack108, mercx_atkb9 ] {mercx_fire();};
void() mercx_atkb9 =[ $attack109, mercx_atkb10 ] {ai_face();};
void() mercx_atkb10 =[ $attack110, mercx_atkb11 ] {ai_face();};
void() mercx_atkb11 =[ $attack111, mercx_run1 ]
{
ai_face();
SUB_CheckRefire (mercx_atkb1);
};
//============================================================================
void() mercx_paina1 =[ $pain101, mercx_paina2 ] {};
void() mercx_paina2 =[ $pain102, mercx_paina3 ] {};
void() mercx_paina3 =[ $pain103, mercx_paina4 ] {};
void() mercx_paina4 =[ $pain104, mercx_run1 ] {};
//============================================================================
void() mercx_painb1 =[ $pain201, mercx_painb2 ] {};
void() mercx_painb2 =[ $pain202, mercx_painb3 ] {};
void() mercx_painb3 =[ $pain203, mercx_painb4 ] {};
void() mercx_painb4 =[ $pain204, mercx_painb5 ] {};
void() mercx_painb5 =[ $pain205, mercx_painb6 ] {};
void() mercx_painb6 =[ $pain206, mercx_run1 ] {};
//============================================================================
void() mercx_painc1 =[ $pain301, mercx_paina2 ] {};
void() mercx_painc2 =[ $pain302, mercx_paina3 ] {};
void() mercx_painc3 =[ $pain303, mercx_paina4 ] {};
void() mercx_painc4 =[ $pain304, mercx_run1 ] {};
//============================================================================
void() mercx_paind1 =[ $pain401, mercx_paind2 ] {};
void() mercx_paind2 =[ $pain402, mercx_paind3 ] {};
void() mercx_paind3 =[ $pain403, mercx_paind4 ] {};
void() mercx_paind4 =[ $pain404, mercx_paind5 ] {};
void() mercx_paind5 =[ $pain405, mercx_paind6 ] {};
void() mercx_paind6 =[ $pain406, mercx_paind7 ] {};
void() mercx_paind7 =[ $pain407, mercx_paind8 ] {};
void() mercx_paind8 =[ $pain408, mercx_paind9 ] {};
void() mercx_paind9 =[ $pain409, mercx_paind10 ] {};
void() mercx_paind10 =[ $pain410, mercx_paind11 ] {};
void() mercx_paind11 =[ $pain411, mercx_paind12 ] {};
void() mercx_paind12 =[ $pain412, mercx_run1 ] {};
void(entity attacker, float damage) mercx_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)
mercx_paina1 ();
else if(r < 0.50)
mercx_painb1 ();
else if(r < 0.75)
mercx_painc1 ();
else
mercx_paind1 ();
self.pain_finished = time + 1;
};
//============================================================================
void() mercx_diea1 =[ $death101, mercx_diea2 ] {};
void() mercx_diea2 =[ $death102, mercx_diea3 ] {};
void() mercx_diea3 =[ $death103, mercx_diea4 ] {self.solid = SOLID_NOT;};
void() mercx_diea4 =[ $death104, mercx_diea5 ] {};
void() mercx_diea5 =[ $death105, mercx_diea6 ] {};
void() mercx_diea6 =[ $death106, mercx_diea7 ] {};
void() mercx_diea7 =[ $death107, mercx_diea8 ] {};
void() mercx_diea8 =[ $death108, mercx_diea9 ] {};
void() mercx_diea9 =[ $death109, mercx_diea9 ] {banish_monster();};
//===========================================================================
void() mercx_dieb1 =[ $death201, mercx_dieb2 ] {};
void() mercx_dieb2 =[ $death202, mercx_dieb3 ] {};
void() mercx_dieb3 =[ $death203, mercx_dieb4 ] {self.solid = SOLID_NOT;};
void() mercx_dieb4 =[ $death204, mercx_dieb5 ] {};
void() mercx_dieb5 =[ $death205, mercx_dieb6 ] {};
void() mercx_dieb6 =[ $death206, mercx_dieb6 ] {banish_monster();};
//===========================================================================
void() mercx_diec1 =[ $death301, mercx_diec2 ] {};
void() mercx_diec2 =[ $death302, mercx_diec3 ] {};
void() mercx_diec3 =[ $death303, mercx_diec4 ] {self.solid = SOLID_NOT;};
void() mercx_diec4 =[ $death304, mercx_diec5 ] {};
void() mercx_diec5 =[ $death305, mercx_diec6 ] {};
void() mercx_diec6 =[ $death306, mercx_diec7 ] {};
void() mercx_diec7 =[ $death307, mercx_diec8 ] {};
void() mercx_diec8 =[ $death308, mercx_diec9 ] {};
void() mercx_diec9 =[ $death309, mercx_diec10 ] {};
void() mercx_diec10 =[ $death310, mercx_diec11 ] {};
void() mercx_diec11 =[ $death311, mercx_diec12 ] {};
void() mercx_diec12 =[ $death312, mercx_diec13 ] {};
void() mercx_diec13 =[ $death313, mercx_diec14 ] {};
void() mercx_diec14 =[ $death314, mercx_diec15 ] {};
void() mercx_diec15 =[ $death315, mercx_diec16 ] {};
void() mercx_diec16 =[ $death316, mercx_diec17 ] {};
void() mercx_diec17 =[ $death317, mercx_diec17 ] {banish_monster();};
//===========================================================================
void() mercx_died1 =[ $death401, mercx_died2 ] {};
void() mercx_died2 =[ $death402, mercx_died3 ] {};
void() mercx_died3 =[ $death403, mercx_died4 ] {self.solid = SOLID_NOT;};
void() mercx_died4 =[ $death404, mercx_died5 ] {};
void() mercx_died5 =[ $death405, mercx_died6 ] {};
void() mercx_died6 =[ $death406, mercx_died7 ] {};
void() mercx_died7 =[ $death407, mercx_died8 ] {};
void() mercx_died8 =[ $death408, mercx_died9 ] {};
void() mercx_died9 =[ $death409, mercx_died10 ] {};
void() mercx_died10 =[ $death410, mercx_died11 ] {};
void() mercx_died11 =[ $death411, mercx_died12 ] {};
void() mercx_died12 =[ $death412, mercx_died13 ] {};
void() mercx_died13 =[ $death413, mercx_died14 ] {};
void() mercx_died14 =[ $death414, mercx_died15 ] {};
void() mercx_died15 =[ $death415, mercx_died16 ] {};
void() mercx_died16 =[ $death416, mercx_died17 ] {};
void() mercx_died17 =[ $death417, mercx_died18 ] {};
void() mercx_died18 =[ $death418, mercx_died19 ] {};
void() mercx_died19 =[ $death419, mercx_died20 ] {};
void() mercx_died20 =[ $death420, mercx_died20 ] {banish_monster();};
void() mercx_die =
{
local float r;
//make some noise
merc_deathsound();
//set up random variable
r = random();
//play random death animation
if (r < 0.25)
mercx_diea1 ();
else if (r < 0.50)
mercx_dieb1 ();
else if (r < 0.75)
mercx_diec1 ();
else
mercx_died1 ();
};
//============================================================================
void() mercx_missile =
{
//two missile attacks, either fire 1 arrow, or fire 3
if (random() <= 0.65) //fire one arrow more than we fire three
mercx_atka1();
else
mercx_atkb1();
};
//============================================================================
/*QUAKED monster_mercx (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_mercx =
{
local float r;
if (deathmatch)
{
remove(self);
return;
}
precache_model ("models/enemies/merc_x.md2");
precache_model2 ("progs/laser.mdl"); //do we need this anymore? -Xsniper
precache_sound ("weapons/xbowfire.wav");
precache_sound ("weapons/holy/arrowb1.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/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");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "models/enemies/merc_x.md2");
setsize (self, '-16 -16 -24', '16 16 40');
// setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.health = set_health(110);
self.speed = set_speed(500);
self.dtype = 1; //dodge type back_strafe
self.alpha = 1; //we aren't transparent
self.th_stand = mercx_stand1;
self.th_walk = mercx_walk1;
self.th_run = mercx_run1;
self.th_pain = mercx_pain;
self.th_die = mercx_die;
self.th_missile = mercx_missile;
//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_mercx";
//set up our monflag
self.monflag = "TRUE";
walkmonster_start();
};