• 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+ How to make the summon still belong to the player after logging out in tfs 1.4?

lexus21

Active Member
Joined
Dec 14, 2022
Messages
88
Reaction score
25
How to make the summon still belong to the player after logging out in tfs 1.4?

do I need a change in c++ or lua?
Post automatically merged:

i removed line from game.cpp and now summons don't disappear after logging out. But summons no longer belong to that player after login
 
Last edited:
That'd be tough.
I would probably store the names (and hp?) of the creatures in a couple of storages, and summon new one's when the player logs back in.
 
Thanks for the answer
hmm, I thought about that too.
But I want to make it so that after logging out of the game, the summons are still on the map and no one can heal the summons except the player who summoned them.
I thought the wall would block e.g. mass healing (unless I set the flags wrong)
Post automatically merged:

i fouind in game.cpp
C++:
Creature* master = creature->getMaster();
    if (master && !master->isRemoved()) {
        creature->setMaster(nullptr);
    }
but deleting this code still means that after logging out, the summons are no longer mine
 
Last edited:
Thanks for the answer
hmm, I thought about that too.
But I want to make it so that after logging out of the game, the summons are still on the map and no one can heal the summons except the player who summoned them.
I thought the wall would block e.g. mass healing (unless I set the flags wrong)
Post automatically merged:

i fouind in game.cpp
C++:
Creature* master = creature->getMaster();
    if (master && !master->isRemoved()) {
        creature->setMaster(nullptr);
    }
but deleting this code still means that after logging out, the summons are no longer mine
Could store the creatureId in storage instead, then check if the summon still exists, and make it your summon again?

some pseudocode.. you'd need to use loops to make sure you get all the summons, but yeah
Lua:
-- in logout
local summonId = summon:getId()
player:setStorageValue(key, summonId)
Lua:
 -- in login
local summon = Creature(summonId)
if summon then
    summon:setMaster(player)
else
    -- summon no longer exists
end
 
But when I log out, the "summons" left on the map (after modification in C++) are ordinary monsters and anyone can heal them - and I want only the owner to be able to do it
 
But when I log out, the "summons" left on the map (after modification in C++) are ordinary monsters and anyone can heal them - and I want only the owner to be able to do it
I guess you will have to introduce a Creature/Monster variable such as "wasSummon", and then add early returns to health changing methods if it was a summon etc.
 
C++:
    for (Creature* summon : creature->summons) {
        summon->setSkillLoss(false);
        summon->setMaster(summon->getMaster()) // i added this but still can't assign player
        //removeCreature(summon);
    }

Is it even possible to set the owner of a logged-out player's summons (without any major changes)?
 
Last edited:
C++:
    for (Creature* summon : creature->summons) {
        summon->setSkillLoss(false);
        summon->setMaster(summon->getMaster()) // i added this but still can't assign player
        //removeCreature(summon);
    }

Is it even possible to set the owner of a logged-out player's summons (without any major changes)?
why cant you make them disappear and summon new ones on login? that is the most efficient way since if you block healing people can block 2sqm places if the summons are not pushable and abuse game mechanics to make the server unplayable do you just want to break the server in every possible way instead of making a good solution xikini posted ? which is storing a table inside of storage that is called when logging in?
 
Back
Top