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

Random monster color outfit at spawn

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, can someone tell me how to set random color outfit for monster at spawn?
Im tried add it inside a <script></script> in monster file, but im not understand how this tag working :(
 
You can do the outfit change here forgottenserver/monster.lua at master · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/master/data/events/scripts/monster.lua#L11)

Just add something like
Lua:
local outfit = self:getOutfit()

outfit.lookHead = math.random(0, 132)
outfit.lookBody = math.random(0, 132)
outfit.lookLegs = math.random(0, 132)
outfit.lookFeet = math.random(0, 132)

self:setOutfit(outfit)
I forgotte, i want it only for one monster
tfs req?

"self:" in syntax hm
Tfs 1.5 8.6
 
My example from my custom project, but if you can read you can edit:
Lua:
function Monster:onSpawn(position, startup, artificial)
    -- Random head colour
    if (artificial or startup == true or false) and (self:getName() == "random hair coloured guy") then
        local headColors = {0, 19, 38}
        self:setOutfit({lookType = 276, lookHead = headColors[math.random(#headColors)]})
    end
    return true
    --[[    
    -- Random Outfit
    local outfitId = {29, 35, 37, 39, 41, 43, 45, 47}
    if (artificial or startup == true or false) and (self:getName() == "random outfit guy") then
    self:setOutfit({lookType=outfitId[math.random(#outfitId)]})
    end
    return true
    ]]--
end
 
Back
Top