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

[Lua][TFS 1.x] Talkaction to randomize character mount and outfit

E

Evil Puncker

Guest
Hi everyone, I'm looking for a script to randomize the character outfit type, colors and mount, but based only on what they have unlocked, for exemple my GM would be able to use it and get anything possible, while a normal character would get only the unlocked ones and the ones he got from quest whatsoever.

maybe this function by delusium might come in hand:
 
Solution
You need to complete the outfitList with the outfits you want to include (check outfits.xml).
I didn't test this code.
Lua:
local outfitList = {
    [1] = {136, 137, 138, 139}, -- female outfits
    [2] = {128, 129, 130, 131} -- male outfits
}

local unlockedOutfits = {}
local playerSex = player:getSex()

for i = 1, #outfitList[playerSex + 1] do
    if ((player:hasOutfit(outfitList[playerSex + 1][i])) or (player:getGroup():getAccess())) then
        unlockedOutfits[#unlockedOutfits + 1] = outfitList[playerSex + 1][i]
    end
end

if #unlockedOutfits > 0 then
    player:setOutfit({
        lookType = unlockedOutfits[math.random(#unlockedOutfits)],
        lookHead = math.random(0, 132),
        lookBody = math.random(0, 132)...
You need to complete the outfitList with the outfits you want to include (check outfits.xml).
I didn't test this code.
Lua:
local outfitList = {
    [1] = {136, 137, 138, 139}, -- female outfits
    [2] = {128, 129, 130, 131} -- male outfits
}

local unlockedOutfits = {}
local playerSex = player:getSex()

for i = 1, #outfitList[playerSex + 1] do
    if ((player:hasOutfit(outfitList[playerSex + 1][i])) or (player:getGroup():getAccess())) then
        unlockedOutfits[#unlockedOutfits + 1] = outfitList[playerSex + 1][i]
    end
end

if #unlockedOutfits > 0 then
    player:setOutfit({
        lookType = unlockedOutfits[math.random(#unlockedOutfits)],
        lookHead = math.random(0, 132),
        lookBody = math.random(0, 132),
        lookLegs = math.random(0, 132),
        lookFeet = math.random(0, 132)
    })
end
For mounts - you can use a similar logic for the mounts.
Use function player:hasMount(mountId) to check if the player has the mount.
I don't know if there is a LUA function to make the player mount.
 
Solution
Yes, and also lookAddons and lookTypeEx

thanks for the help, now I finally have a funny way to make new NPCs and monsters outfits 🤣🤣🤣

RnLNXcg.gif
 
Back
Top