• 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 Outfits per vocation

70011983

Ners
Joined
Nov 21, 2011
Messages
354
Solutions
1
Reaction score
56
Location
Croatia
Hello,
how do I make so a certain vocation has a specific outfit? I mean like, paladin will have ONLY hunter outfit, knight will have ONLY warrior/barbarian etc..
Tried to do it myself but I didn't get any further yet, found several same threads but that wasn't really helpful.
 
The [1] and [2] in config stand for each outfit [picked by vocation ID], and the [1] and [2] in the IF statement stand for character sex ([1] means it will pick the first number (outfit) from {130,145}, [2] means it will pick the second)

config[getPlayerVocation(cid)][1]

Example:
config[1][2] - This [not the actual code, just an example] will pick the first OUTFIT from the config [that means {130,145}], because the character vocation ID would be 1 [sorcerer?], and from that outfit, it will pick the second gender version of it [female I think] - which means it will pick 145
 
You are missing return true above the last end.
Do you get errors when you try to login?

The [1] and [2] get the first and second value in the table.
So for a sorcerer config[getPlayerVocation(cid)][1] = 130 for female and config[getPlayerVocation(cid)][2] = 145 for male.
 
Oh, thanks. Now it works alright, outfit changes depending on vocation and gender.
Had an issue with Acc manager (because it had no vocation and there wasn't any outfit for vocation 0), so I added 1 more in the script.
Code:
[0] = {35, 35}
It seems to work perfectly, thanks.
Will reply back here in case if there is a problem.
 
This worked very well for me to unlock outfits for vocations upon login.

I did get constant debugs when changing outfits because the outfits were disabled in outfits.xml (ofcourse).

So I merged the script with one that @Michael Orsino wrote for me quickly and through some help of an imaginary friend (AI) it gave me back this script which you add to login.lua and it unlocks outfits for vocations upon login.
Players don't debug on normal clients anymore if they try to open the Change Outfit window.

It just works.
Change the vocation names! (in my case races)


add to login.lua
Lua:
local config = {
    Elf = {137, 129},  -- Elf female/male looktype
    Hobbit = {368, 368},  -- Hobbit female/male looktype
    Human = {136, 128},  -- Human female/male looktype
    Dwarf = {155, 151},  -- Dwarf female/male looktype
}

local outfit = getCreatureOutfit(player)
local race = player:getVocation():getName()
local sex = player:getSex()

if config[race] then
    if getPlayerSex(player) == 0 then
        outfit.lookType = config[race][1]
    else
        outfit.lookType = config[race][2]
    end

    doCreatureChangeOutfit(player, outfit)

    if race == "Hobbit" or race == "Elf" or race == "Dwarf" or race == "Human" then
        if sex == PLAYERSEX_MALE then
            if not player:hasOutfit(config[race][2]) then
                player:addOutfit(config[race][2])
            end
        elseif sex == PLAYERSEX_FEMALE then
            if not player:hasOutfit(config[race][1]) then
                player:addOutfit(config[race][1])
            end
        end
    end
end
 
Last edited:
Back
Top Bottom