Creature* master = creature->getMaster();
if (master && !master->isRemoved()) {
creature->setMaster(nullptr);
}
Could store the creatureId in storage instead, then check if the summon still exists, and make it your summon again?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
but deleting this code still means that after logging out, the summons are no longer mineC++:Creature* master = creature->getMaster(); if (master && !master->isRemoved()) { creature->setMaster(nullptr); }
-- in logout
local summonId = summon:getId()
player:setStorageValue(key, summonId)
-- in login
local summon = Creature(summonId)
if summon then
summon:setMaster(player)
else
-- summon no longer exists
end
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.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
for (Creature* summon : creature->summons) {
summon->setSkillLoss(false);
summon->setMaster(summon->getMaster()) // i added this but still can't assign player
//removeCreature(summon);
}
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?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)?