• 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+ Change your outfit bonus without the need for a relogin.

Svira

Active Member
Joined
Jan 27, 2008
Messages
263
Solutions
11
Reaction score
35
Hello, as in the topic. The problem is that the bonuses added with the outfit appear after the relogin, not the change of outfit itself.
my login.lua:

Lua:
    -- Outfit bonus
    if player:hasOutfit(player:getOutfit().lookType, 3) then
        local bonusCondition = getBonusCondition(player:getOutfit().lookType)
        if bonusCondition then
            player:addCondition(bonusCondition)
        end
    end
Engine TFS 1.3
I'm using the code: Outfit bonus 1.2

##EDIT
The script below allows you to load bonuses immediately, the item will change the outfit, but it does not delete the previous ones (those from the previous outfit)

Lua:
dofile('data/events/scripts/creature.lua')

function onThink(player)
    if player:hasOutfit(player:getOutfit().lookType, 3) then
    
    local previousBonusCondition = getBonusCondition(player:getOutfit().lookType)
    if previousBonusCondition then
        player:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
    end
    
        local bonusCondition = getBonusCondition(player:getOutfit().lookType)
        player:removeCondition(bonusCondition)
            return player:addCondition(bonusCondition)
        
    end
end
 
Last edited:
Solution
Lua:
dofile('data/events/scripts/creature.lua')

function onThink(player)
    if not player:isPlayer() then
        return true
    end
    -- if player:hasOutfit(player:getOutfit().lookType, 1 or 2 or 3) then
    if player:hasOutfit(player:getOutfit().lookType, 1) or player:hasOutfit(player:getOutfit().lookType, 2) or player:hasOutfit(player:getOutfit().lookType, 3) then
        local previousBonusCondition = getBonusCondition(player:getOutfit().lookType)
        if previousBonusCondition then
        -- print(" 1 ")
            player:removeCondition(previousBonusCondition)
        end
    end
        
    
-- add new bonus
    if player:hasOutfit(player:getOutfit().lookType, 3) then
        local bonusCondition =...
Lua:
dofile('data/events/scripts/creature.lua')

function onThink(player)
    if not player:isPlayer() then
        return true
    end
    -- if player:hasOutfit(player:getOutfit().lookType, 1 or 2 or 3) then
    if player:hasOutfit(player:getOutfit().lookType, 1) or player:hasOutfit(player:getOutfit().lookType, 2) or player:hasOutfit(player:getOutfit().lookType, 3) then
        local previousBonusCondition = getBonusCondition(player:getOutfit().lookType)
        if previousBonusCondition then
        -- print(" 1 ")
            player:removeCondition(previousBonusCondition)
        end
    end
        
    
-- add new bonus
    if player:hasOutfit(player:getOutfit().lookType, 3) then
        local bonusCondition = getBonusCondition(player:getOutfit().lookType)
        if bonusCondition then
        -- print(" 2 ")
            player:addCondition(bonusCondition)
        end
    end
    return true
end
 
Solution
Back
Top