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

Solved Can't move corpses

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,565
Solutions
6
Reaction score
430
Location
Brazil - Rio de Janeiro
GitHub
Nottinghster
Hello OTlanders!!

Well, I'm havin' some problems, already try to fix it but I really don't where is the problem...

Explaining:

When I kill a monster, I can't move the corpse for some seconds, here's the gif

bMvdkG.gif


Note: Version 7.72

------------ EDIT ------------

Problem fixed, thanks to Assassina Mutante
 

Attachments

Last edited:
Solution
HERE'S THE SOLUTION THAT I'VE MADE TO MY PROJECT

You will be able to use a preprocessor definition, if you want to use corpse owner or not...

PS: DO NOT FORGET TO COMPILE WITH PREPROCESSOR "__SHOULD_USE_CORPSEOWNER__" IF YOU WANT TO USE CORPSE OWNER

In monster.h

Replace this:
Code:
virtual uint16_t getLookCorpse() const { return mType->lookCorpse; }

For this (this is the real solution, thanks to Assassina Mutante):
Code:
    #ifdef __SHOULD_USE_CORPSEOWNER__
        virtual uint16_t getLookCorpse() const { return mType->lookCorpse; }
    #else
        virtual uint16_t getLookCorpse() const { // Remove corpse owner
        const ItemType& itemtype = Item::items[mType->lookCorpse];
            if (itemtype.decayTo != 0)...
I thought it was 10 seconds. Anyways, yeah, this came in the 7.8 update when they introduced private loot.
This is perfectly normal. It looks like you took a later version of TFS and changed the Tibia version to 7.72.
 
@Evan

This isn't normal in version 7.72, (check my signature), I know that was introduced in version 7.8, but when I rewroted my sources, I get that, and now I don't remember where to remove it, already checked some things, but can't found it !!!

And I'm not using a later version of TFS, I'm using OTServ_SVN 0.6.3
 
Ctrl + f and search for "RET_NOTMOVEABLE" you will find for like 4 lines with it.
Disable some lines and you will slowly find your problem.
 
Where are the solution? I need this too

Every monster has different corpses, if you open a monster's xml file, there is an "corpse id" or something like that, that is the first corpse it will generate when it dies, that corpse isn't moveable and has usually a duration of 10 seconds, then it decays to another corpse with the same sprite but moveable.

Just change the id of the corpse on the monster's xml to that second corpse he decays to. Thats it.

Example:

amazon.xml (monster)
Lua:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Amazon" nameDescription="an amazon" race="blood" experience="60" speed="180" manacost="390">
    <health now="110" max="110" />
    <look type="137" head="113" body="120" legs="114" feet="132" corpse="20323" />
....
corpse="20323"


items.xml:
First corpse (the one in the xml) this is not moveable:

Code:
<item id="20323" article="a" name="dead amazon">
        <attribute key="containerSize" value="20" />
        <attribute key="decayTo" value="20324" />
        <attribute key="duration" value="10" />
        <attribute key="corpseType" value="blood" />
        <attribute key="fluidSource" value="blood" />
    </item>


It decays to the item id 20324 after 10 seconds, that item 20324 has the same sprite, but is moveable.

Change the corpse="20323" to corpse="20324" in the amazon.xml
 
rat png.png
I literally posted the solution. What :eek:
I am sorry, but your solution doesn't work. You can move only first corpse (2013), but if it is decayed, then you can not move the next one (2014). Look for the example of rat:

This is the id of main corpse, which should be set in monsters/rat.xml:
Code:
<item id="5964" article="a" name="dead rat">
    <attribute key="weight" value="6300" />
    <attribute key="containerSize" value="5" />
    <attribute key="decayTo" value="2815" />
    <attribute key="duration" value="10" />
    <attribute key="corpseType" value="blood" />
    <attribute key="fluidSource" value="blood" />
</item>

But I do not want it, because I have to wait 10 seconds to move the monster. So following your solution, I changed the id of the monster to moveable one - 2813:
Code:
<item id="2813" article="a" name="dead rat">
    <attribute key="weight" value="6300" />
    <attribute key="containerSize" value="5" />
    <attribute key="decayTo" value="2814" />
    <attribute key="duration" value="10" />
    <attribute key="corpseType" value="blood" />
    <attribute key="fluidSource" value="blood" />
</item>
It decays to id 2814, but id 2814 is unmoveable (can not push it):
Code:
<item id="2814" article="a" name="dead rat">
    <attribute key="weight" value="4400" />
    <attribute key="containerSize" value="5" />
    <attribute key="decayTo" value="2815" />
    <attribute key="duration" value="10" />
    <attribute key="corpseType" value="blood" />
</item>
Id 2814 decays to 2815 which is moveable again.
Code:
<item id="2815" article="a" name="dead rat">
    <attribute key="weight" value="3000" />
    <attribute key="decayTo" value="0" />
    <attribute key="duration" value="10" />
</item>

It looks like every SECOND corpse is unmoveable. Second corpse here has id 2814. I have to remove it somehow from source, but I do not know where. Also I would like to know, which lines of source I have to delete, to remove 10 second unmoveable and unopenable corpses from game.
I think I am slowly getting it:
setCorpseOwner
I am going to compile and post if it's working.
/edit its not
 
Last edited:
HERE'S THE SOLUTION THAT I'VE MADE TO MY PROJECT

You will be able to use a preprocessor definition, if you want to use corpse owner or not...

PS: DO NOT FORGET TO COMPILE WITH PREPROCESSOR "__SHOULD_USE_CORPSEOWNER__" IF YOU WANT TO USE CORPSE OWNER

In monster.h

Replace this:
Code:
virtual uint16_t getLookCorpse() const { return mType->lookCorpse; }

For this (this is the real solution, thanks to Assassina Mutante):
Code:
    #ifdef __SHOULD_USE_CORPSEOWNER__
        virtual uint16_t getLookCorpse() const { return mType->lookCorpse; }
    #else
        virtual uint16_t getLookCorpse() const { // Remove corpse owner
        const ItemType& itemtype = Item::items[mType->lookCorpse];
            if (itemtype.decayTo != 0) {
                return itemtype.decayTo;
                return mType->lookCorpse;
            }
        }
    #endif

In actions.cpp, replace this:
Code:
        if(container->getCorpseOwner() != 0 && !player->canOpenCorpse(container->getCorpseOwner())){
            return RET_YOUARENOTTHEOWNER;
        }

For this:
Code:
        #ifdef __SHOULD_USE_CORPSEOWNER__
        if(container->getCorpseOwner() != 0 && !player->canOpenCorpse(container->getCorpseOwner())){
            return RET_YOUARENOTTHEOWNER;
        }
        #endif

In item.h, replace this:
Code:
    void setCorpseOwner(uint32_t _corpseOwner) {setIntAttr(ATTR_ITEM_CORPSEOWNER, _corpseOwner);}
    uint32_t getCorpseOwner() {return (uint32_t)getIntAttr(ATTR_ITEM_CORPSEOWNER);}

For this:
Code:
    #ifdef __SHOULD_USE_CORPSEOWNER__
    void setCorpseOwner(uint32_t _corpseOwner) {setIntAttr(ATTR_ITEM_CORPSEOWNER, _corpseOwner);}
    uint32_t getCorpseOwner() {return (uint32_t)getIntAttr(ATTR_ITEM_CORPSEOWNER);}
    #endif

In monster.cpp, replace this:
Code:
            if(corpseOwner != NULL){
                corpse->setCorpseOwner(corpseOwner->getID());
            }

For this:
Code:
            #ifdef __SHOULD_USE_CORPSEOWNER__
            if(corpseOwner != NULL){
                corpse->setCorpseOwner(corpseOwner->getID());
            }
            #endif

Still in monster.cpp replace all that function:
Code:
void Monster::dropLoot(Container* corpse)

For this:
Code:
void Monster::dropLoot(Container* corpse)
{
    #ifdef __SHOULD_USE_CORPSEOWNER__
        if(corpse && lootDrop){
            Player* killer = g_game.getPlayerByID(corpse->getCorpseOwner());
            if(!killer || killer->getStaminaMinutes() > 840)
                mType->createLoot(corpse);
            if(killer)
                killer->broadcastLoot(this, corpse->getContainer());
        }
    #else
        if(corpse && lootDrop){
            mType->createLoot(corpse);
        } 
    #endif
}
 
Solution
Thank you for sharing with us your script, but this is not what I need. The solution you gave us, I already did to my server.
The problem is that I am starting to believe that 10 first seconds of unmoveable corpse is client side... For the hell, can not find it in the server ot there are mixed ids.

Any knowledge about that?

edit: what i've noticed:
If I use for example a corpse of sheep as a second corpse and black sheep as a third corpse, sheeps are moveable. WTF. now I am totally confused. Rats don't work, sheeps work.
 
Last edited:
Finally got it! I had to write my own corpse system with own generated corpse onkill and own generated random chance for a loot on array onkill as well... but now i have to do 500 monsters more! I am so happy! :)

- doesnt work
item transformed is not moveable
 
Last edited:
Back
Top