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

How change summon SQM distance

jededias

Member
Joined
Jan 21, 2019
Messages
66
Solutions
1
Reaction score
12
How change summon SQM distance?
From player?

Is this part of the code?

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);
}
}
 
You can debug it yourself by just changing and testing the code.
C++:
        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);
            }
        }
What happens if you change this
C++:
g_game.removeCreature(despawnCreature, true);
to false?
Does the summon get despawned after being 30 tiles away or +/- 2 floors then?
If you change the statement back to true, and this statement
C++:
if (Position::getDistanceZ(newPos, pos) > 2
to > 4 instead of >2? Does it despawn only after being +/-4 floors away?
Try changing
C++:
Position::getDistanceY(newPos, pos)) > 30))
as well and see what happens.
 
Back
Top