• 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.3) change outfit

EduardoQuintela

New Member
Joined
Mar 10, 2014
Messages
27
Reaction score
1
Hello community, I'm having trouble adding a code to return to the previous outifit. because when cast this spell the player changes the outfit and need to go back to the outfit he was using previously.

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_WATER)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 61)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 1.4) + 8
    local max = (level / 5) + (magicLevel * 2.2) + 14
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local outfitConfig = { newOutfit = 65 }
function onCastSpell(creature, variant)

    creature:getPosition(cid):sendMagicEffect(180)
    creature:setOutfit({lookType = outfitConfig.newOutfit})
    return combat:execute(creature, variant)
end
 
Last edited:
I finally managed to do research. I'll leave the code below for whoever needs it.

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_NORMAL)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)


function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4
    local max = (player:getLevel() / 5) + (skill * attack * 0.04) + 9
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
 
    local prevOutfit = creature:getOutfit()
    local newOutfit = { lookType = 65 }
   
   
        addEvent(function(cid, prev)
            local creature = Creature(cid)
            if not creature then
                return
            end
            creature:setOutfit(prev)
        end, 300, creature:getId(), prevOutfit)
        creature:setOutfit(newOutfit)
   
    creature:getPosition(cid):sendMagicEffect(180)
   
    return combat:execute(creature, variant)
end
 
Back
Top