• 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!

Solved Im trying to do a thing so players can't change the outfit colors but..

focost

New Member
Joined
Jul 22, 2009
Messages
20
Reaction score
0
/events/scripts/creature.lua
Code:
function Player.noChangeBlue(self)
    local outfit_blue = {lookType = 106, lookHead = 106, lookBody = 106, lookLegs = 106, lookFeet = 106, lookAddons = 106}
    self:setStorageValue(900, 1)
    self:setOutfit(outfit_blue)
end

Code:
function Creature:onChangeOutfit(outfit)
    if self:getStorageValue(900) == 1 then -- to avoid infinite loop
        self:setStorageValue(900, 0)
        return true
    else
        addEvent(function() self:noChangeBlue() end, 10)
    end
    return true
end

Like a "allowChangeColors = false", but on tfs 1.1.
I only could do this with addEvent otherwise i get this: "[Error - Events::eventCreatureOnChangeOutfit] Call stack overflow"

Does anyone have a suggestion on how to do it any other better way in TFS 1.1?
 
Last edited:
Bump! >#<
This is for my war server, but im having difficulty to differentiate the teams. Because there is no way to block color change. Is there another way?
 
Only colors shouldn't be changable?
Code:
function Creature:onChangeOutfit(outfit)
     local outp = {outfit.lookFeet, outfit.lookLegs, outfit.lookBody, outfit.lookHead}
     for x = 1, 4 do
         if outp[x] ~= 106 then
             return false
         end
     end
     return true
end
 
Only colors shouldn't be changable?
Code:
function Creature:onChangeOutfit(outfit)
     local outp = {outfit.lookFeet, outfit.lookLegs, outfit.lookBody, outfit.lookHead}
     for x = 1, 4 do
         if outp[x] ~= 106 then
             return false
         end
     end
     return true
end
Cool, although the colors dont change visually, they change internally, causing the next time you login the colors change.

@topic have any suggestions or otherwise?
 
Last edited:
You can do it the way I posted and then add this in login.lua.
Code:
local outfit = player:getOutfit()
player:setOutfit({lookType = outfit.lookType, lookHead = 106, lookBody = 106, lookLegs = 106, lookFeet = 106, lookAddons = outfit.lookAddons})
 
You can do it the way I posted and then add this in login.lua.
Code:
local outfit = player:getOutfit()
player:setOutfit({lookType = outfit.lookType, lookHead = 106, lookBody = 106, lookLegs = 106, lookFeet = 106, lookAddons = outfit.lookAddons})

Yea, thx Limos!
 
Back
Top