• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua [TFS 1.3] Problem with setOutfit

.Smile

Member
Joined
Jan 27, 2019
Messages
29
Reaction score
11
Hello friends, I would like your help with a little problem I am facing with setOutfit.

The Code below is intended to give a certain outfit based on the player's current outfit, that part of the code is working.

LUA:
local combat = Combat()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local rage = Condition(CONDITION_ATTRIBUTES)
rage:setParameter(CONDITION_PARAM_TICKS, 1000 * 60)
rage:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 10)
rage:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
combat:addCondition(rage)

function onCastSpell(creature, variant)
    local player = creature:getPlayer()
    local myoutfit = creature:getOutfit()

local rageTransform = {
        [100] = {transformed = 1000},
        [200] = {transformed = 2000},
        [300] = {transformed = 3000},
    }

    local rageoutfit = Condition(CONDITION_OUTFIT)
    rageoutfit:setTicks(1000 * 60)

    rageoutfit:setOutfit({lookType = rageTransform[myoutfit.lookType].transformed})
    combat:addCondition(rageoutfit)     
    combat:execute(creature, variant)
    return true
end

The problem is that if the Player uses this spell and has outfit 100 he goes to outfit 1000, after the spell ends if he has outfit 200 instead of outfit 2000 he goes to outfit 1000 if he uses with outfit 300 instead of outfit 3000 he goes to outfit 1000, basically the spell stores the value of the player's first use and saves it until the server shuts down.

NOTE: I used the same code as Talkaction and it worked perfectly, apparently the problem is using as a spell.
 
Back
Top