ond
Veteran OT User
I wonder if someone could help me figure out how to deactivate monster in avesta when:
You are not on the same floor or in their targetList
Something like this above
Also, the monsters should Not deactivate when player is invisible!
Thanks in advance
SOLVED by Dalkon:
Change this:
To this:
You are not on the same floor or in their targetList
Code:
if(targetList.empty()){
isActivated = false;
}
Also, the monsters should Not deactivate when player is invisible!
Thanks in advance
SOLVED by Dalkon:
Change this:
Code:
bool Creature::canSee(const Position& myPos, const Position& pos, uint32_t viewRangeX, uint32_t viewRangeY)
{
if(myPos.z <= 7){
//we are on ground level or above (7 -> 0)
//view is from 7 -> 0
if(pos.z > 7){
return false;
}
}
else if(myPos.z >= 8){
//we are underground (8 -> 15)
//view is +/- 2 from the floor we stand on
if(std::abs(myPos.z - pos.z) > 2){
return false;
}
}
int offsetz = myPos.z - pos.z;
if ((pos.x >= myPos.x - viewRangeX + offsetz) && (pos.x <= myPos.x + viewRangeX + offsetz) &&
(pos.y >= myPos.y - viewRangeY + offsetz) && (pos.y <= myPos.y + viewRangeY + offsetz))
return true;
return false;
}
To this:
Code:
bool Creature::canSee(const Position& myPos, const Position& pos, uint32_t viewRangeX, uint32_t viewRangeY)
{
if(myPos.z <= 7){
//we are on ground level or above (7 -> 0)
//view is from 7 -> 0
if(pos.z > 7){
return false;
}
}
else if(myPos.z >= 8){
//we are underground (8 -> 15)
//view is +/- 2 from the floor we stand on
if(std::abs(myPos.z - pos.z) > 2){
return false;
}
}
if ((pos.x >= myPos.x - viewRangeX) && (pos.x <= myPos.x + viewRangeX) &&
(pos.y >= myPos.y - viewRangeY) && (pos.y <= myPos.y + viewRangeY) && pos.z == myPos.z)
return true;
return false;
}
Last edited: