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

roriscrave

Well-Known Member
Joined
Dec 7, 2011
Messages
741
Best answers
19
Reaction score
89
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
 

Deatthraz

Intermediate OT User
Joined
May 1, 2013
Messages
317
Best answers
11
Reaction score
103
Location
Mexico
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:
OP
R

roriscrave

Well-Known Member
Joined
Dec 7, 2011
Messages
741
Best answers
19
Reaction score
89
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
 
OP
R

roriscrave

Well-Known Member
Joined
Dec 7, 2011
Messages
741
Best answers
19
Reaction score
89
Place ConfigManager:: in front of the identifiers giving you errors.
For example: ConfigManager::TELEPORT_ALL_SUMMONS
partially worked:
Error (summn is teleporting to protection zone).
 
Last edited:
OP
R

roriscrave

Well-Known Member
Joined
Dec 7, 2011
Messages
741
Best answers
19
Reaction score
89
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:
Top