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

Assign Outfits based on Vocation

Doitforthegains

Well-Known Member
Joined
Aug 30, 2014
Messages
231
Reaction score
74
Hello!
So I'm trying to make a "race" system (i.e Humans Vs. Orcs) and I want players to only be able to switch between their respectable outfits. So human vocations would have all the normal outfits and orc vocations having looktypes 2,4,5,6,7,8,50,59,342..
So far this is where I'm at with help from @Zothion
login.lua
Code:
local outfits = {
[{20,21,22,23,24,25,26}] = {2,4,5,6,7,8,50,59,342}, --orcs
[{0,1,2,3,4,5,6,7,8}] = {136,137,138,139,140,141,142,147,148,149,150,155,156,157,158,128,129,130,131,132,133,134,135} --humans
}

local storage = 10101

function onLogin(player)
    if player:getStorageValue(storage) ~= 1 then
        for pos, val in pairs(outfits) do
            if isInArray(pos, player:getVocation():getId()) then
                for i=1,#val do
                player:addOutfit(val[i])
            end
        end
    end
end

Any help would be greatly appreciated, thanks!
 
Last edited:
You should really use variable names which identify what is happening in the script also you should indent the code so it is readable.
Code:
--Vocation outfits
local outfits = {
    [{20,21,22,23,24,25,26}] = {2,4,5,6,7,8,50,59,342}, --orcs
    [{0,1,2,3,4,5,6,7,8}] = {136,137,138,139,140,141,142,147,148,149,150,155,156,157,158} --humans
}

local storage = 10101

function onLogin(player)
    if player:getStorageValue(storage) ~= 1 then
        for vocationIds, outfitIds in pairs(outfits) do
            if isInArray(vocationIds, player:getVocation():getId()) then
                player:setStorageValue(storage, 1)
                for i = 1, #outfitIds do
                    player:addOutfit(outfitIds[i])
                end
            end
        end
    end
    return true
end
 
Oh my bad, I copied the script from a different window that it wasn't tabbed out on! I changed it to what you posted, I have no errors but all vocations still have access to the unlocked human outfits, but not the orc looktypes...I'll just go ahead and post everything dealing with this...
vocations.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientid="0" name="None" description="none" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="2" clientid="4" name="Druid" description="a druid" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="3" clientid="2" name="Paladin" description="a paladin" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="4" clientid="1" name="Knight" description="a knight" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
  
  
  
    <!--Orcs-->
    <vocation id="20" clientid="0" name="Orc" description="an orc" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="21" clientid="4" name="Orc Shaman" description="a orc shaman" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="22" clientid="2" name="Orc Spearman" description="a orc spearman" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="23" clientid="1" name="Orc Warrior" description="a orc warrior" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="1500" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>

    <vocation id="24" clientid="4" name="Mystic Orc Shaman" description="a mystic orc shaman" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="25" clientid="2" name="Orc Marauder" description="an orc marauder" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="26" clientid="1" name="Orc Warlord" description="an orc warlord" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="1000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
  
</vocations>
outfits.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<outfits>
    <!-- Female outfits -->
    <outfit type="0" looktype="136" name="Citizen" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="137" name="Hunter" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="138" name="Mage" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="139" name="Knight" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="140" name="Noblewoman" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="141" name="Summoner" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="142" name="Warrior" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="147" name="Barbarian" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="148" name="Druid" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="149" name="Wizard" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="150" name="Oriental" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="155" name="Pirate" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="156" name="Assassin" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="157" name="Beggar" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="158" name="Shaman" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="252" name="Norsewoman" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="269" name="Nightmare" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="270" name="Jester" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="279" name="Brotherhood" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="288" name="Demonhunter" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="324" name="Yalaharian" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="329" name="Wife" premium="0" unlocked="0" enabled="1" />
    <outfit type="0" looktype="336" name="Warmaster" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="366" name="Wayfarer" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="431" name="Afflicted" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="433" name="Elementalist" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="464" name="Deepling" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="466" name="Insectoid" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="471" name="Entrepreneur" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="513" name="Crystal Warlord" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="514" name="Soil Guardian" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="542" name="Demon" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="575" name="Cave Explorer" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="578" name="Dream Warden" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="618" name="Glooth Engineer" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="620" name="Jersey" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="632" name="Champion" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="635" name="Conjurer" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="636" name="Beastmaster" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="664" name="Chaos Acolyte" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="666" name="Death Herald" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="683" name="Ranger" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="694" name="Ceremonial Garb" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="696" name="Puppeteer" premium="1" unlocked="0" enabled="1" />
    <outfit type="0" looktype="698" name="Spirit Caller" premium="1" unlocked="0" enabled="1" />

    <!-- Male outfits -->
    <outfit type="1" looktype="128" name="Citizen" premium="0" unlocked="1" enabled="1" />
    <outfit type="1" looktype="129" name="Hunter" premium="0" unlocked="1" enabled="1" />
    <outfit type="1" looktype="130" name="Mage" premium="0" unlocked="1" enabled="1" />
    <outfit type="1" looktype="131" name="Knight" premium="0" unlocked="1" enabled="1" />
    <outfit type="1" looktype="132" name="Nobleman" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="133" name="Summoner" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="134" name="Warrior" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="143" name="Barbarian" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="144" name="Druid" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="145" name="Wizard" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="146" name="Oriental" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="151" name="Pirate" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="152" name="Assassin" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="153" name="Beggar" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="154" name="Shaman" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="251" name="Norseman" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="268" name="Nightmare" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="273" name="Jester" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="278" name="Brotherhood" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="289" name="Demonhunter" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="325" name="Yalaharian" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="328" name="Husband" premium="0" unlocked="0" enabled="1" />
    <outfit type="1" looktype="335" name="Warmaster" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="367" name="Wayfarer" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="430" name="Afflicted" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="432" name="Elementalist" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="463" name="Deepling" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="465" name="Insectoid" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="472" name="Entrepreneur" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="512" name="Crystal Warlord" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="516" name="Soil Guardian" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="541" name="Demon" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="574" name="Cave Explorer" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="577" name="Dream Warden" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="610" name="Glooth Engineer" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="619" name="Jersey" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="633" name="Champion" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="634" name="Conjurer" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="637" name="Beastmaster" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="665" name="Chaos Acolyte" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="667" name="Death Herald" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="684" name="Ranger" premium="1" unlocked="0" enabled="1" />
    <outfit type="1" looktype="695" name="Ceremonial Garb" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="697" name="Puppeteer" premium="1" unlocked="1" enabled="1" />
    <outfit type="1" looktype="699" name="Spirit Caller" premium="1" unlocked="1" enabled="1" />
  
  
    <!--Orcs-->
    <outfit type="0" looktype="2" name="Orc Warlord" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="5" name="Orc" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="4" name="Orc Rider" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="6" name="Orc Shaman" premium="0" unlocked="1" enabled="1" />
    <outfit type="0" looktype="7" name="Orc Warrior" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="8" name="Orc Berserker" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="50" name="Orc Spearman" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="59" name="Orc Leader" premium="1" unlocked="1" enabled="1" />
    <outfit type="0" looktype="342" name="Orc Marauder" premium="1" unlocked="1" enabled="1" />
</outfits>
login.lua
Code:
-- ordered as in creaturescripts.xml
local events = {
    'TutorialCockroach',
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'BigfootBurdenWarzone',
    'BigfootBurdenWeeper',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'PlayerDeath',
    'AdvanceSave',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot',
    'modalAD',
    'modalMD',
    'resist'
}

local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end

    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end

function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
        player:sendTutorial(1)
    else
        if loginStr ~= '' then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player:getId()

    -- Stamina
    nextUseStaminaTime[playerId] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if not promotion and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end

    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end

    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end
   
    return true
   
   
   
end
I took the added script out of login.lua so you could see what it looked like before, maybe I'm just placing it wrong.
 
Ahhh nevermind!! I had something wrong but it's working now! I just need to figure out how to add the basic onLogins into the script like
Code:
if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
since you spawn in with a default citizen outfit on
 
Ahhh nevermind!! I had something wrong but it's working now! I just need to figure out how to add the basic onLogins into the script like
Code:
if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
since you spawn in with a default citizen outfit on
Well if that section of the code sends a message to the player to choose an outfit you would want the player to receive the outfits before they receive the message.

Using sendOutfitWindow after the above code block has executed this way they can choose their new outfit.
Code:
player:sendOutfitWindow()
Code is commented with its execution
Code:
-- ordered as in creaturescripts.xml
local events = {
    'TutorialCockroach',
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'BigfootBurdenWarzone',
    'BigfootBurdenWeeper',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'PlayerDeath',
    'AdvanceSave',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot',
    'modalAD',
    'modalMD',
    'resist'
}

local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end

    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end

function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
        -- since its the 1st time logging in we don't need to check a storage since this will only execute the one time based on the last login save
        for vocationIds, outfitIds in pairs(outfits) do
            if isInArray(vocationIds, player:getVocation():getId()) then
                player:setStorageValue(storage, 1)
                for i = 1, #outfitIds do
                    player:addOutfit(outfitIds[i])
                end
            end
        end
        -- now that we have assigned the player some outfits we can send them the message
        loginStr = loginStr .. ' Please choose your outfit.'
        -- and even the outfit window
        player:sendOutfitWindow()
        player:sendTutorial(1)
    else
        if loginStr ~= '' then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player:getId()

    -- Stamina
    nextUseStaminaTime[playerId] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if not promotion and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end

    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end

    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end

    return true
end
 
@Doitforthegains if you do that humans will have famale and male outfits (you can change it through onLogin also.), if i were to do this, i'd create a new type for orcs.
i think add your races here should be enough.
https://github.com/otland/forgotten...991555d560c56f8bd246e209/src/enums.h#L317-322
example:
Code:
enum PlayerSex_t : uint8_t {
    PLAYERSEX_FEMALE = 0,
    PLAYERSEX_MALE = 1,
    PLAYERRACE_ORC = 2,

    PLAYERSEX_LAST = PLAYERRACE_ORC
};
so then you can transform the gender system into a race system, you don't even need that in login.lua, server will only allow "orcs" use outfits of type 2 and you can fill it to elves or anything you want to, just remember to define PLAYERSEX_LAST into your last race, tho i don't tested, afaik there is no problem in doing this.
 
Last edited:
Back
Top