by redrum » Sun Apr 26, 2009 9:37 pm
Here's the code:
float() FindTarget =
{
local entity client;
local float r;
local vector dist;
dist = self.enemy.origin - self.origin;
// if the first spawnflag bit is set, the monster will only wake up on
// really seeing the player, not another monster getting angry
// spawnflags & 3 is a big hack, because zombie crucified used the first
// spawn flag prior to the ambush flag, and I forgot about it, so the second
// spawn flag works as well
if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3) )
{
client = sight_entity;
if (client.enemy == self.enemy)
return;
}
else
{
client = checkclient ();
if (!client)
return FALSE; // current check entity isn't in PVS
}
if (client == self.enemy)
return FALSE;
if (client.flags & FL_NOTARGET)
return FALSE;
if (client.items & IT_INVISIBILITY)
return FALSE;
r = range (client);
if (r == RANGE_FAR)
return FALSE;
if (!visible (client))
return FALSE;
if (r == RANGE_NEAR)
{
if (client.show_hostile < time && !infront (client))
return FALSE;
}
else if (r == RANGE_MID)
{
if ( /* client.show_hostile < time || */ !infront (client))
return FALSE;
}
self.enemy = client;
if (self.enemy.classname != "player")
{
self.enemy = self.enemy.enemy;
if (self.enemy.classname != "player")
{
self.enemy = world;
return FALSE;
}
}
FoundTarget ();
if (self.health <= 35) // make the blood
Bleeding1(self);
return TRUE;
if (self.watertype == CONTENT_LAVA) // do lava damage
T_Damage (self, world, world, 10*self.waterlevel);
if (self.watertype == CONTENT_SLIME) // do slime damage
T_Damage (self, world, world, 6*self.waterlevel);
if (self.watertype == CONTENT_WATER) // do water damage
T_Damage (self, world, world, 3*self.waterlevel);
};[code]
I'm an average coder, this seemingly simple task is driving me nutz!
I've tried numerous code changes to no avail.
Can someone please point me in the right direction. Thanks.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc