• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

TFS 1.X+ Change your outfit bonus without the need for a relogin.

Svira

Member
Joined
Jan 27, 2008
Messages
206
Solutions
7
Reaction score
20
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 =...
OP
OP
Svira

Svira

Member
Joined
Jan 27, 2008
Messages
206
Solutions
7
Reaction score
20
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
Top