ew-progs/ew/monsters/agath.qc

489 lines
18 KiB
C++
Raw Normal View History

2011-09-06 00:00:00 +00:00
/*
==============================================================================
Agath
coded by Michael Rogers a.k.a Xsniper
http://xsniper.virtualave.net/
some code done by iD software
==============================================================================
*/
$cd /models/enemies
$origin 0 0 32
$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
$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 idle303 idle304 idle305 idle306 idle307 idle308 idle309 idle310
$frame attack101 attack102 attack103 attack104 attack105 attack106 attack107 attack108 attack109 attack110
$frame attack201 attack202 attack203 attack204 attack205 attack206 attack207 attack208 attack209 attack210
$frame attack211
$frame pain101 pain102 pain103 pain104 pain105 pain106 pain107 pain108
$frame pain201 pain202 pain203 pain204 pain205 pain206 pain207
$frame emerge101 emerge102 emerge103 emerge104 emerge105 emerge106 emerge107 emerge108 emerge109 emerge110
$frame emerge111 emerge112 emerge113 emerge114 emerge115 emerge116 emerge117 emerge118 emerge119 emerge120
$frame emerge121 emerge122 emerge123 emerge124 emerge125 emerge126 emerge127 emerge128 emerge129 emerge130
void() agath_emerge1;
//============================================================================
void() agath_stand1 =[ $emerge130, agath_stand2 ]
{
ai_stand();
self.th_emerge = agath_emerge1;
};
void() agath_stand2 =[ $emerge129, agath_stand3 ] {ai_stand();};
void() agath_stand3 =[ $emerge128, agath_stand4 ] {ai_stand();};
void() agath_stand4 =[ $emerge127, agath_stand5 ] {ai_stand();};
void() agath_stand5 =[ $emerge126, agath_stand6 ] {ai_stand();};
void() agath_stand6 =[ $emerge125, agath_stand7 ] {ai_stand();};
void() agath_stand7 =[ $emerge124, agath_stand8 ] {ai_stand();};
void() agath_stand8 =[ $emerge123, agath_stand9 ] {ai_stand();};
void() agath_stand9 =[ $emerge122, agath_stand10 ] {ai_stand();};
void() agath_stand10 =[ $emerge121, agath_stand11 ] {ai_stand();};
void() agath_stand11 =[ $emerge120, agath_stand12 ] {ai_stand();};
void() agath_stand12 =[ $emerge119, agath_stand13 ] {ai_stand();};
void() agath_stand13 =[ $emerge118, agath_stand14 ] {ai_stand();};
void() agath_stand14 =[ $emerge117, agath_stand15 ] {ai_stand();};
void() agath_stand15 =[ $emerge116, agath_stand16 ] {ai_stand();};
void() agath_stand16 =[ $emerge115, agath_stand17 ] {ai_stand();};
void() agath_stand17 =[ $emerge114, agath_stand18 ] {ai_stand();};
void() agath_stand18 =[ $emerge113, agath_stand19 ] {ai_stand();};
void() agath_stand19 =[ $emerge112, agath_stand20 ] {ai_stand();};
void() agath_stand20 =[ $emerge111, agath_stand21 ] {ai_stand();};
void() agath_stand21 =[ $emerge110, agath_stand22 ] {ai_stand();};
void() agath_stand22 =[ $emerge109, agath_stand23 ] {ai_stand();};
void() agath_stand23 =[ $emerge108, agath_stand24 ] {ai_stand();};
void() agath_stand24 =[ $emerge107, agath_stand25 ] {ai_stand();};
void() agath_stand25 =[ $emerge106, agath_stand26 ] {ai_stand();};
void() agath_stand26 =[ $emerge105, agath_stand27 ] {ai_stand();};
void() agath_stand27 =[ $emerge104, agath_stand28 ] {ai_stand();};
void() agath_stand28 =[ $emerge103, agath_stand29 ] {ai_stand();};
void() agath_stand29 =[ $emerge102, agath_stand30 ] {ai_stand();};
void() agath_stand30 =[ $emerge101, agath_stand30 ]
{
ai_stand();
if (random() < 0.02)
sound (self, CHAN_VOICE, "enemy/agath/idle3.wav", 1, ATTN_NORM);
};
//============================================================================
void() agath_walk1 =[ $idle101, agath_walk2 ] {ai_walk(10);};
void() agath_walk2 =[ $idle102, agath_walk3 ] {ai_walk(9);};
void() agath_walk3 =[ $idle103, agath_walk4 ] {ai_walk(9);};
void() agath_walk4 =[ $idle104, agath_walk5 ] {ai_walk(5);};
void() agath_walk5 =[ $idle105, agath_walk6 ] {ai_walk(6);};
void() agath_walk6 =[ $idle106, agath_walk7 ] {ai_walk(12);};
void() agath_walk7 =[ $idle107, agath_walk8 ] {ai_walk(8);};
void() agath_walk8 =[ $idle108, agath_walk9 ] {ai_walk(3);};
void() agath_walk9 =[ $idle109, agath_walk10] {ai_walk(13);};
void() agath_walk10 =[ $idle110, agath_walk11] {ai_walk(9);};
void() agath_walk11 =[ $idle111, agath_walk12] {ai_walk(10);};
void() agath_walk12 =[ $idle112, agath_walk13] {ai_walk(9);};
void() agath_walk13 =[ $idle113, agath_walk14] {ai_walk(9);};
void() agath_walk14 =[ $idle114, agath_walk15] {ai_walk(5);};
void() agath_walk15 =[ $idle115, agath_walk16] {ai_walk(6);};
void() agath_walk16 =[ $idle116, agath_walk17] {ai_walk(12);};
void() agath_walk17 =[ $idle117, agath_walk18] {ai_walk(8);};
void() agath_walk18 =[ $idle118, agath_walk19] {ai_walk(3);};
void() agath_walk19 =[ $idle119, agath_walk20] {ai_walk(13);};
void() agath_walk20 =[ $idle120, agath_walk21] {ai_walk(9);};
void() agath_walk21 =[ $idle121, agath_walk22] {ai_walk(6);};
void() agath_walk22 =[ $idle122, agath_walk23] {ai_walk(12);};
void() agath_walk23 =[ $idle123, agath_walk24] {ai_walk(8);};
void() agath_walk24 =[ $idle124, agath_walk25] {ai_walk(3);};
void() agath_walk25 =[ $idle125, agath_walk1 ]
{
ai_walk(13);
if (random() > 0.95)
sound (self, CHAN_VOICE, "enemy/agath/idle3.wav", 1, ATTN_IDLE);
};
//============================================================================
void() agath_emerge1 =[ $emerge101, agath_emerge2 ] {};
void() agath_emerge2 =[ $emerge102, agath_emerge3 ] {};
void() agath_emerge3 =[ $emerge103, agath_emerge4 ] {};
void() agath_emerge4 =[ $emerge104, agath_emerge5 ] {};
void() agath_emerge5 =[ $emerge105, agath_emerge6 ] {};
void() agath_emerge6 =[ $emerge106, agath_emerge7 ] {};
void() agath_emerge7 =[ $emerge107, agath_emerge8 ] {};
void() agath_emerge8 =[ $emerge108, agath_emerge9 ] {};
void() agath_emerge9 =[ $emerge109, agath_emerge10 ] {};
void() agath_emerge10 =[ $emerge110, agath_emerge11 ] {};
void() agath_emerge11 =[ $emerge111, agath_emerge12 ] {};
void() agath_emerge12 =[ $emerge112, agath_emerge13 ] {};
void() agath_emerge13 =[ $emerge113, agath_emerge14 ] {};
void() agath_emerge14 =[ $emerge114, agath_emerge15 ] {};
void() agath_emerge15 =[ $emerge115, agath_emerge16 ] {};
void() agath_emerge16 =[ $emerge116, agath_emerge17 ] {};
void() agath_emerge17 =[ $emerge117, agath_emerge18 ] {};
void() agath_emerge18 =[ $emerge118, agath_emerge19 ] {};
void() agath_emerge19 =[ $emerge119, agath_emerge20 ] {};
void() agath_emerge20 =[ $emerge120, agath_emerge21 ] {};
void() agath_emerge21 =[ $emerge121, agath_emerge22 ] {};
void() agath_emerge22 =[ $emerge122, agath_emerge23 ] {};
void() agath_emerge23 =[ $emerge123, agath_emerge24 ] {};
void() agath_emerge24 =[ $emerge124, agath_emerge25 ] {};
void() agath_emerge25 =[ $emerge125, agath_emerge26 ] {};
void() agath_emerge26 =[ $emerge126, agath_emerge27 ] {};
void() agath_emerge27 =[ $emerge127, agath_emerge28 ] {};
void() agath_emerge28 =[ $emerge128, agath_emerge29 ] {};
void() agath_emerge29 =[ $emerge129, agath_emerge30 ] {};
void() agath_emerge30 =[ $emerge130, agath_run1 ] {self.th_emerge = self.th_run;};
//============================================================================
void() agath_run1 =[ $idle301, agath_run2 ] {ai_run(20);};
void() agath_run2 =[ $idle302, agath_run3 ] {ai_run(24);};
void() agath_run3 =[ $idle303, agath_run4 ] {ai_run(20);};
void() agath_run4 =[ $idle304, agath_run5 ] {ai_run(20);};
void() agath_run5 =[ $idle305, agath_run6 ] {ai_run(24);};
void() agath_run6 =[ $idle306, agath_run7 ] {ai_run(20);};
void() agath_run7 =[ $idle307, agath_run8 ] {ai_run(24);};
void() agath_run8 =[ $idle308, agath_run9 ] {ai_run(20);};
void() agath_run9 =[ $idle309, agath_run10 ] {ai_run(20);};
void() agath_run10 =[ $idle310, agath_run1 ]
{
ai_run(20);
if (random() > 0.95)
sound (self, CHAN_VOICE, "enemy/agath/idle3.wav", 1, ATTN_IDLE);
};
//============================================================================
void() agath_swingr1;
void(float side) agathClaw =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return;
ai_charge(10);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 20;
//Drain His Health
T_Damage (self.enemy, self, self, ldmg);
self.health = self.health + ldmg;
sound (self, CHAN_VOICE, "weapons/demon/clawhit.wav", 1, ATTN_NORM);
if (side)
{
makevectors (self.angles);
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
}
};
//============================================================================
void() agath_swingl1 =[ $attack201, agath_swingl2 ]
{
sound (self, CHAN_VOICE, "enemy/agath/idle1.wav", 1, ATTN_NORM);
ai_charge(5);
};
void() agath_swingl2 =[ $attack202, agath_swingl3 ] {ai_charge(3);};
void() agath_swingl3 =[ $attack203, agath_swingl4 ] {ai_charge(7);};
void() agath_swingl4 =[ $attack204, agath_swingl5 ] {ai_charge(3);};
void() agath_swingl5 =[ $attack205, agath_swingl6 ] {ai_charge(7);};
void() agath_swingl6 =[ $attack206, agath_swingl7 ] {ai_charge(9);};
void() agath_swingl7 =[ $attack207, agath_swingl8 ] {ai_charge(5); agathClaw(250);};
void() agath_swingl8 =[ $attack208, agath_swingl9 ] {ai_charge(4);};
void() agath_swingl9 =[ $attack209, agath_swingl10] {ai_charge(4);};
void() agath_swingl10 =[ $attack210, agath_swingl11] {ai_charge(4);};
void() agath_swingl11 =[ $attack211, agath_run1 ]
{
ai_charge(8);
if (random()<0.5)
self.think = agath_swingr1;
};
//============================================================================
void() agath_swingr1 =[ $attack101, agath_swingr2 ]
{
sound (self, CHAN_VOICE, "enemy/agath/idle1.wav", 1, ATTN_NORM);
ai_charge(1);
};
void() agath_swingr2 =[ $attack102, agath_swingr3 ] {ai_charge(8);};
void() agath_swingr3 =[ $attack103, agath_swingr4 ] {ai_charge(14);};
void() agath_swingr4 =[ $attack104, agath_swingr5 ] {ai_charge(7);};
void() agath_swingr5 =[ $attack105, agath_swingr6 ] {ai_charge(3);};
void() agath_swingr6 =[ $attack106, agath_swingr7 ] {ai_charge(6);};
void() agath_swingr7 =[ $attack107, agath_swingr8 ] {ai_charge(6); agathClaw(-250);};
void() agath_swingr8 =[ $attack108, agath_swingr9 ] {ai_charge(3);};
void() agath_swingr9 =[ $attack109, agath_swingr10] {ai_charge(3);};
void() agath_swingr10 =[ $attack110, agath_run1 ]
{
ai_charge(1);
ai_charge(10);
if (random()<0.5)
self.think = agath_swingl1;
};
void() agath_melee =
{
local float chance;
chance = random();
if (chance > 0.3)
agath_swingr1 ();
else
agath_swingl1 ();
};
//============================================================================
void() agathFireTouch =
{
if (other == self.owner)
return; // don't explode on owner
//set everything but the world on fire
if (other != world && random() <= 0.2)
{
other.onfire = 1;
other.burningtime = time + 2 + random() * 2;
other.burninflictor = self.owner;
}
T_RadiusDamage (self, self.owner, 40, world);
sound (self, CHAN_WEAPON, "weapons/demon/firehit.wav", 1, ATTN_NORM);
BecomeExplosion();
};
/*
================
CreateFire
================
*/
void(float side) CreateFire =
{
local entity fire;
fire = spawn ();
fire.owner = self;
fire.movetype = MOVETYPE_FLYMISSILE;
fire.solid = SOLID_BBOX;
fire.classname = "fireattack";
// set fire duration
fire.nextthink = time + 5;
fire.think = SUB_Remove;
makevectors (self.angles);
if (side == 0)
setorigin (fire, self.origin - (v_right * 31)); //31 units to his left
else if (side == 1)
setorigin (fire, self.origin + (v_right * 31)); //31 units to his right
setmodel (fire, "models/weapons/gfx/fireball.mdl");
setsize (fire, '0 0 0', '0 0 0');
//Tomaz special effects
fire.scale = 4; //quadruple the size
fire.glow_size = 250;
fire.glow_red = 1;
fire.glow_green = 0.5;
fire.glow_blue = 0;
// set fire speed
fire.velocity = normalize(self.enemy.origin - fire.origin);
fire.velocity = fire.velocity * 1000;
fire.angles = vectoangles(fire.velocity);
fire.touch = agathFireTouch;
};
//============================================================================
void() agath_firer1 =[ $attack101, agath_firer2 ] {ai_face();sound (self, CHAN_WEAPON, "enemy/agath/idle4.wav", 1, ATTN_NORM);};
void() agath_firer2 =[ $attack102, agath_firer3 ] {ai_face();};
void() agath_firer3 =[ $attack103, agath_firer4 ] {ai_face();};
void() agath_firer4 =[ $attack105, agath_firer5 ] {ai_face();CreateFire(1);};
void() agath_firer5 =[ $attack104, agath_firer6 ] {ai_face();};
void() agath_firer6 =[ $attack106, agath_firer9 ] {ai_face();CreateFire(1);};
void() agath_firer9 =[ $attack107, agath_firer10 ] {ai_face();};
void() agath_firer10 =[ $attack108, agath_firer11 ] {ai_face();};
void() agath_firer11 =[ $attack109, agath_firer12 ] {ai_face();};
void() agath_firer12 =[ $attack110, agath_firel1 ] {};
//============================================================================
void() agath_firel1 =[ $attack201, agath_firel2 ] {ai_face();sound (self, CHAN_WEAPON, "enemy/agath/idle4.wav", 1, ATTN_NORM);};
void() agath_firel2 =[ $attack202, agath_firel3 ] {ai_face();};
void() agath_firel3 =[ $attack203, agath_firel4 ] {ai_face();};
void() agath_firel4 =[ $attack205, agath_firel5 ] {ai_face();CreateFire(0);};
void() agath_firel5 =[ $attack104, agath_firel6 ] {ai_face();};
void() agath_firel6 =[ $attack206, agath_firel9 ] {ai_face();CreateFire(0);};
void() agath_firel9 =[ $attack207, agath_firel10 ] {ai_face();};
void() agath_firel10 =[ $attack208, agath_firel11 ] {ai_face();};
void() agath_firel11 =[ $attack209, agath_firel12 ] {ai_face();};
void() agath_firel12 =[ $attack210, agath_firel13 ] {ai_face();};
void() agath_firel13 =[ $attack211, agath_run1 ] {};
//============================================================================
void() agath_missile =
{
agath_firer1(); //agath does a fireball with his right arm first and then he fires one with his left arm
};
//============================================================================
void() agath_paina1 =[ $pain101, agath_paina2] {};
void() agath_paina2 =[ $pain102, agath_paina3] {};
void() agath_paina3 =[ $pain103, agath_paina4] {};
void() agath_paina4 =[ $pain104, agath_paina5] {};
void() agath_paina5 =[ $pain105, agath_paina6] {};
void() agath_paina6 =[ $pain106, agath_paina7] {};
void() agath_paina7 =[ $pain107, agath_paina8] {};
void() agath_paina8 =[ $pain108, agath_run1 ] {};
//============================================================================
void() agath_painb1 =[ $pain201, agath_painb2] {};
void() agath_painb2 =[ $pain202, agath_painb3] {};
void() agath_painb3 =[ $pain203, agath_painb4] {};
void() agath_painb4 =[ $pain204, agath_painb5] {};
void() agath_painb5 =[ $pain205, agath_painb6] {};
void() agath_painb6 =[ $pain206, agath_painb7] {};
void() agath_painb7 =[ $pain207, agath_run1 ] {};
void(entity attacker, float damage) agath_pain =
{
local float r;
sound (self, CHAN_VOICE, "enemy/agath/tpain.wav", 1, ATTN_NORM);
if (self.health <= 0)
return; // already dying, don't go into pain frame
if (random()*400 > damage)
return; // didn't flinch
if (self.pain_finished > time)
return;
self.pain_finished = time + 2;
r = floor(random() * 1);
if (r == 0)
agath_paina1 ();
else
agath_painb1 ();
};
//============================================================================
void() agath_die =
{
//couple other things that seem important...
self.solid = SOLID_NOT;
//temporary fix to lack of agath dieing animation, we'll just do an explosion for now
T_RadiusDamage (self, self, 120, world);
if (random() <= 0.5)
sound (self, CHAN_VOICE, "enemy/agath/tdeath1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enemy/agath/tdeath2.wav", 1, ATTN_NORM);
self.origin = self.origin - 8*normalize(self.velocity);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_TAREXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
BecomeExplosion ();
};
//============================================================================
/*QUAKED monster_agath (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_agath =
{
if (deathmatch)
{
remove(self);
return;
}
precache_model ("models/enemies/agath.md2");
precache_model ("models/weapons/gfx/fireball.mdl");
//agath sounds
precache_sound ("enemy/agath/idle1.wav");
precache_sound ("enemy/agath/idle2.wav");
precache_sound ("enemy/agath/idle3.wav");
precache_sound ("enemy/agath/idle4.wav");
precache_sound ("weapons/demon/firehit.wav");
precache_sound ("weapons/demon/clawhit.wav");
precache_sound ("weapons/lock4.wav"); //used for missile touch function
precache_sound ("enemy/agath/sec.wav");
precache_sound ("enemy/agath/tdeath1.wav");
precache_sound ("enemy/agath/tdeath2.wav");
precache_sound ("enemy/agath/tpain.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "models/enemies/agath.md2");
setsize (self, '-32 -32 -24', '32 32 64');
// setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.health = set_health(600);
self.speed = set_speed(10);
self.dtype = 4; //dodge type do nothing
self.th_stand = agath_stand1;
self.th_walk = agath_walk1;
self.th_run = agath_run1;
self.th_die = agath_die;
self.th_melee = agath_melee;
self.th_missile = agath_missile;
self.th_pain = agath_pain;
//my new classname is?
self.classname = "monster_agath";
//set up our monflag
self.monflag = "TRUE";
//difficulty optimization
remove_monster();
walkmonster_start();
};