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

Lua TFS 1.2, 8.0 client, Firstitems.lua only loads rook.

bobby299

New Member
Joined
Nov 11, 2009
Messages
11
Reaction score
0
Hi, I've been exploring multiple threads now, tested multiple LUA files that people have supplied but with no success for me.
Even went as far to ask chatgpt to see if there is some code issue.


This is my issue, Firstitems.lua works fine to edit and gives the correct items to a newly created character. But the issue is when you advance to main.
Maybe I'm wrong here but I thought that this is the same file to edit for that? If not, please point me in the right direction!

This is the code, 0 works fine to edit and I get the items. If I go to main a as sorcerer I get, backpack, shovel, rope, wand.

My guess is that this is the wrong file but cant find any information about it so this is my last thing to do, ask here.


Lua:
local config = {
    [0] = {
        --club,wooden shield, leather helmet, leather helmet, leather legs
        items = {{2382, 1},{2512, 1}, {2461, 1}, {2467, 1}, {2649, 1}},
        --container rope, shovel, red apple
        container = {{2120, 1}, {2554, 1}, {2674, 2}}
    },   
    [1] = {
        --equipment spellbook, wand of vortex, studded legs,leather boots,
        items = {{2468, 1},{2175, 1}},
        --container  -studded legs,
        container = {{2190, 1},{2643, 1} }
    },
    [2] = {
        --equipment spellbook, snakebite rod, magician's robe, mage hat, studded legs, leather boots scarf
        items = {{2175, 1}, {2182, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}},
        --container platinum coin, rope, shovel, mana potion
        container = {{2152, 20}, {7620, 5}, {18559, 1}}
    },
    [3] = {
        --equipment dwarven shield, 5 spear, ranger's cloak, ranger legs scarf, legion helmet
        items = {{2525, 1}, {2389, 5}, {2660, 1}, {8923, 1}, {2643, 1}, {2661, 1}, {2480, 1}},
        --container platinum coin, rope, shovel, health potion, mana potion
        container = {{2152, 20}, {7618, 5}, {7620, 5}, {18559, 1}}
    },
    [4] = {
        --equipment dwarven shield, steel axe, brass armor, brass helmet, brass legs scarf
        items = {{2525, 1}, {8601, 1}, {2465, 1}, {2460, 1}, {2478, 1}, {2643, 1}, {2661, 1}},
        --container platinum coin, jagged sword, daramian mace, rope, shovel, health potion, mana potion
        container = {{2152, 20}, {8602, 1}, {2439, 1}, {7618, 5}, {7620, 5}, {18559, 1}}
    }

}

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

    if player:getLastLoginSaved() ~= 0 then
        return true
    end

    if (player:getSlotItem(CONST_SLOT_LEFT)) then
        return true
    end

    for i = 1, #targetVocation.items do
        player:addItem(targetVocation.items[i][1], targetVocation.items[i][2])
    end

    local backpack = player:getVocation():getId() == 0 and player:addItem(1987) or player:addItem(1988)
    if not backpack then
        return true
    end

    for i = 1, #targetVocation.container do
        backpack:addItem(targetVocation.container[i][1], targetVocation.container[i][2])
    end
    return true
end
 
this script just add items once if you never logged in before and the items you get depends on the vocation you had before logging in

if you want to give items after choosing your vocation instead, then you could set that up in your npc script that sets your vocation & sends you to main, aswell having it give you items depending on vocation you choose

thats what you meant right?
 
this script just add items once if you never logged in before and the items you get depends on the vocation you had before logging in

if you want to give items after choosing your vocation instead, then you could set that up in your npc script that sets your vocation & sends you to main, aswell having it give you items depending on vocation you choose

thats what you meant right?
You are 100% correct, thank you so much for fixing what my stupidity couldn't think of!

Sometimes you overlook the simple things and get convinced that you cant figure it out. Never even thought of checking the .Lua for the Oracle...

Cheers mate, saved me a lot of headache!
 
Back
Top