Here you goTFS 1.3
I need to find where summons follow distance is located. I am creating a summoning vocation and this is the last change needed for it to be complete.
monster.cppvoid Monster::getPathSearchParams(const Creature* creature, FindPathParams& fpp) constif (isSummon()) {
if (getMaster() == creature) {
fpp.maxTargetDist = 2;
creature.cpp if (!summons.empty()) {
//check if any of our summons is out of range (+/- 2 floors or 30 tiles away)
std::forward_list<Creature*> despawnList;
for (Creature* summon : summons) {
const Position& pos = summon->getPosition();
if (Position::getDistanceZ(newPos, pos) > 2 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 30)) {
despawnList.push_front(summon);
}
}
for (Creature* despawnCreature : despawnList) {
g_game.removeCreature(despawnCreature, true);
}
}
if (newTile->getZone() != oldTile->getZone()) {
onChangeZone(getZone());
}
void Creature::goToFollowCreature()
{
if (followCreature) {
FindPathParams fpp;
getPathSearchParams(followCreature, fpp);
Monster* monster = getMonster();
if (monster && !monster->getMaster() && (monster->isFleeing() || fpp.maxTargetDist > 1)) {
Direction dir = DIRECTION_NONE;
if (monster->isFleeing()) {
monster->getDistanceStep(followCreature->getPosition(), dir, true);
} else { //maxTargetDist > 1
if (!monster->getDistanceStep(followCreature->getPosition(), dir)) {
// if we can't get anything then let the A* calculate
listWalkDir.clear();
if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
hasFollowPath = true;
startAutoWalk(listWalkDir);
} else {
if (followCreature->getPosition().z != getPosition().z) {
g_game.internalTeleport(monster, followCreature->getPosition());
monster->getDistanceStep(followCreature->getPosition(), dir);
} else {
hasFollowPath = false;
}
}
return;
}
}
if (dir != DIRECTION_NONE) {
listWalkDir.clear();
listWalkDir.push_front(dir);
hasFollowPath = true;
startAutoWalk(listWalkDir);
}
} else {
listWalkDir.clear();
if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
hasFollowPath = true;
startAutoWalk(listWalkDir);
} else {
hasFollowPath = false;
}
}
}
onFollowCreatureComplete(followCreature);
}
Here you goTFS 1.3
I need to find where summons follow distance is located. I am creating a summoning vocation and this is the last change needed for it to be complete.
monster.cppvoid Monster::getPathSearchParams(const Creature* creature, FindPathParams& fpp) constif (isSummon()) {
if (getMaster() == creature) {
fpp.maxTargetDist = 2;