106 lines
No EOL
2.4 KiB
C++
106 lines
No EOL
2.4 KiB
C++
/*
|
|
=============================
|
|
ewbanish.qc
|
|
coded by
|
|
Michael Rogers a.k.a Xsniper
|
|
ssj_xsniper@yahoo.com
|
|
xsniper.virtualave.net
|
|
|
|
Description:
|
|
This file holds the code that banishes
|
|
the monsters from the world.
|
|
=============================
|
|
*/
|
|
|
|
void() banish_think =
|
|
{
|
|
//remove us from the world if we are done fading out
|
|
if (self.alpha <= 0.1 && self.classname != "demon_portal")
|
|
{
|
|
//if we are playing flood co-op then decrement num_mon_types
|
|
if (cvar("deathmatch") == 1)
|
|
num_mon_types = num_mon_types - 1;
|
|
remove(self);
|
|
}
|
|
else if (self.alpha <= 0.1 && self.classname == "demon_portal")
|
|
{
|
|
//make vectors
|
|
makevectors(self.angles);
|
|
|
|
//do some explosions before we head out
|
|
create_explosion((self.origin - (v_right * 20)),0.1,0,100);
|
|
create_explosion((self.origin + (v_right * 20)),0.2,0,100);
|
|
create_explosion((self.origin - (v_forward * 20)),0.3,0,100);
|
|
create_explosion((self.origin + (v_forward * 20)),0.4,0,100);
|
|
|
|
//reset num_portals
|
|
num_portals = 0;
|
|
|
|
//print a msg
|
|
bprint (self.enemy.netname);
|
|
if (random() <= 0.5)
|
|
bprint (" destroys the Demon Portal!\n");
|
|
else
|
|
bprint (" scores one for the team!\n");
|
|
|
|
//time to die
|
|
remove(self);
|
|
}
|
|
|
|
//we wan't to fade a little
|
|
self.alpha = self.alpha - 0.1;
|
|
|
|
//set up our next think
|
|
self.nextthink = time + 0.25;
|
|
self.think = banish_think;
|
|
};
|
|
|
|
/*
|
|
=====================
|
|
banish_monster
|
|
|
|
This function removes the entity that calls
|
|
it from the game after having that entity
|
|
fade out for about 2 seconds first.
|
|
=====================
|
|
*/
|
|
void() banish_monster =
|
|
{
|
|
//we are dying
|
|
self.deadflag = DEAD_DYING;
|
|
|
|
//if we are playing Flood Co-op then give the one who killed us a frag
|
|
if (cvar("deathmatch") == 1 && self.classname != "demon_portal")
|
|
{
|
|
if (self.enemy != world)
|
|
self.enemy.frags = self.enemy.frags + 1;
|
|
}
|
|
else if (cvar("deathmatch") == 1 && self.classname == "demon_portal")
|
|
{
|
|
if (self.enemy != world)
|
|
self.enemy.frags = self.enemy.frags + 15;
|
|
}
|
|
|
|
//play banish sound
|
|
sound (self, CHAN_VOICE, "misc/banish.wav", 1, ATTN_NORM);
|
|
|
|
//give the monster a new thought
|
|
self.nextthink = time + 0.5;
|
|
self.think = banish_think;
|
|
};
|
|
|
|
/*
|
|
==============
|
|
AmDead
|
|
|
|
Checks to see if self is dead and if so then it kills self properly.
|
|
==============
|
|
*/
|
|
void() AmDead =
|
|
{
|
|
if (self.health <= 0)
|
|
{
|
|
self.think = self.th_die;
|
|
self.nextthink = time + 0.1 + random();
|
|
}
|
|
}; |