• 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 firstitems.xml

God Mythera

Veteran OT User
Joined
Aug 11, 2012
Messages
2,048
Solutions
2
Reaction score
256
Location
United States
can anyone help me fix this possibly? i cant find out why it doesn't work ;\

Code:
local config = {
[1] = {
--equipment; Soldier Helmet, Wand of Vortex, Brass Armor, Brass Legs, Amulet of Loss, Black Shield, Leather Boots
{{2481, 1}, {2190, 1}, {2465, 1}, {2478, 1}, {2173, 1}, {2529, 1}, {2643, 1}},
--container; Rope, Light Shovel, 50 Platinum Coins, 100 Brown Mushroom
{{8712, 1}, {5710, 1}, {2152, 50}, {2789, 100}}
},
[2] = {
--equipment; Soldier Helmet, Snakebite Rod, Brass Armor, Brass Legs, Amulet of Loss, Black Shield, Leather Boots
{{2481, 1}, {2182, 1}, {2465, 1}, {2478, 1}, {2173, 1}, {2529, 1}, {2643, 1}},
--container; Rope, Light Shovel, 50 Platinum Coins, 100 Brown Mushroom
{{8712, 1}, {5710, 1}, {2152, 50}, {2789, 100}}
},
[3] = {
--equipment; Soldier Helmet, Bow, Brass Armor, Brass Legs, Amulet of Loss, 100 Arrow, Leather Boots
{{2481, 1}, {2456, 1}, {2465, 1}, {2478, 1}, {2173, 1}, {2544, 100}, {2643, 1}},
--container; Rope, Light Shovel, 50 Platinum Coins, 100 Brown Mushroom
{{8712, 1}, {5710, 1}, {2152, 50}, {2789, 100}}
},
[4] = {
--equipment; Soldier Helmet, Steel Axe, Brass Armor, Brass Legs, Amulet of Loss, Black Shield, Leather Boots
{{2481, 1}, {8601, 1}, {2465, 1}, {2478, 1}, {2173, 1}, {2529, 1}, {2643, 1}},
--container; Rope, Light Shovel, 50 Platinum Coins, 100 Brown Mushroom, Banana Staff, Jagged Sword
{{8712, 1}, {5710, 1}, {2152, 50}, {2789, 100}, {3966, 1}, {8602, 1}}
}
}

function onLogin(cid)
local player = Player(cid)
local targetVocation = config[player:getVocation():getId()]
if not targetVocation then
return true
end

if player:getLastLoginSaved() == 0 then
for i = 1, #targetVocation[1] do
player:addItem(targetVocation[1][1], targetVocation[1][2])
end

local backpack = player:addItem(1988)
for i = 1, #targetVocation[2] do
backpack:addItem(targetVocation[2][1], targetVocation[2][2])
end
end
return true
end
 
#8.
https://otland.net/threads/rules-for-the-support-board.217087/

Instead of just writing "nvm fixed" explain what you did to solve this, so others can use this if they get same problem.
I found another script

With 10.x starter items
Code:
function onLogin(cid)
    local storage = 30055 -- storage value
  
    local sorcItems = {
            20132, -- helmet of the lost
            23531, -- heat core
            13880, -- shimmer wand
            23539, -- mino shield
            23532, -- alloy legs
            23533, -- metal spats
            23659, -- glooth backpack
            2050 -- torch
        }
    local druidItems = {
            20132, -- helmet of the lost
            23531, -- heat core
            23539, -- mino shield
            13872, -- shimmer rod
            23532, -- alloy legs
            23533, -- metal spats
            23659, -- glooth backpack
            2050 -- torch
        }
    local pallyItems = {
            20132, -- helmet of the lost
            23531, -- heat core
            23539, -- mino shield
            2456, -- Bow
            23532, -- alloy legs
            23533, -- metal spats
            23659, -- glooth backpack
            2050 -- torch
        }
    local kinaItems = {
            20132, -- helmet of the lost
            23531, -- heat core
            23539, -- mino shield
            23541, -- cowtana
            23532, -- alloy legs
            23533, -- metal spats
            23659, -- glooth backpack
            2050 -- torch
        }
  
    if getPlayerStorageValue(cid, storage) == -1 then
        setPlayerStorageValue(cid, storage, 1)
        if getPlayerVocation(cid) == 1 then
            -- Sorcerer
            for i = 1, table.getn(sorcItems), 1 do
                doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
            end
      
        elseif getPlayerVocation(cid) == 2 then
            -- Druid
            for i = 1, table.getn(druidItems), 1 do
                doPlayerAddItem(cid, druidItems[i], 1, FALSE)
            end
      
        elseif getPlayerVocation(cid) == 3 then
            -- Paladin
            for i = 1, table.getn(pallyItems), 1 do
                doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
            end
            -- 8 arrows
            doPlayerAddItem(cid, 2544, 8, FALSE)
      
        elseif getPlayerVocation(cid) == 4 then
            -- Knight
            for i = 1, table.getn(kinaItems), 1 do
                doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
            end
        end
      
        -- Common for all
        doPlayerAddItem(cid, 2152, 10, FALSE) -- 10 platinum coin
        doPlayerAddItem(cid, 2789, 25, FALSE) -- 25 brown mushroom
        doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
        doPlayerAddItem(cid, 2554, 1, FALSE) -- 1 shovel
    end
    return true
end
 
Although I never tested it, this might work too, I am terrible at remember all those id's :p
Code:
   local firstItems_storage = 30001

    local commonItems = {
         "backpack", "rope", "leather boots", "shovel"
    }
    local cash {
        "crystal coin", -- cash
        "2" -- count
    }
    local ammo = {
        "arrow", -- ammo type
        "100" -- ammo amount
    }
    local firstItems = {
        -- sorc
        {
            "spellbook", -- shield
            "wand of vortex", -- weapon
            "mage hat", -- head... yes plx
            "magician's robe", -- chest
            "studded legs", -- legs
            "leather boots", -- feet
            cash[1], -- cash
            "nothing", -- arrow slot
            cash[2], -- cash count
            "nothing" -- arrow slot count
        },
        -- druid
        {
            "spellbook",
            "snakebite rod",
            "mage hat",
            "magician's robe",
            "studded legs",
            "leather boots",
            cash[1],
            "nothing",
            cash[2],
            "nothing"
        },
        -- paladin
        {
            "nothing",
            "bow",
            "legion helmet",
            "ranger's cloak",
            "ranger legs"
            "leather boots",
            cash[1],
            ammo[1],
            cash[2],
            ammo[2]
        },
        -- knight
        {
            "steel shield",
            "jagged sword",
            "soldier helmet",
            "brass armor",
            "brass legs"
            "leather boots",
            cash[1],
            "nothing",
            cash[2],
            "nothing"
        } 
    }
 
    function friItenzPlx(iten)
        return getItemIdByName(iten, false)
    end

    function onLogin(cid)
        if getPlayerGroupId(cid) < 2 and getPlayerStorageValue(cid, firstItems_storage) <= 0 then
            local myFriItens = firstItems[getPlayerVocation(cid)]
            -- this creates the backpack and put stuff in it
            for x = 1, #commonItems do
                if (isItemContainer( friItenzPlx(commonItems[x]) ) )
                    backpack = doPlayerAddItem(cid, friItenzPlx(commonItems[x]), 1)
                else
                    doAddContainerItem(backpack, friItenzPlx(commonItems[x]), 1)
                end
            end
            ------------------------------------
            -- this creates the equipment for the player, adds gold etc
            for i = 1, #myFriItens - 2 do
                if myFriItens[i] ~= "nothing" and myFriItens[i] ~= cash[1] and myFriItens[i] ~= ammo[1] then
                    doPlayerAddItem(cid, friItenzPlx(myFriItens[i]), 1)
                elseif myFriItens[i] == cash[1] or myFriItens[i] == ammo[1] then
                    doPlayerAddItem(cid, friItenzPlx(myFriItens[i]), tonumber( myFriItens[i+2]:match('[0-9]+') ) )
                end
            end
            setPlayerStorageValue(cid, firstItems_storage, 1)
        end
        return TRUE
    end
 
Back
Top