Guys I need help with monster adding infight just for targetting players. I'm making a server with a wide range of view and players get infight all the time because of that.
I don't want to reduce monster cansee so that they just don't stand there frozem. So I think one solution is to remove infight just to get targeted by a monster and then get infight if got hit/damaged. I'm looking in the sources but can't figure out how to do that (TFS 1.3).
Maybe reduce the range that monsters target too, but I don't know if that would froze them in the distance too.
Here is where I think needs change in players.cpp:
Any suggestion?
I don't want to reduce monster cansee so that they just don't stand there frozem. So I think one solution is to remove infight just to get targeted by a monster and then get infight if got hit/damaged. I'm looking in the sources but can't figure out how to do that (TFS 1.3).
Maybe reduce the range that monsters target too, but I don't know if that would froze them in the distance too.
Here is where I think needs change in players.cpp:
C++:
void Player::onAttackedCreature(Creature* target, bool addFightTicks /* = true */)
{
Creature::onAttackedCreature(target);
if (target->getZone() == ZONE_PVP) {
return;
}
if (target == this) {
if (addFightTicks) {
addInFightTicks();
}
return;
}
if (hasFlag(PlayerFlag_NotGainInFight)) {
return;
}
Player* targetPlayer = target->getPlayer();
if (targetPlayer && !isPartner(targetPlayer) && !isGuildMate(targetPlayer)) {
if (!pzLocked && g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
pzLocked = true;
sendIcons();
}
targetPlayer->addInFightTicks();
if (getSkull() == SKULL_NONE && getSkullClient(targetPlayer) == SKULL_YELLOW) {
addAttacked(targetPlayer);
targetPlayer->sendCreatureSkull(this);
}
else if (!targetPlayer->hasAttacked(this)) {
if (!pzLocked) {
pzLocked = true;
sendIcons();
}
if (!Combat::isInPvpZone(this, targetPlayer) && !isInWar(targetPlayer)) {
addAttacked(targetPlayer);
if (targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE) {
setSkull(SKULL_WHITE);
}
if (getSkull() == SKULL_NONE) {
targetPlayer->sendCreatureSkull(this);
}
}
}
}
if (addFightTicks) {
addInFightTicks();
}
}
Any suggestion?