Forgottenserver: Bug - lose pk with Monsters attacking

Created on 30 Mar 2017  路  3Comments  路  Source: otland/forgottenserver

Steps to reproduce (include any configuration/script required to reproduce)

  1. Take a PK or Pz locked
  2. Run to forgive a monster and let it attack you (I tested with monsters and player atacking the character who gave xlog)
  3. Xlog (close your tibia)
  4. The character will logout in few seconds even all attacking

Expected behaviour


The character must remain online if pk / pz locked.

Actual behaviour


The character will logout in few seconds even all attacking

invalid

Most helpful comment

This bug is not relationed with the forgotten server.
Anyway, you need added checks if player have or not pzLocked. For it, you can use function: isPzLocked().

if target:isPzLocked() then end

All 3 comments

Isn't it dependent on the vocation? Technically you "lose connection" to the game and there's a recent feature regarding it.

Isn't it dependent on the vocation... If the player is being attacked by another player and there are no attacking monsters left, it will remain online. If in case a monster is attacking it will disconnect.

@ranisalt

Edit: Sorry I'm using edited datapack...

my creature.lua in events is like:

function Creature:onTargetCombat(target)
if not self then
return true
end

 if target:isPlayer() then
        if self:isMonster() then
            local protectionStorage = target:getStorageValue(Storage.combatProtectionStorage)

            if target:getIp() == 0 then -- If player is disconnected, monster shall ignore to attack the player
                if protectionStorage <= 0 then
                    addEvent(removeCombatProtection, 30 * 1000, target.uid)
                    target:setStorageValue(Storage.combatProtectionStorage, 1)
                elseif protectionStorage == 1 then
                    self:searchTarget()
                    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
                end

                return true
            end

            if protectionStorage >= os.time() then
                return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
            end
        end
end


return true

end

This bug is not relationed with the forgotten server.
Anyway, you need added checks if player have or not pzLocked. For it, you can use function: isPzLocked().

if target:isPzLocked() then end

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EPuncker picture EPuncker  路  4Comments

marksamman picture marksamman  路  3Comments

TwistedScorpio picture TwistedScorpio  路  5Comments

souzajunior picture souzajunior  路  4Comments

conde2 picture conde2  路  6Comments