- Joined
- Jan 30, 2004
- Messages
- 109
- Reaction score
- 0
I am trying to make the latest svn spawn npc from the spawn code from 6.4
I have it down to one error I can not fix
here it is
Here is the code in question
Here is the function ( I think tis what it is called )
Any help here is greatly appreciated
I have it down to one error I can not fix
here it is
Code:
Error 1 error C2660: 'CBaseEntity::isFaceing' : function does not take 1 arguments C:\Users\Josh\Desktop\pXi_r1430\src\CZoneHandler.cpp 356 1 PXI
Here is the code in question
Code:
if(mob->hasBehaviour(AGGRO_SIGHT) && mob->isFaceing(schar->loc.p)) { // and in view and not usign invis
if((CUtil::distance(schar->loc.p, mob->loc.p) <= 15 )) {
mob->aggroChar(schar);
Here is the function ( I think tis what it is called )
Code:
bool CBaseEntity::isFaceing(struct position p, int coneAngle) {
//Entity's true heading
unsigned char truerot = (unsigned char)this->getRot();
//Desired heading. Although it is extremely rare to have identical x or z coordinates, this should avoid division by 0.
if((p.x - this->loc.p.x) == 0) {
p.x += 0.001f;
}
if((p.z - this->loc.p.z) == 0) {
p.z += 0.001f;
}
float angle = atan2((p.z - this->loc.p.z),(p.x - this->loc.p.x)); //Arctangent of the slope of the line between entity and target.
unsigned char rot = (unsigned char) ((2 * 3.14159265358979f - angle) * 256 / (2 * 3.14159265358979f)); //Adjust from radians to SE's 256 degree system.
unsigned char diff = (unsigned char) (abs(truerot - rot)); //The absolute value of the deviation from desired heading.
if(diff <= coneAngle || diff >= (256 - coneAngle)) { //Allowed deviation. The second case is if the target is due east (compare 254 to 2 for example).
return true; //Within acceptable range.
}
return false; //Not within acceptable range.
}
Any help here is greatly appreciated

