• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling DeActivate monsters in Avesta

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,775
Solutions
25
Reaction score
483
Location
Sweden
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

Code:
if(targetList.empty()){
isActivated = false;
}
Something like this above

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:
Back
Top