• 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!

Monster area view

rashas

New Member
Joined
Sep 28, 2008
Messages
45
Reaction score
0
Hello, I got a question. How to change the radius of monster's view? For example. Monster attack player when he is 4 squares front of him,and I want change it for 10 squares (it's an example ofc.) I think so it should be in c++. But how?
 
You can change it in your file with monster (OTS/data/monsters/your monster.xml) then find it:
Code:
    <flag targetdistance="[COLOR="Blue"]1[/COLOR]"/>
Blue: here you can change your distance monster to player
 
You can change it in your file with monster (OTS/data/monsters/your monster.xml) then find it:
Code:
    <flag targetdistance="[COLOR="Blue"]1[/COLOR]"/>
Blue: here you can change your distance monster to player
It's not what I wanted (anyway rep++) ,I made a wrong sentence. Uhm. I wanted to edit the radius of entering into combat with monster.

For now: when the monster SEE player - it attacks him. But I want to so monster attack player ONLY if he is in radius of 2 squares.
 
you would have to edit this in map.cpp:
Code:
const SpectatorVec& Map::getSpectators(const Position& centerPos)
{
	if(centerPos.z >= MAP_MAX_LAYERS)
	{
		boost::shared_ptr<SpectatorVec> p(new SpectatorVec());
		SpectatorVec& list = *p;
		return list;
	}

	SpectatorCache::iterator it = spectatorCache.find(centerPos);
	if(it != spectatorCache.end())
		return *it->second;

	boost::shared_ptr<SpectatorVec> p(new SpectatorVec());
	spectatorCache[centerPos] = p;
	SpectatorVec& list = *p;

	int32_t [B][COLOR="Red"]minRangeX = -maxViewportX, maxRangeX = maxViewportX, minRangeY = -maxViewportY,
		maxRangeY = maxViewportY[/COLOR][/B], minRangeZ, maxRangeZ;
	if(centerPos.z > 7)
	{
		//underground, 8->15
		minRangeZ = std::max(centerPos.z - 2, 0);
		maxRangeZ = std::min(centerPos.z + 2, MAP_MAX_LAYERS - 1);
	}
	//above ground
	else if(centerPos.z == 6)
	{
		minRangeZ = 0;
		maxRangeZ = 8;
	}
	else if(centerPos.z == 7)
	{
		minRangeZ = 0;
		maxRangeZ = 9;
	}
	else
	{
		minRangeZ = 0;
		maxRangeZ = 7;
	}

	getSpectatorsInternal(list, centerPos, false, minRangeX, maxRangeX, minRangeY, maxRangeY, minRangeZ, maxRangeZ);
	return list;
}
You must add a new bool as parameter so it'll know that it's checking spectators for a monster :p
 
Back
Top