• 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.2 Outfit/Vocation

lazarus321

Member
Joined
May 8, 2017
Messages
209
Reaction score
20
Hi Guys,

Someone has some script or knows some way to put outfits for vocations in tfs 1.2

thanks.
 
Solution
Hi Apollos, i try add all steps above as you said.

This step "First, set all outfits in oufits.xml to unlocked="no" besides citizen, so the player has an initial outfit. '' is ok,

Next i try to configure in creaturescripts.xml
<event type="login" name="outfit" script="outfit.lua" /> and at login.lua > player:registerEvent("outfit").

No have erros but too dont work for add outfits.

I dont know why.
There's no need to register this event in login.lua because all login creaturescripts are automatically ran.

The problem is that this script is for the very first login. So if you want to test it, you have to go into your database and change lastlogin and lastlogout to 0 for the player that you are testing this with.

Also I...
Hi Guys,

Someone has some script or knows some way to put outfits for vocations in tfs 1.2

thanks.
There may be a better way but this is my Lua solution:

- First, set all outfits in oufits.xml to unlocked="no" besides citizen, so the player has an initial outfit.
- Next, add this in creaturescripts, and configure it the way you want, but make sure you always put female lookType before male:
Lua:
local outfits = {
    [1] = {{138, 130}, {141, 133}}, -- Mage Outfit, Summoner Outfit
    [2] = {{138, 130}, {141, 133}}, -- Mage Outfit, Summoner Outfit
    [3] = {{137, 129}}, -- Hunter Outfit
    [4] = {{139, 131}}  -- Knight Outfit
}

-- IMPORTANT: When adding more to this outfits array, make sure you put female lookType first before male.

function onLogin(player)
    if player:getLastLoginSaved() == 0 then
        local voc, sex = player:getVocation():getBase():getId(), player:getSex()
        for key, outfit in pairs(outfits[voc]) do
            player:addOutfit(outfit[sex + 1])
        end
    end
    return true
end
 
Hi Apollos, i try add all steps above as you said.

This step "First, set all outfits in oufits.xml to unlocked="no" besides citizen, so the player has an initial outfit. '' is ok,

Next i try to configure in creaturescripts.xml
<event type="login" name="outfit" script="outfit.lua" /> and at login.lua > player:registerEvent("outfit").

No have erros but too dont work for add outfits.

I dont know why.
 
Hi Apollos, i try add all steps above as you said.

This step "First, set all outfits in oufits.xml to unlocked="no" besides citizen, so the player has an initial outfit. '' is ok,

Next i try to configure in creaturescripts.xml
<event type="login" name="outfit" script="outfit.lua" /> and at login.lua > player:registerEvent("outfit").

No have erros but too dont work for add outfits.

I dont know why.
There's no need to register this event in login.lua because all login creaturescripts are automatically ran.

The problem is that this script is for the very first login. So if you want to test it, you have to go into your database and change lastlogin and lastlogout to 0 for the player that you are testing this with.

Also I remembered it may be a good idea to do this instead, incase of a player with no vocation:
Lua:
local outfits = {
    [1] = {{138, 130}, {141, 133}}, -- Mage Outfit, Summoner Outfit
    [2] = {{138, 130}, {141, 133}}, -- Mage Outfit, Summoner Outfit
    [3] = {{137, 129}}, -- Hunter Outfit
    [4] = {{139, 131}}  -- Knight Outfit
}

-- IMPORTANT: When adding more to this outfits array, make sure you put female lookType first before male.

function onLogin(player)
    if player:getLastLoginSaved() == 0 then
        local voc, sex = player:getVocation():getBase():getId(), player:getSex()
        if voc > 0 then
            for key, outfit in pairs(outfits[voc]) do
                player:addOutfit(outfit[sex + 1])
            end
        end
    end
    return true
end
 
Solution
Well, i try with new char and get this error "attempt to call method 'getBase' (a nil value)",
i I deleted it and work perfect here thanks bro. Like for you.
 
Well, i try with new char and get this error "attempt to call method 'getBase' (a nil value)",
i I deleted it and work perfect here thanks bro. Like for you.
Add vocations.lua in lib/core then set the dofile to it in lib/core/core.lua then add this:
Lua:
function Vocation.getBase(self)
    local base = self
    while base:getDemotion() do
        base = base:getDemotion()
    end
    return base
end
 
Back
Top