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

Corpse owner duration

Justinek

New Member
Joined
Dec 21, 2015
Messages
16
Reaction score
0
Hello, I have problem with corpse owner duration because a person which killed monster is owner of this corpse forever :/

tfs 0.3.6pl96r

config.lua
PHP:
fieldOwnershipDuration = 5 * 1000    --60

function which create corpse and set owner
monster.cpp
PHP:
Item* Monster::createCorpse(DeathList deathList)
{
    Item* corpse = Creature::createCorpse(deathList);
    if(!corpse)
        return NULL;

    if(mType->corpseUnique)
        corpse->setUniqueId(mType->corpseUnique);

    if(mType->corpseAction)
        corpse->setActionId(mType->corpseAction);

    DeathEntry ownerEntry = deathList[0];
    if(ownerEntry.isNameKill())
        return corpse;

    Creature* owner = ownerEntry.getKillerCreature();
  

    if(!owner)
        return corpse; 

    uint32_t ownerId = 0;
    if(owner->getPlayer())
        ownerId = owner->getID();
    else if(owner->getMaster() && owner->getPlayerMaster())
        ownerId = owner->getMaster()->getID();

    if(ownerId)
        corpse->setCorpseOwner(ownerId);

    return corpse;
}
 
Go on item.h on the function setCorpseOwner and add that:

Code:
Scheduler::getInstance().addEvent(createSchedulerTask(5 * 1000, boost::bind(&Item::setCorpseOwner, this, 0)));

Don't forget the include to add the include:
Code:
#include "scheduler.h"

Not tested but it should work.
 
Go on item.h on the function setCorpseOwner and add that:

Code:
Scheduler::getInstance().addEvent(createSchedulerTask(5 * 1000, boost::bind(&Item::setCorpseOwner, this, 0)));

Don't forget the include to add the include:
Code:
#include "scheduler.h"

Not tested but it should work.
Still not work :/
 
Go on item.h on the function setCorpseOwner and add that:

Code:
Scheduler::getInstance().addEvent(createSchedulerTask(5 * 1000, boost::bind(&Item::setCorpseOwner, this, 0)));

Don't forget the include to add the include:
Code:
#include "scheduler.h"

Not tested but it should work.

This will make the config.lua option useless, you should add the config into the schedule (5 * 1000) :)
 
This will make the config.lua option useless, you should add the config into the schedule (5 * 1000) :)
I don't really have the tfs 0.3.6 and I was too lazy to find how the configmanager worked before.
Actually that variable is not even for that, "fieldOwnershipDuration" is for the duration of fields, like fire field runes and etc. So lol don't use that make a new variable and use it like this:

Code:
Scheduler::getInstance().addEvent(createSchedulerTask(getGlobalNumber("newVariableName", 5000), boost::bind(&Item::setCorpseOwner, this, 0)));

Change the variable name to whatever you put on config.lua

And add #include "configmanager.h" if it is not included already.

That should work.
 
Last edited:
I don't really have the tfs 0.3.6 and I was too lazy to find how the configmanager worked before.
Actually that variable is not even for that, "fieldOwnershipDuration" is for the duration of fields, like fire field runes and etc. So lol don't use that make a new variable and use it like this:

Code:
Scheduler::getInstance().addEvent(createSchedulerTask(getGlobalNumber("newVariableName", 5000), boost::bind(&Item::setCorpseOwner, this, 0)));

Change the variable name to whatever you put on config.lua

And add #include "configmanager.h" if it is not included already.

That should work.

Oh right its for fields, he confused me with the first post :p
 
Back
Top