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

Summon tp to pz

zapo

Member
Joined
Nov 10, 2020
Messages
129
Solutions
3
Reaction score
11
Hi, creature creating by 'utevo res 'name'' can tp to pz for example when i go uppster.

How to disable teleporting this summon?

Otservbr
TFS 1.3
 
Solution
Unfortunately it doesn't work

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) {
        //check if summon name contains "familiar"
        if (summon->getName().find('familiar') != std::string::npos) {
            const Position& pos = summon->getPosition();
            if (Position::getDistanceZ(newPos, pos) > 0 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 15)) {
                g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true);
            }
        }
    }
   
    for (Creature* despawnCreature ...
L510-513 seems unrelated to your problem.
L495-508 is what you should remove.

have you re-compiled after removing those lines?
I don't know why, but even when I delete the whole file, nothing changes
After changes i must compile new engine?
 
It work, but my special summon like Thundergiant also does not teleport but should teleport

C++:
if (summon->getName() == 'Thundergiant') {
	// Apply code for Thundergiant
}

// Might be more efficient to do:
if (summon->getRace() == 219) {
	// Apply code for raceid 219
}
 
You forgot to loop through your summons list to grab the summon creature
C++:
for (Creature* summon : summons) {
	// apply code here, etc: summon->getName()
}
 
What is wrong here? the engine compiles but still summons created by "utevo res" teleports to pz
C++:
for (Creature* summon : summons) {
                if (!summons.empty() && summon->getName() == "sorcerer familiar" || "palladin familiar" || "knight familiar" || "druid familiar"){
                    //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) > 0 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 15)) {
                  g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true);
                }
                    }

                    for (Creature* despawnCreature : despawnList) {
                        g_game.removeCreature(despawnCreature, true);
                    }
                }
            }
 
What is wrong here? the engine compiles but still summons created by "utevo res" teleports to pz
C++:
for (Creature* summon : summons) {
                if (!summons.empty() && summon->getName() == "sorcerer familiar" || "palladin familiar" || "knight familiar" || "druid familiar"){
                    //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) > 0 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 15)) {
                  g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true);
                }
                    }

                    for (Creature* despawnCreature : despawnList) {
                        g_game.removeCreature(despawnCreature, true);
                    }
                }
            }
Just an observation, you got "palladin" instead "paladin"
 
for (Creature* summon : summons) { if (!summons.empty() && summon->getName() == "sorcerer familiar" || "palladin familiar" || "knight familiar" || "druid familiar"){ //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) > 0 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 15)) { g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true); } } for (Creature* despawnCreature : despawnList) { g_game.removeCreature(despawnCreature, true); } } }

You loop through all summons again to teleport inside the all summons loop, so all summons will teleport if one summons is named what youve specified.

Try this, should only teleport summons named what youve specified
C++:
for (Creature* summon : summons) {
    if (!summons.empty() && summon->getName() == "sorcerer familiar" || "palladin familiar" || "knight familiar" || "druid familiar"){
        //check if any of our summons is out of range (+/- 2 floors or 30 tiles away)
        std::forward_list<Creature*> despawnList;
        const Position& pos = summon->getPosition();
        if (Position::getDistanceZ(newPos, pos) > 0 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 15)) {
            g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true);
        }

        for (Creature* despawnCreature : despawnList) {
            g_game.removeCreature(despawnCreature, true);
        }
    }
}

**Not really sure what the despawnList is, doesnt seem to do anything?? But left it in anyway.
 
You loop through all summons again to teleport inside the all summons loop, so all summons will teleport if one summons is named what youve specified.

Try this, should only teleport summons named what youve specified
C++:
for (Creature* summon : summons) {
    if (!summons.empty() && summon->getName() == "sorcerer familiar" || "palladin familiar" || "knight familiar" || "druid familiar"){
        //check if any of our summons is out of range (+/- 2 floors or 30 tiles away)
        std::forward_list<Creature*> despawnList;
        const Position& pos = summon->getPosition();
        if (Position::getDistanceZ(newPos, pos) > 0 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 15)) {
            g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true);
        }

        for (Creature* despawnCreature : despawnList) {
            g_game.removeCreature(despawnCreature, true);
        }
    }
}

**Not really sure what the despawnList is, doesnt seem to do anything?? But left it in anyway.
Unfortunately it doesn't work
 
Back
Top