• 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+ Help In [TFS 1.3] Item Sets

Guerra

Member
Joined
May 1, 2018
Messages
69
Reaction score
9
Location
Natal/RN - Brasil
Hi, guys!

I installed the oen432 [TFS 1.3] Item Sets System. Everything went well with the system, but I had a problem with onLook.

in events/scripts/players.lua:
Find Player:eek:nLook and under local description = "You see " .. thing:getDescription(distance)
and
Add description = onItemSetLook(self, thing, position, distance, description)

my player.lua is like this
player lua.PNG
I tried to add this line even though I didn't have it in the original file to see if it worked but it didn't work.

should look like this:
1556897345134.png

but mine just looks like this
Capturar.PNG

the rest of the system is working without errors but is not appearing in the look at all. Please, can someone help me! I'll attach my player.lua and the system link I used.

Lua:
function Player:onBrowseField(position)
    if hasEventCallback(EVENT_CALLBACK_ONBROWSEFIELD) then
        return EventCallback(EVENT_CALLBACK_ONBROWSEFIELD, self, position)
    else
        return true
    end
end

function Player:onLook(thing, position, distance)
    -- Era pra ter o local description = "You see " aqui... --
    local ret = EventCallback(EVENT_CALLBACK_ONLOOK, self, thing, position, distance)if thing:isCreature() then
    -- Task System --
        if thing:isPlayer() then
            ret = string.format("%s\nTask Rank: "..getRankTask(thing), ret)
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, ret)
end

function Player:onLookInBattleList(creature, distance)
    local ret = EventCallback(EVENT_CALLBACK_ONLOOKINBATTLELIST, self, creature, distance)
    self:sendTextMessage(MESSAGE_INFO_DESCR, ret)
end

function Player:onLookInTrade(partner, item, distance)
    local description = "You see " .. item:getDescription(distance)
    local ret = hasEventCallback(EVENT_CALLBACK_ONLOOKINTRADE) and EventCallback(EVENT_CALLBACK_ONLOOKINTRADE, self, partner, item, distance, description) or description
    self:sendTextMessage(MESSAGE_INFO_DESCR, ret)
end

function Player:onLookInShop(itemType, count, description)
    local description = "You see " .. description
    local ret = hasEventCallback(EVENT_CALLBACK_ONLOOKINSHOP) and EventCallback(EVENT_CALLBACK_ONLOOKINSHOP, self, itemType, count, description) or description
    self:sendTextMessage(MESSAGE_INFO_DESCR, ret)
end

function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if hasEventCallback(EVENT_CALLBACK_ONMOVEITEM) then
        return EventCallback(EVENT_CALLBACK_ONMOVEITEM, self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    else
        return true
    end
end

function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
onItemSetMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if hasEventCallback(EVENT_CALLBACK_ONITEMMOVED) then
        EventCallback(EVENT_CALLBACK_ONITEMMOVED, self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    end
end

function Player:onMoveCreature(creature, fromPosition, toPosition)
    if hasEventCallback(EVENT_CALLBACK_ONMOVECREATURE) then
        return EventCallback(EVENT_CALLBACK_ONMOVECREATURE, self, creature, fromPosition, toPosition)
    else
        return true
    end
end

function Player:onReportRuleViolation(targetName, reportType, reportReason, comment, translation)
    if hasEventCallback(EVENT_CALLBACK_ONREPORTRULEVIOLATION) then
        EventCallback(EVENT_CALLBACK_ONREPORTRULEVIOLATION, self, targetName, reportType, reportReason, comment, translation)
    end
end

function Player:onReportBug(message, position, category)
    if hasEventCallback(EVENT_CALLBACK_ONREPORTBUG) then
        return EventCallback(EVENT_CALLBACK_ONREPORTBUG, self, message, position, category)
    else
        return true
    end
end

function Player:onTurn(direction)
    if hasEventCallback(EVENT_CALLBACK_ONTURN) then
        return EventCallback(EVENT_CALLBACK_ONTURN, self, direction)
    else
        return true
    end
end

function Player:onTradeRequest(target, item)
    if hasEventCallback(EVENT_CALLBACK_ONTRADEREQUEST) then
        return EventCallback(EVENT_CALLBACK_ONTRADEREQUEST, self, target, item)
    else
        return true
    end
end

function Player:onTradeAccept(target, item, targetItem)
    if hasEventCallback(EVENT_CALLBACK_ONTRADEACCEPT) then
        return EventCallback(EVENT_CALLBACK_ONTRADEACCEPT, self, target, item, targetItem)
    else
        return true
    end
end

function Player:onTradeCompleted(target, item, targetItem, isSuccess)
    if hasEventCallback(EVENT_CALLBACK_ONTRADECOMPLETED) then
        EventCallback(EVENT_CALLBACK_ONTRADECOMPLETED, self, target, item, targetItem, isSuccess)
    end
end

local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)

local function useStamina(player)
    local staminaMinutes = player:getStamina()
    if staminaMinutes == 0 then
        return
    end

    local playerId = player:getId()
    local currentTime = os.time()
    local timePassed = currentTime - nextUseStaminaTime[playerId]
    if timePassed <= 0 then
        return
    end

    if timePassed > 60 then
        if staminaMinutes > 2 then
            staminaMinutes = staminaMinutes - 2
        else
            staminaMinutes = 0
        end
        nextUseStaminaTime[playerId] = currentTime + 120
    else
        staminaMinutes = staminaMinutes - 1
        nextUseStaminaTime[playerId] = currentTime + 60
    end
    player:setStamina(staminaMinutes)
end

function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
    onItemSetsGainExperience(self, source, exp, rawExp)
        return exp
    end

    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end

    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())

    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end

    return hasEventCallback(EVENT_CALLBACK_ONGAINEXPERIENCE) and EventCallback(EVENT_CALLBACK_ONGAINEXPERIENCE, self, source, exp, rawExp) or exp
end

function Player:onLoseExperience(exp)
    return hasEventCallback(EVENT_CALLBACK_ONLOSEEXPERIENCE) and EventCallback(EVENT_CALLBACK_ONLOSEEXPERIENCE, self, exp) or exp
end

function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
        return hasEventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES) and EventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES, self, skill, tries) or tries
    end

    if skill == SKILL_MAGLEVEL then
        tries = tries * configManager.getNumber(configKeys.RATE_MAGIC)
        return hasEventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES) and EventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES, self, skill, tries) or tries
    end
    tries = tries * configManager.getNumber(configKeys.RATE_SKILL)
    return hasEventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES) and EventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES, self, skill, tries) or tries
end

function Player:onWrapItem(item)
    local topCylinder = item:getTopParent()
    if not topCylinder then
        return
    end

    local tile = Tile(topCylinder:getPosition())
    if not tile then
        return
    end

    local house = tile:getHouse()
    if not house then
        self:sendCancelMessage("You can only wrap and unwrap this item inside a house.")
        return
    end

    if house ~= self:getHouse() and not string.find(house:getAccessList(SUBOWNER_LIST):lower(), "%f[%a]" .. self:getName():lower() .. "%f[%A]") then
        self:sendCancelMessage("You cannot wrap or unwrap items from a house, which you are only guest to.")
        return
    end

    local wrapId = item:getAttribute("wrapid")
    if wrapId == 0 then
        return
    end

    if not hasEventCallback(EVENT_CALLBACK_ONWRAPITEM) or EventCallback(EVENT_CALLBACK_ONWRAPITEM, self, item) then
        local oldId = item:getId()
        item:remove(1)
        local item = tile:addItem(wrapId)
        if item then
            item:setAttribute("wrapid", oldId)
        end
    end
end

Official System Post I'm using:
 
The thing you are looking for should be there:
\data\scripts\eventcallbacks\player\default_onLook.lua
 
Back
Top