ew-progs/ew/monsters/carniv.qc

504 lines
20 KiB
C++
Raw Permalink Normal View History

2011-09-06 00:00:00 +00:00
/*
==============================================================================
Carnivore
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
$frame idle201 idle202 idle203 idle204 idle205 idle206 idle207 idle208 idle209 idle210
$frame idle211 idle212 idle213 idle214 idle215 idle216 idle217 idle218 idle219 idle220
$frame idle221 idle222 idle223 idle224 idle225 idle226 idle227 idle228 idle229 idle230
$frame idle231 idle232 idle233 idle234 idle235 idle236 idle237 idle238 idle239
$frame idle301 idle302 idle303 idle304 idle305 idle306
$frame walk01 walk02 walk03 walk04 walk05 walk06 walk07 walk08 walk09 walk10
$frame walk11 walk12
$frame attack101 attack102 attack103 attack104 attack105 attack106 attack107 attack108
$frame attack201 attack202 attack203 attack204 attack205 attack206 attack207 attack208 attack209 attack210
$frame attack211
$frame pain101 pain102 pain103 pain104 pain105 pain106
$frame pain201 pain202 pain203 pain204 pain205
$frame pain301 pain302 pain303 pain304 pain305 pain306 pain307 pain308 pain309 pain310
$frame pain311
$frame death101 death102 death103 death104 death105 death106 death107 death108 death109 death110
$frame death111 death112 death113 death114 death115 death015 death117 death118 death119 death120
$frame death121 death122 death123 death124 death125 death126 death127 death128 death129 death130
$frame death131
$frame death201 death202 death203 death204 death205 death206 death207 death208 death209 death210
$frame death211 death212 death213 death214 death215 death216 death217 death218 death219 death220
$frame death221 death222 death223 death224 death225 death226 death227 death228 death229 death230
$frame death231 death232 death233 death234 death235 death236 death237 death238 death239 death240
//=============================================================================
void() carnivFireTouch =
{
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);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
BecomeExplosion();
};
/*
================
CreateFireball
================
*/
void(vector spot) CreateFireball =
{
local entity fire;
fire = spawn ();
fire.owner = self;
fire.movetype = MOVETYPE_FLYMISSILE;
fire.solid = SOLID_BBOX;
fire.classname = "fireball";
// set fire duration
fire.nextthink = time + 5;
fire.think = carnivFireTouch;
makevectors (self.angles);
setorigin (fire, self.origin - spot); //28 units to his left
setmodel (fire, "models/weapons/gfx/fireball.mdl");
setsize (fire, '0 0 0', '0 0 0');
//Tomaz special effects
fire.scale = 3; //triple 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 * 600;
fire.angles = vectoangles(fire.velocity);
fire.touch = carnivFireTouch;
};
void() carniv_idlesound;
void() carniv_step;
//=============================================================================
void() carniv_stand1 =[ $idle101, carniv_stand2 ] {ai_stand();carniv_idlesound();};
void() carniv_stand2 =[ $idle102, carniv_stand3 ] {ai_stand();};
void() carniv_stand3 =[ $idle103, carniv_stand4 ] {ai_stand();};
void() carniv_stand4 =[ $idle104, carniv_stand5 ] {ai_stand();};
void() carniv_stand5 =[ $idle105, carniv_stand6 ] {ai_stand();};
void() carniv_stand6 =[ $idle106, carniv_stand7 ] {ai_stand();};
void() carniv_stand7 =[ $idle107, carniv_stand8 ] {ai_stand();};
void() carniv_stand8 =[ $idle108, carniv_stand9 ] {ai_stand();};
void() carniv_stand9 =[ $idle109, carniv_stand10 ] {ai_stand();};
void() carniv_stand10 =[ $idle201, carniv_stand11 ] {ai_stand();};
void() carniv_stand11 =[ $idle202, carniv_stand12 ] {ai_stand();};
void() carniv_stand12 =[ $idle203, carniv_stand13 ] {ai_stand();};
void() carniv_stand13 =[ $idle204, carniv_stand14 ] {ai_stand();};
void() carniv_stand14 =[ $idle205, carniv_stand15 ] {ai_stand();};
void() carniv_stand15 =[ $idle206, carniv_stand16 ] {ai_stand();};
void() carniv_stand16 =[ $idle207, carniv_stand17 ] {ai_stand();};
void() carniv_stand17 =[ $idle208, carniv_stand18 ] {ai_stand();};
void() carniv_stand18 =[ $idle209, carniv_stand19 ] {ai_stand();};
void() carniv_stand19 =[ $idle210, carniv_stand20 ] {ai_stand();};
void() carniv_stand20 =[ $idle211, carniv_stand21 ] {ai_stand();};
void() carniv_stand21 =[ $idle212, carniv_stand22 ] {ai_stand();};
void() carniv_stand22 =[ $idle213, carniv_stand23 ] {ai_stand();};
void() carniv_stand23 =[ $idle214, carniv_stand24 ] {ai_stand();};
void() carniv_stand24 =[ $idle215, carniv_stand25 ] {ai_stand();};
void() carniv_stand25 =[ $idle216, carniv_stand26 ] {ai_stand();};
void() carniv_stand26 =[ $idle217, carniv_stand27 ] {ai_stand();};
void() carniv_stand27 =[ $idle218, carniv_stand28 ] {ai_stand();};
void() carniv_stand28 =[ $idle219, carniv_stand29 ] {ai_stand();};
void() carniv_stand29 =[ $idle220, carniv_stand30 ] {ai_stand();};
void() carniv_stand30 =[ $idle221, carniv_stand31 ] {ai_stand();};
void() carniv_stand31 =[ $idle222, carniv_stand32 ] {ai_stand();};
void() carniv_stand32 =[ $idle223, carniv_stand33 ] {ai_stand();};
void() carniv_stand33 =[ $idle224, carniv_stand34 ] {ai_stand();};
void() carniv_stand34 =[ $idle225, carniv_stand35 ] {ai_stand();};
void() carniv_stand35 =[ $idle226, carniv_stand36 ] {ai_stand();};
void() carniv_stand36 =[ $idle227, carniv_stand37 ] {ai_stand();};
void() carniv_stand37 =[ $idle228, carniv_stand38 ] {ai_stand();};
void() carniv_stand38 =[ $idle229, carniv_stand39 ] {ai_stand();};
void() carniv_stand39 =[ $idle230, carniv_stand40 ] {ai_stand();};
void() carniv_stand40 =[ $idle231, carniv_stand41 ] {ai_stand();};
void() carniv_stand41 =[ $idle232, carniv_stand42 ] {ai_stand();};
void() carniv_stand42 =[ $idle233, carniv_stand43 ] {ai_stand();};
void() carniv_stand43 =[ $idle234, carniv_stand44 ] {ai_stand();};
void() carniv_stand44 =[ $idle235, carniv_stand45 ] {ai_stand();};
void() carniv_stand45 =[ $idle236, carniv_stand46 ] {ai_stand();};
void() carniv_stand46 =[ $idle237, carniv_stand47 ] {ai_stand();};
void() carniv_stand47 =[ $idle238, carniv_stand48 ] {ai_stand();};
void() carniv_stand48 =[ $idle239, carniv_stand49 ] {ai_stand();};
void() carniv_stand49 =[ $idle301, carniv_stand50 ] {ai_stand();};
void() carniv_stand50 =[ $idle302, carniv_stand51 ] {ai_stand();};
void() carniv_stand51 =[ $idle303, carniv_stand52 ] {ai_stand();};
void() carniv_stand52 =[ $idle304, carniv_stand53 ] {ai_stand();};
void() carniv_stand53 =[ $idle305, carniv_stand54 ] {ai_stand();};
void() carniv_stand54 =[ $idle306, carniv_stand1 ] {ai_stand();};
//=============================================================================
void() carniv_walk1 =[ $walk01, carniv_walk2 ] {ai_walk(3);carniv_step();};
void() carniv_walk2 =[ $walk02, carniv_walk3 ] {ai_walk(2);};
void() carniv_walk3 =[ $walk03, carniv_walk4 ] {ai_walk(2);carniv_idlesound();};
void() carniv_walk4 =[ $walk04, carniv_walk5 ] {ai_walk(2);};
void() carniv_walk5 =[ $walk05, carniv_walk6 ] {ai_walk(2);};
void() carniv_walk6 =[ $walk06, carniv_walk7 ] {ai_walk(5);};
void() carniv_walk7 =[ $walk07, carniv_walk8 ] {ai_walk(3);carniv_step();};
void() carniv_walk8 =[ $walk08, carniv_walk9 ] {ai_walk(2);};
void() carniv_walk9 =[ $walk09, carniv_walk10 ] {ai_walk(3);};
void() carniv_walk10 =[ $walk10, carniv_walk11 ] {ai_walk(1);};
void() carniv_walk11 =[ $walk11, carniv_walk12 ] {ai_walk(2);};
void() carniv_walk12 =[ $walk12, carniv_walk1 ] {ai_walk(3);};
//=============================================================================
void() carniv_run1 =[ $walk01, carniv_run2 ] {ai_run(9);carniv_idlesound();carniv_step();};
void() carniv_run2 =[ $walk02, carniv_run3 ] {ai_run(12);};
void() carniv_run3 =[ $walk03, carniv_run4 ] {ai_run(8);};
void() carniv_run4 =[ $walk04, carniv_run5 ] {ai_run(22);};
void() carniv_run5 =[ $walk05, carniv_run6 ] {ai_run(16);};
void() carniv_run6 =[ $walk06, carniv_run7 ] {ai_run(4);};
void() carniv_run7 =[ $walk07, carniv_run8 ] {ai_run(13);carniv_step();};
void() carniv_run8 =[ $walk08, carniv_run9 ] {ai_run(24);};
void() carniv_run9 =[ $walk09, carniv_run10 ] {ai_run(8);};
void() carniv_run10 =[ $walk10, carniv_run11 ] {ai_run(22);};
void() carniv_run11 =[ $walk11, carniv_run12 ] {ai_run(16);};
void() carniv_run12 =[ $walk12, carniv_run1 ] {ai_run(4);};
//=============================================================================
void() carniv_swing1 =[ $attack201, carniv_swing2 ] {ai_charge(11);};
void() carniv_swing2 =[ $attack202, carniv_swing3 ] {ai_charge(5);};
void() carniv_swing3 =[ $attack203, carniv_swing4 ] {ai_charge(4);ai_melee();};
void() carniv_swing4 =[ $attack204, carniv_swing5 ] {ai_charge(9);ai_melee();};
void() carniv_swing5 =[ $attack205, carniv_swing6 ] {ai_charge(12);ai_melee();};
void() carniv_swing6 =[ $attack206, carniv_swing7 ] {ai_charge(7);ai_melee();};
void() carniv_swing7 =[ $attack207, carniv_swing8 ] {ai_charge(6);ai_melee();};
void() carniv_swing8 =[ $attack208, carniv_swing9 ] {ai_charge(13);ai_melee();};
void() carniv_swing9 =[ $attack209, carniv_swing10 ] {ai_charge(5);ai_melee();};
void() carniv_swing10 =[ $attack210, carniv_swing11 ] {ai_charge(10);};
void() carniv_swing11 =[ $attack211, carniv_run1 ] {ai_charge(9);};
//=============================================================================
void() carniv_fire1 =[ $attack101, carniv_fire2 ] {ai_face();};
void() carniv_fire2 =[ $attack102, carniv_fire3 ] {ai_face();};
void() carniv_fire3 =[ $attack103, carniv_fire4 ] {ai_face();};
void() carniv_fire4 =[ $attack104, carniv_fire5 ] {ai_face();};
void() carniv_fire5 =[ $attack105, carniv_fire6 ] {ai_face();CreateFireball((v_right * 28) - '0 0 10');};
void() carniv_fire6 =[ $attack106, carniv_fire7 ] {ai_face();};
void() carniv_fire7 =[ $attack107, carniv_fire8 ] {ai_face();};
void() carniv_fire8 =[ $attack108, carniv_run1 ] {ai_face();};
//=============================================================================
void() carniv_pain1 =[ $pain101, carniv_pain2 ] {};
void() carniv_pain2 =[ $pain102, carniv_pain3 ] {};
void() carniv_pain3 =[ $pain103, carniv_pain4 ] {};
void() carniv_pain4 =[ $pain104, carniv_pain5 ] {};
void() carniv_pain5 =[ $pain105, carniv_pain6 ] {};
void() carniv_pain6 =[ $pain106, carniv_run1 ] {};
//=============================================================================
void() carniv_painb1 =[ $pain201, carniv_painb2 ] {};
void() carniv_painb2 =[ $pain202, carniv_painb3 ] {};
void() carniv_painb3 =[ $pain203, carniv_painb4 ] {};
void() carniv_painb4 =[ $pain204, carniv_painb5 ] {};
void() carniv_painb5 =[ $pain205, carniv_run1 ] {};
//=============================================================================
void() carniv_painc1 =[ $pain301, carniv_painc2 ] {};
void() carniv_painc2 =[ $pain302, carniv_painc3 ] {};
void() carniv_painc3 =[ $pain303, carniv_painc4 ] {};
void() carniv_painc4 =[ $pain304, carniv_painc5 ] {};
void() carniv_painc5 =[ $pain305, carniv_painc6 ] {};
void() carniv_painc6 =[ $pain306, carniv_painc7 ] {};
void() carniv_painc7 =[ $pain307, carniv_painc8 ] {};
void() carniv_painc8 =[ $pain308, carniv_painc9 ] {};
void() carniv_painc9 =[ $pain309, carniv_painc10 ] {};
void() carniv_painc10 =[ $pain310, carniv_painc11 ] {};
void() carniv_painc11 =[ $pain311, carniv_run1 ] {};
//=============================================================================
float carniv_pain_type;
void(entity attacker, float damage) carniv_pain =
{
local float r;
// don't make multiple pain sounds right after each other
if (self.pain_finished > time)
return;
//controls which pain animation to show
carniv_pain_type = carniv_pain_type + 1;
if (carniv_pain_type == 1)
{
sound (self, CHAN_VOICE, "enemy/carnivean/pain.wav", 1, ATTN_NORM);
carniv_pain1 ();
self.pain_finished = time + 1;
}
else if (carniv_pain_type == 2)
{
sound (self, CHAN_VOICE, "enemy/carnivean/pain.wav", 1, ATTN_NORM);
carniv_painb1 ();
self.pain_finished = time + 1;
}
else if (carniv_pain_type == 3)
{
sound (self, CHAN_VOICE, "enemy/carnivean/car_pn1.wav", 1, ATTN_NORM);
carniv_painc1 ();
self.pain_finished = time + 1;
carniv_pain_type = 0;
}
};
//=============================================================================
void() carniv_die1 =[ $death101, carniv_die2 ] {};
void() carniv_die2 =[ $death102, carniv_die3 ] {};
void() carniv_die3 =[ $death103, carniv_die4 ] {self.solid = SOLID_NOT;};
void() carniv_die4 =[ $death104, carniv_die5 ] {};
void() carniv_die5 =[ $death105, carniv_die6 ] {};
void() carniv_die6 =[ $death106, carniv_die7 ] {};
void() carniv_die7 =[ $death107, carniv_die8 ] {};
void() carniv_die8 =[ $death108, carniv_die9 ] {};
void() carniv_die9 =[ $death109, carniv_die10 ] {};
void() carniv_die10 =[ $death110, carniv_die11 ] {};
void() carniv_die11 =[ $death111, carniv_die12 ] {};
void() carniv_die12 =[ $death112, carniv_die13 ] {};
void() carniv_die13 =[ $death113, carniv_die14 ] {};
void() carniv_die14 =[ $death114, carniv_die15 ] {};
void() carniv_die15 =[ $death115, carniv_die16 ] {};
void() carniv_die16 =[ $death015, carniv_die17 ] {};
void() carniv_die17 =[ $death117, carniv_die18 ] {};
void() carniv_die18 =[ $death118, carniv_die19 ] {};
void() carniv_die19 =[ $death119, carniv_die20 ] {};
void() carniv_die20 =[ $death120, carniv_die21 ] {};
void() carniv_die21 =[ $death121, carniv_die22 ] {};
void() carniv_die22 =[ $death122, carniv_die23 ] {};
void() carniv_die23 =[ $death123, carniv_die24 ] {};
void() carniv_die24 =[ $death124, carniv_die25 ] {};
void() carniv_die25 =[ $death125, carniv_die26 ] {};
void() carniv_die26 =[ $death126, carniv_die27 ] {};
void() carniv_die27 =[ $death127, carniv_die28 ] {};
void() carniv_die28 =[ $death128, carniv_die29 ] {};
void() carniv_die29 =[ $death129, carniv_die30 ] {};
void() carniv_die30 =[ $death130, carniv_die31 ] {};
void() carniv_die31 =[ $death131, carniv_die31 ] {banish_monster();};
//=============================================================================
void() carniv_bdie1 =[ $death201, carniv_bdie2 ] {};
void() carniv_bdie2 =[ $death202, carniv_bdie3 ] {};
void() carniv_bdie3 =[ $death203, carniv_bdie4 ] {self.solid = SOLID_NOT;};
void() carniv_bdie4 =[ $death204, carniv_bdie5 ] {};
void() carniv_bdie5 =[ $death205, carniv_bdie6 ] {};
void() carniv_bdie6 =[ $death206, carniv_bdie7 ] {};
void() carniv_bdie7 =[ $death207, carniv_bdie8 ] {};
void() carniv_bdie8 =[ $death208, carniv_bdie9 ] {};
void() carniv_bdie9 =[ $death209, carniv_bdie10 ] {};
void() carniv_bdie10 =[ $death210, carniv_bdie11 ] {};
void() carniv_bdie11 =[ $death211, carniv_bdie12 ] {};
void() carniv_bdie12 =[ $death212, carniv_bdie13 ] {};
void() carniv_bdie13 =[ $death213, carniv_bdie14 ] {};
void() carniv_bdie14 =[ $death214, carniv_bdie15 ] {};
void() carniv_bdie15 =[ $death215, carniv_bdie16 ] {};
void() carniv_bdie16 =[ $death216, carniv_bdie17 ] {};
void() carniv_bdie17 =[ $death217, carniv_bdie18 ] {};
void() carniv_bdie18 =[ $death218, carniv_bdie19 ] {};
void() carniv_bdie19 =[ $death219, carniv_bdie20 ] {};
void() carniv_bdie20 =[ $death220, carniv_bdie21 ] {};
void() carniv_bdie21 =[ $death221, carniv_bdie22 ] {};
void() carniv_bdie22 =[ $death222, carniv_bdie23 ] {};
void() carniv_bdie23 =[ $death223, carniv_bdie24 ] {};
void() carniv_bdie24 =[ $death224, carniv_bdie25 ] {};
void() carniv_bdie25 =[ $death225, carniv_bdie26 ] {};
void() carniv_bdie26 =[ $death226, carniv_bdie27 ] {};
void() carniv_bdie27 =[ $death227, carniv_bdie28 ] {};
void() carniv_bdie28 =[ $death228, carniv_bdie29 ] {};
void() carniv_bdie29 =[ $death229, carniv_bdie30 ] {};
void() carniv_bdie30 =[ $death230, carniv_bdie31 ] {};
void() carniv_bdie31 =[ $death231, carniv_bdie32 ] {};
void() carniv_bdie32 =[ $death232, carniv_bdie33 ] {};
void() carniv_bdie33 =[ $death233, carniv_bdie34 ] {};
void() carniv_bdie34 =[ $death234, carniv_bdie35 ] {};
void() carniv_bdie35 =[ $death235, carniv_bdie36 ] {};
void() carniv_bdie36 =[ $death236, carniv_bdie37 ] {};
void() carniv_bdie37 =[ $death237, carniv_bdie38 ] {};
void() carniv_bdie38 =[ $death238, carniv_bdie39 ] {};
void() carniv_bdie39 =[ $death239, carniv_bdie40 ] {};
void() carniv_bdie40 =[ $death240, carniv_bdie40 ] {banish_monster();};
//=============================================================================
void() carniv_die =
{
if (random() < 0.5)
{
sound (self, CHAN_VOICE, "enemy/carnivean/death1.wav", 1, ATTN_NORM);
carniv_die1 ();
}
else
{
sound (self, CHAN_VOICE, "enemy/carnivean/death2.wav", 1, ATTN_NORM);
carniv_bdie1 ();
}
};
void() carniv_melee =
{
sound (self, CHAN_VOICE, "enemy/carnivean/miss.wav", 1, ATTN_NORM);
carniv_swing1 ();
};
void() carniv_missile =
{
//Don't rely on fireball attack too much
if (random() <= 0.65)
{
sound (self, CHAN_VOICE, "enemy/carnivean/scream.wav", 1, ATTN_NORM);
carniv_fire1 ();
}
}
void() carniv_idlesound =
{
local float r;
if (random() <= 0.2)
{
r = random();
if (r <= 0.3)
sound (self, CHAN_VOICE, "enemy/carnivean/idle.wav", 1, ATTN_NORM);
else if (r <= 0.6)
sound (self, CHAN_VOICE, "enemy/carnivean/taunt1.wav", 1, ATTN_NORM);
else
sound (self, CHAN_VOICE, "enemy/carnivean/taunt2.wav", 1, ATTN_NORM);
}
};
float carniv_stepsound;
void() carniv_step =
{
//play step sounds in sequence, step1, step2, step1, step2, etc
carniv_stepsound = carniv_stepsound + 1;
if (carniv_stepsound == 1)
sound (self, CHAN_WEAPON, "enemy/carnivean/step2.wav", 1, ATTN_NORM);
else
{
sound (self, CHAN_WEAPON, "enemy/carnivean/step.wav", 1, ATTN_NORM);
carniv_stepsound = 0;
}
};
//=============================================================================
/*QUAKED monster_carnivore (1 0 0) (-32 -32 -24) (32 32 64) Ambush
*/
void() monster_carnivore =
{
if (deathmatch)
{
remove(self);
return;
}
precache_model ("models/enemies/carniv.md2");
precache_model ("models/weapons/gfx/fireball.mdl");
precache_sound ("enemy/carnivean/alert.wav");
precache_sound ("enemy/carnivean/car_pn1.wav");
precache_sound ("enemy/carnivean/death1.wav");
precache_sound ("enemy/carnivean/death2.wav");
precache_sound ("enemy/carnivean/idle.wav");
precache_sound ("enemy/carnivean/miss.wav");
precache_sound ("enemy/carnivean/pain.wav");
precache_sound ("enemy/carnivean/scream.wav");
precache_sound ("enemy/carnivean/step2.wav");
precache_sound ("enemy/carnivean/step.wav");
precache_sound ("enemy/carnivean/taunt1.wav");
precache_sound ("enemy/carnivean/taunt2.wav");
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "models/enemies/carniv.md2");
setsize (self, '-32 -32 -24', '32 32 64');
// setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.health = set_health(200);
self.speed = set_speed(100);
self.dtype = 1; //dodge type back_strafe
self.alpha = 1; //we aren't transparent
self.th_stand = carniv_stand1;
self.th_walk = carniv_walk1;
self.th_run = carniv_run1;
self.th_die = carniv_die;
self.th_melee = carniv_melee;
self.th_missile = carniv_missile;
self.th_pain = carniv_pain;
//my new classname is?
self.classname = "monster_carnivore";
//set up our monflag
self.monflag = "TRUE";
walkmonster_start();
};