• 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 1.X+ Skull System

Dries390

Well-Known Member
Joined
Sep 8, 2007
Messages
91
Solutions
4
Reaction score
70
Hello again everyone,

I was wondering whether I'm misunderstanding the skull system in Nekiro's 8.6 downgraded TFS 1.3 or something is wrong. Here's an example of the script I'm using.

Lua:
local pzLockTime = 1000 * 60 -- * 15
 
function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return RETURNVALUE_NOERROR
end

function Creature:onTargetCombat(target)
    if self then
        if self:isPlayer() and isPlayer(target) ~= TRUE and (isInArray(listNamesPlayersFemale, target:getName()) or isInArray(listNamesPlayersMale, target:getName())) then
            self:setSkull(SKULL_WHITE)
            self:setSkullTime(pzLockTicks)
        end
    end
    return RETURNVALUE_NOERROR
end

The code correctly applies a white skull to the player but it dissapears much faster than it should and also allows the player to enter a PZ regardless. PVP between two players works correctly. I've tried this on both a GM account and a normal account.
 
Not as far as I know. Testing with two player characters correctly applies white/yellow skulls with the correct duration. It's really the setSkull(skull) and setSkullTime(skullTime) metamethods which seems to be acting a bit wonky. Haven't, as far as I can tell, changed anything pertaining to the skull system either.
 
have you disabled the skull system on source?

need to remove part of this code?
Lua:
void Player::onAttackedCreature(Creature* target, bool addFightTicks /* = true */)
{
    Creature::onAttackedCreature(target);

    if (target->getZone() == ZONE_PVP) {
        return;
    }

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

    if (hasFlag(PlayerFlag_NotGainInFight)) {
        return;
    }

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

        targetPlayer->addInFightTicks();

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

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

                if (targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE) {
                    setSkull(SKULL_WHITE);
                }

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

    if (addFightTicks) {
        addInFightTicks();
    }
}
 
Back
Top