• 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 Place when die

Way20

Well-Known Member
Joined
Sep 29, 2014
Messages
205
Solutions
3
Reaction score
79
Well I don't know how to explain it, I want to change something in my sources, when players die they come to temple I want that they stay in the place that they died. I know that it is in my sources because when I change my distro this don't happen. I will show some images.

Normal distro (Original TFS 0.4 rev 3777) when a player die.

Sm1RllC.png


My distro when a player die.

jWhR62W.png


I'm using TFS 0.4 (rev 3777). Someone know how to fix it?
 
1-What Source Edits have you done to Source
2-What Creaturescripts you have Which have ("OnPrepareDeath")
3-Mods aswell
 
1-What Source Edits have you done to Source
2-What Creaturescripts you have Which have ("OnPrepareDeath")
3-Mods aswell

1- That's the problem, I made a lot of edits but I think that it was when I change something in game.cpp
2- I only have this one.
Code:
local array = {
        PLAYERLOSS_CONTAINERS,
        PLAYERLOSS_ITEMS
}
function onPrepareDeath(cid, deathList)
for i = 1, #array do
doPlayerSetLossPercent(cid, array[i], 0)
end
return true
end
3- I dont have any Mods with OnPrepareDeath.

I have the original sources files, I just need know in which files could be this code part to compare with my files.
 
Well originally I was thinking it might be a simple mistake of teleporting the player to temple before disconnecting them but since you say it works on a fresh distro... I am thinking maybe onPrepareDeath or onDeath in general causes some sort of extremely slight delay before the actual death in which the players client gets to see where it teleports before being disconnected.... Can you try to remove all onDeath and onPrepareDeath scripts in your server and see if it fixes the problem?
 
Well originally I was thinking it might be a simple mistake of teleporting the player to temple before disconnecting them but since you say it works on a fresh distro... I am thinking maybe onPrepareDeath or onDeath in general causes some sort of extremely slight delay before the actual death in which the players client gets to see where it teleports before being disconnected.... Can you try to remove all onDeath and onPrepareDeath scripts in your server and see if it fixes the problem?

I did it bro but it not worked, I removed all script from creaturescripts except the login.lua, I think that it's source problem but I don't know which files may be this problem.
 
hmm, could you please give your creature.cpp and player.cpp

the thing you need is easy.

If you have c++ experience do the following :

First thing:
Find
Code:
droppedcorpse
in creature.cpp
and replace
Code:
if (droppedCorpse) {
to
Code:
if (!getPlayer() && droppedCorpse) {

This will prevent the player from removing when he die.

Second thing:

you want the player not to be teleported to temple and get full

Well you gotta know if you want him to lose level and skills?

take a look on function
Code:
player::ondeath

But finally I agree with ~ webo to use forgotten server 1.2 , and get the tfs 0.4 functions lib.
 
@Slavi Dodo
I think you misunderstood his problem. When a character dies on his server, it teleports to the temple before the death screen.

As his screenshots show... Normally when you die it looks like this: (so you can see all your killers/screenshot/ect...)
Sm1RllC.png


In his server it looks like this:
jWhR62W.png
 
@Slavi Dodo
I think you misunderstood his problem. When a character dies on his server, it teleports to the temple before the death screen.

As his screenshots show... Normally when you die it looks like this: (so you can see all your killers/screenshot/ect...)
Sm1RllC.png


In his server it looks like this:
jWhR62W.png
Aha yea.
Sorry for misunderstanding.
But anyway the problem is in player::eek:ndeath because it's managing what happens to player when he dies. I think there is line like that > g_game.internalTeleport .. was put on wrong place. he may need to get a clean sources.
 
Like @Slavi Dodo said, we cannot help u if u dont post ur Player:eek:nDeath() --> player.cpp

Isn't in Player:eek:nDeath(), I compared with the original code and I didn't change anything in this part but I found the problem, it was on Player::dropCorpse. I changed this part back to the original code and I solved the problem but I get another issue.

Original Player::dropCorpse on player.cpp
Code:
void Player::dropCorpse(DeathList deathList)
{
    if(lootDrop == LOOT_DROP_NONE)
    {
        pzLocked = false;
        if(health <= 0)
        {
            health = healthMax;
            mana = manaMax;
        }

        setDropLoot(LOOT_DROP_FULL);
        sendStats();
        sendIcons();

        onIdleStatus();
        g_game.addCreatureHealth(this);
        g_game.internalTeleport(this, masterPosition, false);
    }
    else
    {
        Creature::dropCorpse(deathList);
        if(g_config.getBool(ConfigManager::DEATH_LIST))
            IOLoginData::getInstance()->playerDeath(this, deathList);
    }
}

Player::dropCorpse on my player.cpp
Code:
void Player::dropCorpse(DeathList deathList)
{

        pzLocked = false;
        if(health <= 0)
        {
            health = healthMax;
            mana = manaMax;
        }

        setDropLoot(LOOT_DROP_FULL);
        sendStats();
        sendIcons();
        Creature::dropCorpse(deathList);
      
        onIdleStatus();
        g_game.addCreatureHealth(this);
        g_game.internalTeleport(this, masterPosition, false);

}

I did that changes because on my server I use frags with storage and don't want that when someone die update the death_list, have a way to do it without bring me to that problem?
 
Back
Top