• 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+ C++ code help.

xrenan

New Member
Joined
Nov 5, 2018
Messages
5
Reaction score
0
C++:
Monster* summon = Monster::createMonster(summonBlock.name);
            if (summon) {
                const Position& summonPos = getPosition();
                addSummon(summon);

this function on monster.cpp, how can i do something like this.
a check to relocate the summon position, if the summonPos is = 3020,3123,7

example.
C++:
if summonPos = 3020,3123,7

addSummon on position 3461,1342,7
 
It would probably be better to handle this in the placeCreature function, because I guess you don't want to have summons on that specific tile?

Other wise, your way could look something like this:
Lua:
if (getPosition().x == 3020 && getPosition().y == 3123 && getPosition().z == 7) {
    g_game.internalMoveCreature(summon, uniform_random(0, 7), FLAG_NOLIMIT);
}
 
Back
Top