• 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 0.X [OTX 2] Yellow skull bug

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,403
Solutions
17
Reaction score
151
Location
Brazil
Good evening guys, how are you? I saw that my engine has a Yellow Skull bug, I'll try to explain:

  • Player 1 attacks player two.
  • Player 2 Attacks player 3
  • Player 3 attacks player 1 (turning Yellow Skull)
  • Player 1 leaves, loses the skull and manages to attack player 3 without getting White Skull and does not get unjust killed.

I saw that we have some posts dealing with this bug but I didn't find the solution. Here's a video of the bug reproduction and my players.cpp attached.

 

Attachments

i think a fix would be to remove yellow skull from every player that had attacked back p1 at same time as he loses white skull, i noticed tfs missing it aswell
 
I changed this void

C++:
void Player::setSkullEnd(time_t _time, bool login, Skulls_t _skull)
{
    if(g_game.getWorldType() != WORLDTYPE_OPEN
        || hasFlag(PlayerFlag_NotGainInFight) ||
        hasCustomFlag(PlayerCustomFlag_NotGainSkull))
        return;

    bool requireUpdate = false;
    if(_time > time(NULL))
    {
        requireUpdate = true;
        setSkull(_skull);
    }
    else if(skull == _skull)
    {
        requireUpdate = true;
        setSkull(SKULL_NONE);
        _time = 0;
    }

    if(requireUpdate)
    {
        skullEnd = _time;
        if(!login)
            g_game.updateCreatureSkull(this);
    }
}

Now Yellow Skull gone, but P1 can attack P3 without get skull, and if he kills, get no injust kill.
 
For 0.X i tried to use this one

C++:
void Player::onTarget(Creature* target)
{
    Creature::onTarget(target);

    if(target == this)
    {
        addInFightTicks(false);
        return;
    }

    if(hasFlag(PlayerFlag_NotGainInFight))
        return;

    Player* targetPlayer = target->getPlayer();
    if(targetPlayer && !isPartner(targetPlayer) && !isAlly(targetPlayer))
    {
        if(!pzLocked && g_game.getWorldType() == WORLDTYPE_HARDCORE)
        {
            pzLocked = true;
            sendIcons();
        }

        if(getSkull() == SKULL_NONE && getSkullType(targetPlayer) == SKULL_YELLOW)
        {
            addAttacked(targetPlayer);
            targetPlayer->sendCreatureSkull(this);
        }
        else if(!targetPlayer->hasAttacked(this))
        {
            if(!pzLocked)
            {
                pzLocked = true;
                sendIcons();
            }

            if(!Combat::isInPvpZone(this, targetPlayer) && !isEnemy(this))
            {
                addAttacked(targetPlayer);

                if(targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE)
                {
                    setSkull(SKULL_WHITE);
                    g_game.updateCreatureSkull(this);
                }

                if(getSkull() == SKULL_NONE)
                    targetPlayer->sendCreatureSkull(this);
            }
        }
    }

    addInFightTicks(false);
}

Still not working.
 

I tested here, but it doesn't work.

My test is:

Player 3 (Orange) - Attack player 1 (get white skull)
Player 1 (Blue) - Attack player 2 (get white skull)
Player 2 (Black) - Attack player 3 (get yellow)

3e5d2eafe0202c5d256c35900cc86257.png


Until then, everything is fine.

Player 3 stops attacking and player 1 is attacking player 2 (which is yellow on player 3).

Player 3 loses the white skull, however, player 2 remains yellow skull for him (it should come out with player 3's white skull).
5c39ff4ff84a63aae529d02787f7fea6.png


This happens when player 2 is being attacked (pz).
 
I tested here, but it doesn't work.

My test is:

Player 3 (Orange) - Attack player 1 (get white skull)
Player 1 (Blue) - Attack player 2 (get white skull)
Player 2 (Black) - Attack player 3 (get yellow)

3e5d2eafe0202c5d256c35900cc86257.png


Until then, everything is fine.

Player 3 stops attacking and player 1 is attacking player 2 (which is yellow on player 3).

Player 3 loses the white skull, however, player 2 remains yellow skull for him (it should come out with player 3's white skull).
5c39ff4ff84a63aae529d02787f7fea6.png


This happens when player 2 is being attacked (pz).
My bad, I don't read propely the post
Post automatically merged:

For 0.X i tried to use this one

C++:
void Player::onTarget(Creature* target)
{
    Creature::onTarget(target);

    if(target == this)
    {
        addInFightTicks(false);
        return;
    }

    if(hasFlag(PlayerFlag_NotGainInFight))
        return;

    Player* targetPlayer = target->getPlayer();
    if(targetPlayer && !isPartner(targetPlayer) && !isAlly(targetPlayer))
    {
        if(!pzLocked && g_game.getWorldType() == WORLDTYPE_HARDCORE)
        {
            pzLocked = true;
            sendIcons();
        }

        if(getSkull() == SKULL_NONE && getSkullType(targetPlayer) == SKULL_YELLOW)
        {
            addAttacked(targetPlayer);
            targetPlayer->sendCreatureSkull(this);
        }
        else if(!targetPlayer->hasAttacked(this))
        {
            if(!pzLocked)
            {
                pzLocked = true;
                sendIcons();
            }

            if(!Combat::isInPvpZone(this, targetPlayer) && !isEnemy(this))
            {
                addAttacked(targetPlayer);

                if(targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE)
                {
                    setSkull(SKULL_WHITE);
                    g_game.updateCreatureSkull(this);
                }

                if(getSkull() == SKULL_NONE)
                    targetPlayer->sendCreatureSkull(this);
            }
        }
    }

    addInFightTicks(false);
}

Still not working.
Thats for 1.5 tfs and this has nothing to do with "infight condition remove skull".
 
I tested here, but it doesn't work.

My test is:

Player 3 (Orange) - Attack player 1 (get white skull)
Player 1 (Blue) - Attack player 2 (get white skull)
Player 2 (Black) - Attack player 3 (get yellow)

3e5d2eafe0202c5d256c35900cc86257.png


Until then, everything is fine.

Player 3 stops attacking and player 1 is attacking player 2 (which is yellow on player 3).

Player 3 loses the white skull, however, player 2 remains yellow skull for him (it should come out with player 3's white skull).
5c39ff4ff84a63aae529d02787f7fea6.png


This happens when player 2 is being attacked (pz).
exactly, thats why i suggested to remove YS from players such as p2 as p3 drops WS : ) that would also solve p3 not getting white skull again when trying to attack p2, since this statement prevents that from happening
C++:
if (getSkull() == SKULL_NONE && getSkullClient(targetPlayer) == SKULL_YELLOW) {
 
exactly, thats why i suggested to remove YS from players such as p2 as p3 drops WS : ) that would also solve p3 not getting white skull again when trying to attack p2, since this statement prevents that from happening
C++:
if (getSkull() == SKULL_NONE && getSkullClient(targetPlayer) == SKULL_YELLOW) {

I understand. But wouldn't that solve just the visual part? A yellow skull would not appear, however, p2 could be killed in that period by p3 without him getting frag, right?
 
if p2 don't have YS anymore, p3 would gain WS again and if p2 dies i think both p1 and p3 gets frag on p2, since p1 was still attacking while p3 was dropping, resulting in p1 getting most damage and in this scenario p3 last hit
 
Last edited:
if p2 don't have YS anymore, p3 would gain WS again and if p2 dies i think both p1 and p3 gets frag on p2, since p1 was still attacking while p3 was dropping, resulting in p2 getting most damage and in this scenario p3 last hit

I tried to come up with something here, but it didn't work.

Have a suggestion to change this part of the code?

Lua:
if (getSkull() == SKULL_NONE) {
            addAttacked(targetPlayer);
            targetPlayer->sendCreatureSkull(this);
        } else if (!targetPlayer->hasAttacked(this)) {
            if (!pzLocked) {
                pzLocked = true;
                sendIcons();
            }
 
i meant p1 getting most, not p2, typo :p
as for the change, i doubt it updates when p3 setting target but instead on infight dropping, someone should test it
 
I know TFS 0.4 Fire3Element had a fix for this issue, im looking entire web for this but found nothing atm.
 
Last edited:
Back
Top