• 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.X+ TFS 1.3 - Doubt About Outfits.

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
206
Hello everybody.I'm using tfs 1.3 downgraded to 8.6.I use otcv8, when you right click on the character and set outfit, the list of outfits he has appears.

There are some outfits that are from quests, the player does the quest and receives the outfit, for example:

LUA:
player:addOutfit(OUTFIT_ID, ADDONS)

So far so good, he does the quest and the outfit appears when he right-clicks and sets outfit.

However, in my game there will be the option for the player to change their vocation. For example, he was a Knight, he acquired the Knight quest outfit and now he changed his vocation to Sorcerer.
So that outfit he acquired when he was a knight, keeps appearing.
How to remove?

IMPORTANT NOTE: If he changes his vocation to Knight again, all the outfits he had when he was a knight must appear again.

I appreciate everyone's support, thanks bro
 
I think the only solution is to attribute every outfit and addon with a storage value.

Then when the character changes vocation, loop through all the storages and add/remove the outfits and addons.
 
I think the only solution is to attribute every outfit and addon with a storage value.

Then when the character changes vocation, loop through all the storages and add/remove the outfits and addons.

Xikini, thank you for the answer.
I've been noticing that in the XML there is a Type option, which refers to the player's gender, to display or not.
I thought it would be possible to add new information, called vocation or vocationID, would this be possible? through source editing, of course.
At the moment:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<outfits>
    <!-- Female outfits -->
    <outfit type="0" looktype="136" name="Citizen" premium="no" unlocked="yes" enabled="yes" />

<!-- Male outfits -->
    <outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />

idea of how it might work
XML:
<?xml version="1.0" encoding="UTF-8"?>
<outfits>
    <!-- Female outfits -->
    <outfit type="0" looktype="136" name="Citizen" premium="no" unlocked="yes" enabled="yes" vocationID = "1, 4" />
<!-- Male outfits -->
    <outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" vocationID = "1, 4"/>
 
Well, talking from memory, as i have recently worked with outfits. You need to modify the outfit class, loadXML method to retrieve the vocation id and save it into another variable (like type)
And create a new method to gett all outfits from one vocation and gender

Then you will also need to modify the requestOutfitWindow (or something like that) where the server gets all the outfits and sends the list to the client
 
Need help yet.
How can i set some outfits with storages?
If player have storage (100 , 1) - appears outfit X.
if player have storage (101, 1) - appears outfit Z
I use otcv8, probably need some edit here, but i dont know how?!

 
Last edited:
Need help yet.
How can i set some outfits with storages?
If player have storage (100 , 1) - appears outfit X.
if player have storage (101, 1) - appears outfit Z
I use otcv8, probably need some edit here, but i dont know how?!

Why would you use special storages? Cant you use reserved storages for outfits using addOutfit??
 
on login check vocation and add/remove outfits he had based on that

LUA:
    --GOLDEN outfit
   
    local goldenoutfit_owner = "someplayername" -- richest player
    local goldenOutfitLookType1 = 993  -- LookType for the first Golden Outfit
    local goldenOutfitLookType2 = 992  -- LookType for the second Golden Outfit
    local goldenOutfitAddon1 = 1      -- Addon 1 for Golden Outfit
    local goldenOutfitAddon2 = 2      -- Addon 2 for Golden Outfit
    -- Check if the player is someplayername
    if player:getName() == goldenoutfit_owner then
        -- If the player is someplayername and doesn't have the outfit, add it
        if not player:hasOutfit(993) then
            player:addOutfit(993)  -- Add the first golden outfit
           

        end
        if not player:hasOutfit(992) then
            player:addOutfit(992)  -- Add the second golden outfit\
           
        end
        player:addOutfitAddon(992, 3)  -- Add addon 3 for outfit 992
        player:addOutfitAddon(993, 3)  -- Add addon 3 for outfit 993
           
    else
        -- If the player is not someplayername but has the outfit, remove it along with addons
       
        if player:hasOutfit(993) then
            player:removeOutfit(993)  -- Remove the first golden outfit
         
        end
       
        if player:hasOutfit(992) then
            player:removeOutfit(992)  -- Remove the second golden outfit
         
        end
    end
     -- Handle changing the outfit if the player is wearing a golden outfit but doesn't own it
    local playerOutfit = player:getOutfit()
   
       
    if playerOutfit.lookType == 993 or playerOutfit.lookType == 992 and player:getName() ~= goldenoutfit_owner then
            if player:getSex() == PLAYERSEX_FEMALE then
            -- Change the player's outfit to the new one
           
                playerOutfit.lookType = 136
                playerOutfit.lookAddons = 0
                player:setOutfit(playerOutfit)
           
            else
            playerOutfit.lookType = 128
            playerOutfit.lookAddons = 0
            player:setOutfit(playerOutfit)
           
            end
    end
 
Hello everybody.I'm using tfs 1.3 downgraded to 8.6.I use otcv8, when you right click on the character and set outfit, the list of outfits he has appears.

There are some outfits that are from quests, the player does the quest and receives the outfit, for example:

LUA:
player:addOutfit(OUTFIT_ID, ADDONS)

So far so good, he does the quest and the outfit appears when he right-clicks and sets outfit.

However, in my game there will be the option for the player to change their vocation. For example, he was a Knight, he acquired the Knight quest outfit and now he changed his vocation to Sorcerer.
So that outfit he acquired when he was a knight, keeps appearing.
How to remove?

IMPORTANT NOTE: If he changes his vocation to Knight again, all the outfits he had when he was a knight must appear again.

I appreciate everyone's support, thanks bro
If your TFS 1.3 supports EventCallback, you can implement an 'onChangeOutfit' method in data/scripts using REVscript, allowing exclusive outfits for each vocation. Players will be able to change outfits only if their vocation is compatible with the selected outfit. During login (onLogin), the system will verify and remove any outfits not compatible with the player's vocation.

If your TFS does not support EventCallback, you can handle this directly in data/events/creature.lua by editing the onChangeOutfit function to include the desired logic. Additionally, in data/creaturescripts/login.lua, implement a check during login to ensure the player's current outfit matches the allowed vocation outfits, removing any incompatible outfits automatically.
 
Xikini, thank you for the answer.
Changing the source might be better.. but

I think the only solution is to attribute every outfit and addon with a storage value.

Then when the character changes vocation, loop through all the storages and add/remove the outfits and addons.
Figured I'd go through and actually make the function in Lua.

If player has the outfit storage (any value greater then 0)
and they are the correct vocation (or all vocations can use outfit)

then give the outfit.
otherwise, remove it.

if the player is wearing an outfit their vocation cannot wear, then set them to a default outfit.

LUA:
function Player.confirmOutfits(self)

    local vocationOutfits = {
        default = {
            [1] = {male = 128, female = 136}, -- if the player is wearing an outfit their vocation can't use, it will set their outfit to this default outfit.
            [2] = {male = 128, female = 136},
            [3] = {male = 128, female = 136},
            [4] = {male = 128, female = 136},
            [5] = {male = 128, female = 136},
            [6] = {male = 128, female = 136},
            [7] = {male = 128, female = 136},
            [8] = {male = 128, female = 136}
        },
       
        list = {   
            -- Female outfits
            {looktype="136" , storage = 11111, vocations = {0} }, -- 0 means all vocations can use the outfit
            {looktype="137" , storage = 11111, vocations = {1, 2, 5, 6} }, -- input as many vocations as you want who can wear this outfit
            {looktype="138" , storage = 11111, vocations = {0} },
            {looktype="139" , storage = 11111, vocations = {0} }, -- if storage > 0, then we assume the player has unlocked this outfit
            {looktype="140" , storage = 11111, vocations = {0} },
            {looktype="141" , storage = 11111, vocations = {0} },
            {looktype="142" , storage = 11111, vocations = {0} },
            {looktype="147" , storage = 11111, vocations = {0} },
            {looktype="148" , storage = 11111, vocations = {0} },
            {looktype="149" , storage = 11111, vocations = {0} },
            {looktype="150" , storage = 11111, vocations = {0} },
            {looktype="155" , storage = 11111, vocations = {0} },
            {looktype="156" , storage = 11111, vocations = {0} },
            {looktype="157" , storage = 11111, vocations = {0} },
            {looktype="158" , storage = 11111, vocations = {0} },
            {looktype="252" , storage = 11111, vocations = {0} },
            {looktype="269" , storage = 11111, vocations = {0} },
            {looktype="270" , storage = 11111, vocations = {0} },
            {looktype="279" , storage = 11111, vocations = {0} },
            {looktype="288" , storage = 11111, vocations = {0} },
            {looktype="324" , storage = 11111, vocations = {0} },
            {looktype="329" , storage = 11111, vocations = {0} },
            {looktype="336" , storage = 11111, vocations = {0} },
            {looktype="366" , storage = 11111, vocations = {0} },
            {looktype="431" , storage = 11111, vocations = {0} },
            {looktype="433" , storage = 11111, vocations = {0} },
            {looktype="464" , storage = 11111, vocations = {0} },
            {looktype="466" , storage = 11111, vocations = {0} },
            {looktype="471" , storage = 11111, vocations = {0} },
            {looktype="513" , storage = 11111, vocations = {0} },
            {looktype="514" , storage = 11111, vocations = {0} },
            {looktype="542" , storage = 11111, vocations = {0} },
            {looktype="575" , storage = 11111, vocations = {0} },
            {looktype="578" , storage = 11111, vocations = {0} },
            {looktype="618" , storage = 11111, vocations = {0} },
            {looktype="620" , storage = 11111, vocations = {0} },
            {looktype="632" , storage = 11111, vocations = {0} },
            {looktype="635" , storage = 11111, vocations = {0} },
            {looktype="636" , storage = 11111, vocations = {0} },
            {looktype="664" , storage = 11111, vocations = {0} },
            {looktype="666" , storage = 11111, vocations = {0} },
            {looktype="683" , storage = 11111, vocations = {0} },
            {looktype="694" , storage = 11111, vocations = {0} },
            {looktype="696" , storage = 11111, vocations = {0} },
            {looktype="698" , storage = 11111, vocations = {0} },
            {looktype="724" , storage = 11111, vocations = {0} },
            {looktype="732" , storage = 11111, vocations = {0} },
            {looktype="745" , storage = 11111, vocations = {0} },
            {looktype="749" , storage = 11111, vocations = {0} },
            {looktype="759" , storage = 11111, vocations = {0} },
            {looktype="845" , storage = 11111, vocations = {0} },
            {looktype="852" , storage = 11111, vocations = {0} },
            {looktype="874" , storage = 11111, vocations = {0} },
            {looktype="885" , storage = 11111, vocations = {0} },
            {looktype="900" , storage = 11111, vocations = {0} },
            {looktype="909" , storage = 11111, vocations = {0} },
            {looktype="929" , storage = 11111, vocations = {0} },
            {looktype="956" , storage = 11111, vocations = {0} },
            {looktype="958" , storage = 11111, vocations = {0} },
            {looktype="963" , storage = 11111, vocations = {0} },
            {looktype="965" , storage = 11111, vocations = {0} },
            {looktype="967" , storage = 11111, vocations = {0} },
            {looktype="969" , storage = 11111, vocations = {0} },
            {looktype="971" , storage = 11111, vocations = {0} },
            {looktype="973" , storage = 11111, vocations = {0} },
            {looktype="975" , storage = 11111, vocations = {0} },
            {looktype="1020", storage = 11111, vocations = {0} },
            {looktype="1024", storage = 11111, vocations = {0} },
            {looktype="1043", storage = 11111, vocations = {0} },
            {looktype="1050", storage = 11111, vocations = {0} },
            {looktype="1057", storage = 11111, vocations = {0} },
            {looktype="1070", storage = 11111, vocations = {0} },
            {looktype="1095", storage = 11111, vocations = {0} },
            {looktype="1103", storage = 11111, vocations = {0} },
            {looktype="1128", storage = 11111, vocations = {0} },
            {looktype="1147", storage = 11111, vocations = {0} },
            {looktype="1162", storage = 11111, vocations = {0} },
            {looktype="1174", storage = 11111, vocations = {0} },
            {looktype="1187", storage = 11111, vocations = {0} },
            {looktype="1203", storage = 11111, vocations = {0} },
            {looktype="1205", storage = 11111, vocations = {0} },
            {looktype="1207", storage = 11111, vocations = {0} },
            {looktype="1211", storage = 11111, vocations = {0} },
            {looktype="1244", storage = 11111, vocations = {0} },
            {looktype="1246", storage = 11111, vocations = {0} },
            {looktype="1252", storage = 11111, vocations = {0} },
            {looktype="1271", storage = 11111, vocations = {0} },
            {looktype="1280", storage = 11111, vocations = {0} },
            {looktype="1283", storage = 11111, vocations = {0} },
            {looktype="1289", storage = 11111, vocations = {0} },
            {looktype="1293", storage = 11111, vocations = {0} },
            {looktype="1323", storage = 11111, vocations = {0} },
            {looktype="1332", storage = 11111, vocations = {0} },
            {looktype="1339", storage = 11111, vocations = {0} },
            {looktype="1372", storage = 11111, vocations = {0} },
            {looktype="1383", storage = 11111, vocations = {0} },
            {looktype="1385", storage = 11111, vocations = {0} },
            {looktype="1387", storage = 11111, vocations = {0} },
            {looktype="1416", storage = 11111, vocations = {0} },
            {looktype="1437", storage = 11111, vocations = {0} },
            {looktype="1445", storage = 11111, vocations = {0} },
            {looktype="1450", storage = 11111, vocations = {0} },
            {looktype="1456", storage = 11111, vocations = {0} },
            {looktype="1461", storage = 11111, vocations = {0} },
            {looktype="1490", storage = 11111, vocations = {0} },
            {looktype="1501", storage = 11111, vocations = {0} },
            {looktype="1569", storage = 11111, vocations = {0} },
            {looktype="1576", storage = 11111, vocations = {0} },
            {looktype="1582", storage = 11111, vocations = {0} },
            {looktype="1598", storage = 11111, vocations = {0} },
   
            -- Male outfits
            {looktype="128" , storage = 11111, vocations = {0} },
            {looktype="129" , storage = 11111, vocations = {0} },
            {looktype="130" , storage = 11111, vocations = {0} },
            {looktype="131" , storage = 11111, vocations = {0} },
            {looktype="132" , storage = 11111, vocations = {0} },
            {looktype="133" , storage = 11111, vocations = {0} },
            {looktype="134" , storage = 11111, vocations = {0} },
            {looktype="143" , storage = 11111, vocations = {0} },
            {looktype="144" , storage = 11111, vocations = {0} },
            {looktype="145" , storage = 11111, vocations = {0} },
            {looktype="146" , storage = 11111, vocations = {0} },
            {looktype="151" , storage = 11111, vocations = {0} },
            {looktype="152" , storage = 11111, vocations = {0} },
            {looktype="153" , storage = 11111, vocations = {0} },
            {looktype="154" , storage = 11111, vocations = {0} },
            {looktype="251" , storage = 11111, vocations = {0} },
            {looktype="268" , storage = 11111, vocations = {0} },
            {looktype="273" , storage = 11111, vocations = {0} },
            {looktype="278" , storage = 11111, vocations = {0} },
            {looktype="289" , storage = 11111, vocations = {0} },
            {looktype="325" , storage = 11111, vocations = {0} },
            {looktype="328" , storage = 11111, vocations = {0} },
            {looktype="335" , storage = 11111, vocations = {0} },
            {looktype="367" , storage = 11111, vocations = {0} },
            {looktype="430" , storage = 11111, vocations = {0} },
            {looktype="432" , storage = 11111, vocations = {0} },
            {looktype="463" , storage = 11111, vocations = {0} },
            {looktype="465" , storage = 11111, vocations = {0} },
            {looktype="472" , storage = 11111, vocations = {0} },
            {looktype="512" , storage = 11111, vocations = {0} },
            {looktype="516" , storage = 11111, vocations = {0} },
            {looktype="541" , storage = 11111, vocations = {0} },
            {looktype="574" , storage = 11111, vocations = {0} },
            {looktype="577" , storage = 11111, vocations = {0} },
            {looktype="610" , storage = 11111, vocations = {0} },
            {looktype="619" , storage = 11111, vocations = {0} },
            {looktype="633" , storage = 11111, vocations = {0} },
            {looktype="634" , storage = 11111, vocations = {0} },
            {looktype="637" , storage = 11111, vocations = {0} },
            {looktype="665" , storage = 11111, vocations = {0} },
            {looktype="667" , storage = 11111, vocations = {0} },
            {looktype="684" , storage = 11111, vocations = {0} },
            {looktype="695" , storage = 11111, vocations = {0} },
            {looktype="697" , storage = 11111, vocations = {0} },
            {looktype="699" , storage = 11111, vocations = {0} },
            {looktype="725" , storage = 11111, vocations = {0} },
            {looktype="733" , storage = 11111, vocations = {0} },
            {looktype="746" , storage = 11111, vocations = {0} },
            {looktype="750" , storage = 11111, vocations = {0} },
            {looktype="760" , storage = 11111, vocations = {0} },
            {looktype="846" , storage = 11111, vocations = {0} },
            {looktype="853" , storage = 11111, vocations = {0} },
            {looktype="873" , storage = 11111, vocations = {0} },
            {looktype="884" , storage = 11111, vocations = {0} },
            {looktype="899" , storage = 11111, vocations = {0} },
            {looktype="908" , storage = 11111, vocations = {0} },
            {looktype="931" , storage = 11111, vocations = {0} },
            {looktype="955" , storage = 11111, vocations = {0} },
            {looktype="957" , storage = 11111, vocations = {0} },
            {looktype="962" , storage = 11111, vocations = {0} },
            {looktype="964" , storage = 11111, vocations = {0} },
            {looktype="966" , storage = 11111, vocations = {0} },
            {looktype="968" , storage = 11111, vocations = {0} },
            {looktype="970" , storage = 11111, vocations = {0} },
            {looktype="972" , storage = 11111, vocations = {0} },
            {looktype="974" , storage = 11111, vocations = {0} },
            {looktype="1021", storage = 11111, vocations = {0} },
            {looktype="1023", storage = 11111, vocations = {0} },
            {looktype="1042", storage = 11111, vocations = {0} },
            {looktype="1051", storage = 11111, vocations = {0} },
            {looktype="1056", storage = 11111, vocations = {0} },
            {looktype="1069", storage = 11111, vocations = {0} },
            {looktype="1094", storage = 11111, vocations = {0} },
            {looktype="1102", storage = 11111, vocations = {0} },
            {looktype="1127", storage = 11111, vocations = {0} },
            {looktype="1146", storage = 11111, vocations = {0} },
            {looktype="1161", storage = 11111, vocations = {0} },
            {looktype="1173", storage = 11111, vocations = {0} },
            {looktype="1186", storage = 11111, vocations = {0} },
            {looktype="1202", storage = 11111, vocations = {0} },
            {looktype="1204", storage = 11111, vocations = {0} },
            {looktype="1206", storage = 11111, vocations = {0} },
            {looktype="1210", storage = 11111, vocations = {0} },
            {looktype="1243", storage = 11111, vocations = {0} },
            {looktype="1245", storage = 11111, vocations = {0} },
            {looktype="1251", storage = 11111, vocations = {0} },
            {looktype="1270", storage = 11111, vocations = {0} },
            {looktype="1279", storage = 11111, vocations = {0} },
            {looktype="1282", storage = 11111, vocations = {0} },
            {looktype="1288", storage = 11111, vocations = {0} },
            {looktype="1292", storage = 11111, vocations = {0} },
            {looktype="1322", storage = 11111, vocations = {0} },
            {looktype="1331", storage = 11111, vocations = {0} },
            {looktype="1338", storage = 11111, vocations = {0} },
            {looktype="1371", storage = 11111, vocations = {0} },
            {looktype="1382", storage = 11111, vocations = {0} },
            {looktype="1384", storage = 11111, vocations = {0} },
            {looktype="1386", storage = 11111, vocations = {0} },
            {looktype="1415", storage = 11111, vocations = {0} },
            {looktype="1436", storage = 11111, vocations = {0} },
            {looktype="1444", storage = 11111, vocations = {0} },
            {looktype="1449", storage = 11111, vocations = {0} },
            {looktype="1457", storage = 11111, vocations = {0} },
            {looktype="1460", storage = 11111, vocations = {0} },
            {looktype="1489", storage = 11111, vocations = {0} },
            {looktype="1500", storage = 11111, vocations = {0} },
            {looktype="1568", storage = 11111, vocations = {0} },
            {looktype="1575", storage = 11111, vocations = {0} },
            {looktype="1581", storage = 11111, vocations = {0} },
            {looktype="1597", storage = 11111, vocations = {0} }
        }
    }

    local changeOutfit = false
    local outfit = self:getOutfit()
    local vocationId = self:getVocation():getId()
   
    for k, v in pairs(vocationOutfits.list)
        if self:getStorageValue(v.storage) <= 0 or (not table.contains(v.vocations, 0) and not table.contains(v.vocations, vocationId)) then
            if outfit.lookType == v.looktype then
                changeOutfit = true
            end
            if self:hasOutfit(v.looktype) then
                self:removeOutfit(v.looktype)
            end
        else
            if not self:hasOutfit(v.looktype) then
                self:addOutfit(v.looktype)
            end
        end
    end
    if changeOutfit then
        local sex = self:getSex() == 0 and "female" or "male"       
        outfit.lookType = vocationOutfits.default[vocationId][sex]
        self:setOutfit(outfit)
    end
    return true
end
 
Back
Top