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

454 lines
17 KiB
C++

/*
==============================================================================
Outrider
coded by Michael Rogers
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 idle121 idle122 idle123 idle124 idle125 idle126 idle127 idle128 idle129 idle130
$frame idle131 idle132 idle133 idle134 idle135 idle136 idle137 idle138 idle139
$frame run01 run02 run03 run04 run05 run06 run07 run08
$frame walk01 walk02 walk03 walk04 walk05 walk06 walk07 walk08 walk09 walk10
$frame walk11 walk12
$frame attack101 attack102 attack103 attack104 attack105 attack106 attack107 attack108 attack109
$frame pain101 pain102 pain103 pain104
$frame pain201 pain202 pain203 pain204 pain205
$frame pain301 pain302 pain303 pain304 pain305 pain306 pain307 pain308 pain309 pain310
$frame pain311
$frame pain401 pain402 pain403 pain404 pain405
$frame death101 death102 death103 death104 death105 death106 death107 death108 death109 death110
$frame death201 death202 death203 death204 death205 death206 death207 death208 death209 death210
$frame death211
$frame death301 death302 death303 death304 death305 death306 death307 death308 death309
$frame death4001 death4002 death4003 death4004 death4005 death4006 death4007 death4008 death4009 death4010
$frame death4011 death4012 death4013 death4014 death4015 death4016 death4017 death4018
$frame walklk01 walklk02 walklk03 walklk04 walklk05 walklk06 walklk07 walklk08 walklk09 walklk10
$frame walklk11 walklk12 walklk13 walklk14 walklk15 walklk16 walklk17 walklk18 walklk19 walklk20
$frame walklk21 walklk22 walklk23 walklk24
$frame limp101 limp102 limp103 limp104 limp105 limp106 limp107 limp108 limp109
void() mercx_fire;
void() outrider_painsound;
void() outrider_deathsound;
//===========================================================================
void() outrider_stand1 =[ $idle101, outrider_stand2 ] {ai_stand();};
void() outrider_stand2 =[ $idle102, outrider_stand3 ] {ai_stand();};
void() outrider_stand3 =[ $idle103, outrider_stand4 ] {ai_stand();};
void() outrider_stand4 =[ $idle104, outrider_stand5 ] {ai_stand();};
void() outrider_stand5 =[ $idle105, outrider_stand6 ] {ai_stand();};
void() outrider_stand6 =[ $idle106, outrider_stand7 ] {ai_stand();};
void() outrider_stand7 =[ $idle107, outrider_stand8 ] {ai_stand();};
void() outrider_stand8 =[ $idle108, outrider_stand9 ] {ai_stand();};
void() outrider_stand9 =[ $idle109, outrider_stand10 ] {ai_stand();};
void() outrider_stand10 =[ $idle110, outrider_stand11 ] {ai_stand();};
void() outrider_stand11 =[ $idle111, outrider_stand12 ] {ai_stand();};
void() outrider_stand12 =[ $idle112, outrider_stand13 ] {ai_stand();};
void() outrider_stand13 =[ $idle113, outrider_stand14 ] {ai_stand();};
void() outrider_stand14 =[ $idle114, outrider_stand15 ] {ai_stand();};
void() outrider_stand15 =[ $idle115, outrider_stand16 ] {ai_stand();};
void() outrider_stand16 =[ $idle116, outrider_stand17 ] {ai_stand();};
void() outrider_stand17 =[ $idle117, outrider_stand18 ] {ai_stand();};
void() outrider_stand18 =[ $idle118, outrider_stand19 ] {ai_stand();};
void() outrider_stand19 =[ $idle119, outrider_stand20 ] {ai_stand();};
void() outrider_stand20 =[ $idle120, outrider_stand21 ] {ai_stand();};
void() outrider_stand21 =[ $idle121, outrider_stand22 ] {ai_stand();};
void() outrider_stand22 =[ $idle122, outrider_stand23 ] {ai_stand();};
void() outrider_stand23 =[ $idle123, outrider_stand24 ] {ai_stand();};
void() outrider_stand24 =[ $idle124, outrider_stand25 ] {ai_stand();};
void() outrider_stand25 =[ $idle125, outrider_stand26 ] {ai_stand();};
void() outrider_stand26 =[ $idle126, outrider_stand27 ] {ai_stand();};
void() outrider_stand27 =[ $idle127, outrider_stand28 ] {ai_stand();};
void() outrider_stand28 =[ $idle128, outrider_stand29 ] {ai_stand();};
void() outrider_stand29 =[ $idle129, outrider_stand30 ] {ai_stand();};
void() outrider_stand30 =[ $idle130, outrider_stand31 ] {ai_stand();};
void() outrider_stand31 =[ $idle131, outrider_stand32 ] {ai_stand();};
void() outrider_stand32 =[ $idle132, outrider_stand33 ] {ai_stand();};
void() outrider_stand33 =[ $idle133, outrider_stand34 ] {ai_stand();};
void() outrider_stand34 =[ $idle134, outrider_stand35 ] {ai_stand();};
void() outrider_stand35 =[ $idle135, outrider_stand36 ] {ai_stand();};
void() outrider_stand36 =[ $idle136, outrider_stand37 ] {ai_stand();};
void() outrider_stand37 =[ $idle137, outrider_stand38 ] {ai_stand();};
void() outrider_stand38 =[ $idle138, outrider_stand39 ] {ai_stand();};
void() outrider_stand39 =[ $idle139, outrider_stand1 ] {ai_stand();};
//===========================================================================
void() outrider_walk1 =[ $walklk01, outrider_walk2 ] {ai_walk(5);};
void() outrider_walk2 =[ $walklk02, outrider_walk3 ] {ai_walk(6);};
void() outrider_walk3 =[ $walklk03, outrider_walk4 ] {ai_walk(4);};
void() outrider_walk4 =[ $walklk04, outrider_walk5 ] {ai_walk(7);};
void() outrider_walk5 =[ $walklk05, outrider_walk6 ] {ai_walk(5);};
void() outrider_walk6 =[ $walklk06, outrider_walk7 ] {ai_walk(6);};
void() outrider_walk7 =[ $walklk07, outrider_walk8 ] {ai_walk(4);};
void() outrider_walk8 =[ $walklk08, outrider_walk9 ] {ai_walk(7);};
void() outrider_walk9 =[ $walklk09, outrider_walk10 ] {ai_walk(5);};
void() outrider_walk10 =[ $walklk10, outrider_walk11 ] {ai_walk(6);};
void() outrider_walk11 =[ $walklk11, outrider_walk12 ] {ai_walk(4);};
void() outrider_walk12 =[ $walklk12, outrider_walk13 ] {ai_walk(7);};
void() outrider_walk13 =[ $walklk13, outrider_walk14 ] {ai_walk(5);};
void() outrider_walk14 =[ $walklk14, outrider_walk15 ] {ai_walk(6);};
void() outrider_walk15 =[ $walklk15, outrider_walk16 ] {ai_walk(4);};
void() outrider_walk16 =[ $walklk16, outrider_walk17 ] {ai_walk(7);};
void() outrider_walk17 =[ $walklk17, outrider_walk18 ] {ai_walk(5);};
void() outrider_walk18 =[ $walklk18, outrider_walk19 ] {ai_walk(6);};
void() outrider_walk19 =[ $walklk19, outrider_walk20 ] {ai_walk(4);};
void() outrider_walk20 =[ $walklk20, outrider_walk21 ] {ai_walk(7);};
void() outrider_walk21 =[ $walklk21, outrider_walk22 ] {ai_walk(5);};
void() outrider_walk22 =[ $walklk22, outrider_walk23 ] {ai_walk(6);};
void() outrider_walk23 =[ $walklk23, outrider_walk24 ] {ai_walk(4);};
void() outrider_walk24 =[ $walklk24, outrider_walk1 ] {ai_walk(7);};
//===========================================================================
void() outrider_run1 =[ $run01, outrider_run2 ] {ai_run(15);};
void() outrider_run2 =[ $run02, outrider_run3 ] {ai_run(15);};
void() outrider_run3 =[ $run03, outrider_run4 ] {ai_run(14);};
void() outrider_run4 =[ $run04, outrider_run5 ] {ai_run(16);};
void() outrider_run5 =[ $run05, outrider_run6 ] {ai_run(13);};
void() outrider_run6 =[ $run06, outrider_run7 ] {ai_run(15);};
void() outrider_run7 =[ $run07, outrider_run8 ] {ai_run(17);};
void() outrider_run8 =[ $run08, outrider_run1 ] {ai_run(13);};
//===========================================================================
void() outrider_atk1 =[ $attack101, outrider_atk2 ] {ai_face();};
void() outrider_atk2 =[ $attack102, outrider_atk3 ] {ai_face();};
void() outrider_atk3 =[ $attack103, outrider_atk4 ] {ai_face();};
void() outrider_atk4 =[ $attack104, outrider_atk5 ] {ai_face();};
void() outrider_atk5 =[ $attack105, outrider_atk6 ] {ai_face();};
void() outrider_atk6 =[ $attack106, outrider_atk7 ] {ai_face();};
void() outrider_atk7 =[ $attack107, outrider_atk8 ] {mercx_fire();};
void() outrider_atk8 =[ $attack108, outrider_atk9 ] {ai_face();};
void() outrider_atk9 =[ $attack109, outrider_run1 ] {ai_face();SUB_CheckRefire (outrider_atk1);};
//===========================================================================
void() outrider_paina1 =[ $pain101, outrider_paina2 ] {};
void() outrider_paina2 =[ $pain102, outrider_paina3 ] {};
void() outrider_paina3 =[ $pain103, outrider_paina4 ] {};
void() outrider_paina4 =[ $pain104, outrider_run1 ] {};
//===========================================================================
void() outrider_painb1 =[ $pain201, outrider_painb2 ] {};
void() outrider_painb2 =[ $pain202, outrider_painb3 ] {};
void() outrider_painb3 =[ $pain203, outrider_painb4 ] {};
void() outrider_painb4 =[ $pain204, outrider_painb5 ] {};
void() outrider_painb5 =[ $pain205, outrider_run1 ] {};
//===========================================================================
void() outrider_painc1 =[ $pain301, outrider_painc2 ] {};
void() outrider_painc2 =[ $pain302, outrider_painc3 ] {};
void() outrider_painc3 =[ $pain303, outrider_painc4 ] {};
void() outrider_painc4 =[ $pain304, outrider_painc5 ] {};
void() outrider_painc5 =[ $pain305, outrider_painc6 ] {};
void() outrider_painc6 =[ $pain306, outrider_painc7 ] {};
void() outrider_painc7 =[ $pain307, outrider_painc8 ] {};
void() outrider_painc8 =[ $pain308, outrider_painc9 ] {};
void() outrider_painc9 =[ $pain309, outrider_painc10 ] {};
void() outrider_painc10=[ $pain310, outrider_painc11 ] {};
void() outrider_painc11=[ $pain311, outrider_run1 ] {};
//===========================================================================
void() outrider_paind1 =[ $pain401, outrider_paind2 ] {};
void() outrider_paind2 =[ $pain402, outrider_paind3 ] {};
void() outrider_paind3 =[ $pain403, outrider_paind4 ] {};
void() outrider_paind4 =[ $pain404, outrider_paind5 ] {};
void() outrider_paind5 =[ $pain405, outrider_run1 ] {};
void(entity attacker, float damage) outrider_pain =
{
local float r;
if (self.pain_finished > time)
return;
//play random pain sound
outrider_painsound();
r = random();
if (r < 0.25)
outrider_paina1 ();
else if(r < 0.50)
outrider_painb1 ();
else if(r < 0.75)
outrider_painc1 ();
else
outrider_paind1 ();
self.pain_finished = time + 1;
};
//===========================================================================
void() outrider_diea1 =[ $death101, outrider_diea2 ] {};
void() outrider_diea2 =[ $death102, outrider_diea3 ] {};
void() outrider_diea3 =[ $death103, outrider_diea4 ] {self.solid = SOLID_NOT;};
void() outrider_diea4 =[ $death104, outrider_diea5 ] {};
void() outrider_diea5 =[ $death105, outrider_diea6 ] {};
void() outrider_diea6 =[ $death106, outrider_diea7 ] {};
void() outrider_diea7 =[ $death107, outrider_diea8 ] {};
void() outrider_diea8 =[ $death108, outrider_diea9 ] {};
void() outrider_diea9 =[ $death109, outrider_diea10 ] {};
void() outrider_diea10 =[ $death110, outrider_diea10 ] {banish_monster();};
//===========================================================================
void() outrider_dieb1 =[ $death201, outrider_dieb2 ] {};
void() outrider_dieb2 =[ $death202, outrider_dieb3 ] {};
void() outrider_dieb3 =[ $death203, outrider_dieb4 ] {self.solid = SOLID_NOT;};
void() outrider_dieb4 =[ $death204, outrider_dieb5 ] {};
void() outrider_dieb5 =[ $death205, outrider_dieb6 ] {};
void() outrider_dieb6 =[ $death206, outrider_dieb7 ] {};
void() outrider_dieb7 =[ $death207, outrider_dieb8 ] {};
void() outrider_dieb8 =[ $death208, outrider_dieb9 ] {};
void() outrider_dieb9 =[ $death209, outrider_dieb10 ] {};
void() outrider_dieb10 =[ $death210, outrider_dieb11 ] {};
void() outrider_dieb11 =[ $death211, outrider_dieb11 ] {banish_monster();};
//===========================================================================
void() outrider_diec1 =[ $death301, outrider_diec2 ] {};
void() outrider_diec2 =[ $death302, outrider_diec3 ] {};
void() outrider_diec3 =[ $death303, outrider_diec4 ] {self.solid = SOLID_NOT;};
void() outrider_diec4 =[ $death304, outrider_diec5 ] {};
void() outrider_diec5 =[ $death305, outrider_diec6 ] {};
void() outrider_diec6 =[ $death306, outrider_diec7 ] {};
void() outrider_diec7 =[ $death307, outrider_diec8 ] {};
void() outrider_diec8 =[ $death308, outrider_diec9 ] {};
void() outrider_diec9 =[ $death309, outrider_diec9 ] {banish_monster();};
void() outrider_die =
{
local float r;
r = random();
//play random death sound
outrider_deathsound();
if (r < 0.33)
outrider_diea1 ();
else if (r < 0.66)
outrider_dieb1 ();
else
outrider_diec1 ();
};
//===========================================================================
void() outrider_missile =
{
outrider_atk1();
};
void() outrider_alertsound =
{
local float r;
//pick one of 2 alert sounds
r = random();
if (r <= 0.5)
sound (self, CHAN_VOICE, "enemy/scout/alert1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enemy/scout/alert2.wav", 1, ATTN_NORM);
};
void() outrider_painsound =
{
local float r;
//pick one of 4 pain sounds
r = random();
if (r <= 0.25)
sound (self, CHAN_VOICE, "enemy/scout/pain1.wav", 1, ATTN_NORM);
else if (r <= 0.5)
sound (self, CHAN_VOICE, "enemy/scout/pain2.wav", 1, ATTN_NORM);
else if (r <= 0.75)
sound (self, CHAN_VOICE, "enemy/scout/pain3.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enemy/scout/pain4.wav", 1, ATTN_NORM);
};
void() outrider_deathsound =
{
local float r;
//pick one of 2 death sounds
r = random();
if (r <= 0.5)
sound (self, CHAN_VOICE, "enemy/scout/death1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enemy/scout/death2.wav", 1, ATTN_NORM);
};
//===========================================================================
void() outrider_precache =
{
//outrider graphics
precache_model ("models/enemies/outrider.md2");
//outrider sounds
precache_sound ("weapons/xbowfire.wav");
precache_sound ("weapons/holy/arrowb1.wav");
precache_sound ("enemy/scout/alert1.wav");
precache_sound ("enemy/scout/alert2.wav");
precache_sound ("enemy/scout/death1.wav");
precache_sound ("enemy/scout/death2.wav");
precache_sound ("enemy/scout/pain1.wav");
precache_sound ("enemy/scout/pain2.wav");
precache_sound ("enemy/scout/pain3.wav");
precache_sound ("enemy/scout/pain4.wav");
};
/*EWED monster_outrider (1 0 0) (-16 -16 -24) (16 16 40) Ambush
*/
void() monster_outrider =
{
local float r;
if (deathmatch)
{
remove(self);
return;
}
//if we are put in the level directly then call outrider_precache
if (self.classname != "monster_army")
outrider_precache();
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "models/enemies/outrider.md2");
setsize (self, '-16 -16 -24', '16 16 40');
// setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.health = set_health(45);
self.speed = set_speed(500);
self.dtype = 0; //dodge type sidestep
self.alpha = 1; //we aren't transparent
self.th_stand = outrider_stand1;
self.th_walk = outrider_walk1;
self.th_run = outrider_run1;
self.th_missile = outrider_missile;
self.th_pain = outrider_pain;
self.th_die = outrider_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_outrider";
//set up our monflag
self.monflag = "TRUE";
walkmonster_start ();
};
/*
=================
create_outriderbot
Creates an Outrider at the specified 'spot'.
This is used by demon portals in Flood Co-op.
=================
*/
void(vector spot) create_outriderbot =
{
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/outrider.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 = outrider_stand1;
bot.th_walk = outrider_walk1;
bot.th_run = outrider_run1;
bot.th_missile = outrider_missile;
bot.th_pain = outrider_pain;
bot.th_die = outrider_die;
bot.health = set_health(45);
bot.speed = set_speed(500);
bot.dtype = 0; //dodge type sidestep
bot.alpha = 1; //we aren't transparent
// polish him up
bot.classname = "monster_outrider";
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;
};