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

TFS 1.X+ [tfs 1.3] teleport all summons by source

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
I'm trying to compile in source the function of teleporting all summons to the player.
I wanted the script by source and not by lua.
so I found this script from @Stigma , but is giving error during compilation.
would anyone know the solution?
1565927350433.png
 
Solution
edit: final script (edited for me)
with teleport monster effect, and not teleport to pzone
Looking at the script, would there be a possible crash bug? If you don't find the creature on the effect or remove creature part?
obs: if player enter in pzone, summon is removed (g_game.removeCreature(this, true)

C++:
            const Tile* creatureTile = creature->getTile();
            if (creatureTile) {
                if (!creatureTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
                    g_game.internalTeleport(this, creature->getPosition());
                    g_game.addMagicEffect(creature->getPosition(), CONST_ME_POFF);
                } else {
                    g_game.removeCreature(this, true);
                }...
You have 2 errors there.

-On the first else a ) is missing, right after TELEPORT_PLAYER_SUMMONS)
-TELEPORT_PLAYER_SUMMONS and TELEPORT_ALL_SUMMONS are not defined on configmanager (cpp & h)
 
Last edited:
You have 2 errors there.

-On the first else a ) is missing, right after TELEPORT_PLAYER_SUMMONS)
-TELEPORT_PLAYER_SUMMONS and TELEPORT_ALL_SUMMONS are not defined on configmanager (cpp & h)
thx for help, i'm missing more one thing?


configmanager.cpp
Code:
    boolean[TELEPORT_PLAYER_SUMMONS] = getGlobalBoolean(L, "teleportPlayerSummons", false);
    boolean[TELEPORT_ALL_SUMMONS] = getGlobalBoolean(L, "teleportAllSummons", false);

configmanager.h
Code:
            TELEPORT_PLAYER_SUMMONS,
            TELEPORT_ALL_SUMMONS,

monsters.cpp
Code:
extern ConfigManager g_config;

1565930705965.png
 
edit: final script (edited for me)
with teleport monster effect, and not teleport to pzone
Looking at the script, would there be a possible crash bug? If you don't find the creature on the effect or remove creature part?
obs: if player enter in pzone, summon is removed (g_game.removeCreature(this, true)

C++:
            const Tile* creatureTile = creature->getTile();
            if (creatureTile) {
                if (!creatureTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
                    g_game.internalTeleport(this, creature->getPosition());
                    g_game.addMagicEffect(creature->getPosition(), CONST_ME_POFF);
                } else {
                    g_game.removeCreature(this, true);
                }
            }

finally code:

C++:
    if (getMaster() == creature) {
        //teleportAllSummons
        if (g_config.getBoolean(ConfigManager::TELEPORT_ALL_SUMMONS)) {
            const Tile* creatureTile = creature->getTile();
            if (creatureTile) {
                if (!creatureTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
                    g_game.internalTeleport(this, creature->getPosition());
                    g_game.addMagicEffect(creature->getPosition(), CONST_ME_POFF);
                } else {
                    g_game.removeCreature(this, true);
                }
            }
        } else if (g_config.getBoolean(ConfigManager::TELEPORT_PLAYER_SUMMONS)) {
            Player* player = creature->getPlayer();
            if (player) {
                g_game.internalTeleport(this, player->getPosition());            
            }
        } else {
        //fim
            //Take random steps and only use defense abilities (e.g. heal) until its master comes back
            isMasterInRange = false;
        }
    }
 
Last edited:
Solution
Back
Top