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

How do I configure the initial gear to start?

alltus

Active Member
Joined
Aug 5, 2020
Messages
49
Reaction score
31
Hello everyone!! I would like to know about something. (I'm using FTS 1.2, Tibia 10.98)
How do I configure the initial gear to start? For example, to a knight start with Soldier helmet, brass armor, legs, etc... After creating the character in localhost??
Thanks a lot!!
 
Find in your creaturescripts Firstitems.lua and change items for each vocation.
Script name might be changed but in official 1.2 it was Firstitems.lua
You can also edit your Account Samples if you are using AAC already.
 
Find in your creaturescripts Firstitems.lua and change items for each vocation.
Script name might be changed but in official 1.2 it was Firstitems.lua
You can also edit your Account Samples if you are using AAC already.
Cool, I found it! I have just one question, how could I put here different items for each class?
I know it gonna be a elseif, but what exactly I should put??

Lua:
local firstItems = {2050, 2382}

function onLogin(player)
    if player:getLastLoginSaved() == 0 then
        for i = 1, #firstItems do
            player:addItem(firstItems[i], 1)
        end
        elseif vocation id="1"
        player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
        player:addItem(1987, 1):addItem(2674, 1)
        elseif vocation id="2"
...
        end
    end
    return true
end
Is this the correct way to do it?
 
Use this, to see the vocation: (Sorcerer example)
Lua:
player:getVocation():getId() == 1

EDIT: In your script:

Lua:
local firstItems = {2050, 2382}

function onLogin(player)
    if player:getLastLoginSaved() == 0 then
        for i = 1, #firstItems do
            player:addItem(firstItems[i], 1)
        end
        if player:getVocation():getId() == 1 then
        player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
        player:addItem(1987, 1)
        player:addItem(2674, 1)
        elseif player:getVocation():getId() == 2 then
...
        elseif player:getVocation():getId() == 3 then
...
        elseif player:getVocation():getId() == 4 then
...
        end
    end
    return true
end


Btw, what did you want with this line? I didn't understand. 🧐
player: addItem (player: getSex () == 0 and 2651 or 2650, 1)
 
Last edited:
Use this, to see the vocation: (Sorcerer example)
Lua:
player:getVocation():getId() == 1

EDIT: In your script:

Lua:
local firstItems = {2050, 2382}

function onLogin(player)
    if player:getLastLoginSaved() == 0 then
        for i = 1, #firstItems do
            player:addItem(firstItems[i], 1)
        end
        if player:getVocation():getId() == 1 then
        player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
        player:addItem(1987, 1)
        player:addItem(2674, 1)
        elseif player:getVocation():getId() == 2 then
...
        elseif player:getVocation():getId() == 3 then
...
        elseif player:getVocation():getId() == 4 then
...
        end
    end
    return true
end


Btw, what did you want with this line? I didn't understand. 🧐
player: addItem (player: getSex () == 0 and 2651 or 2650, 1)
Haha, it was already there lol

I've tested the code and happened this here:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/firstitems.lua:onLogin
data/creaturescripts/scripts/firstitems.lua:3: attempt to get length of global 'firstItems' (a nil value)
stack traceback:
        [C]: in function '__len'
        data/creaturescripts/scripts/firstitems.lua:3: in function <data/creaturescripts/scripts/firstitems.lua:1>

Did I done something wrong?
 
Haha, it was already there lol

I've tested the code and happened this here:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/firstitems.lua:onLogin
data/creaturescripts/scripts/firstitems.lua:3: attempt to get length of global 'firstItems' (a nil value)
stack traceback:
        [C]: in function '__len'
        data/creaturescripts/scripts/firstitems.lua:3: in function <data/creaturescripts/scripts/firstitems.lua:1>

Did I done something wrong?
You've add the first line?
Lua:
local firstItems = {2050, 2382}
 
edit as your liking:
Lua:
local config = {
    [1] = { -- sorcerer
        items = {
            {2525}, -- dwarven shield
            {2190}, -- wand of vortex
            {8819}, -- magician's robe
            {8820}, -- mage hat
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {7620, 15}, -- mana potion
            {2120}, -- rope
        }
    },
    [2] = { -- druid
        items = {
            {2525}, -- dwarven shield
            {2182}, -- snakebite rod
            {8819}, -- magician's robe
            {8820}, -- mage hat
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {7620, 15}, -- mana potion
            {2120}, -- rope
        }
    },
    [3] = { -- paladin
        items = {
            {2525}, -- dwarven shield
            {2389, 5}, -- spear
            {2660}, -- ranger's cloak
            {8923}, -- ranger legs
            {2643}, -- leather boots
            {2121}, -- wedding ring
            {2460}, -- brass helmet
        },
        backpack = {
            {7618, 10}, -- health potion
            {7620, 10}, -- mana potion
            {2120}, -- rope
        }
    },
    [4] = { -- knight
        items = {
            {2525}, -- dwarven shield
            {8602}, -- jagged sword
            {2465}, -- brass armor
            {2460}, -- brass helmet
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {8601}, -- steel axe
            {2439}, -- daramian mace
            {7618, 5}, -- health potion
            {7620, 5}, -- mana potion
            {2120}, -- rope
        }
    }
}

function onLogin(player)
    player:registerEvent("firstItems")
    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] or 1)
    end

    local demonBackpack = player:addItem(10518) -- demon backpack
    if not demonBackpack then
        return true
    end

    for i = 1, #targetVocation.backpack do
        demonBackpack:addItem(targetVocation.backpack[i][1], targetVocation.backpack[i][2] or 1, false)
    end
    return true
end
 
Last edited by a moderator:
You've add the first line?
Lua:
local firstItems = {2050, 2382}
Yes, I had added, but unfortunately not worked here, :(

Just put this one on your data/scripts folder and edit as your liking:
Lua:
local config = {
    [1] = { -- sorcerer
        items = {
            {2525}, -- dwarven shield
            {2190}, -- wand of vortex
            {8819}, -- magician's robe
            {8820}, -- mage hat
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {7620, 15}, -- mana potion
            {2120}, -- rope
        }
    },
    [2] = { -- druid
        items = {
            {2525}, -- dwarven shield
            {2182}, -- snakebite rod
            {8819}, -- magician's robe
            {8820}, -- mage hat
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {7620, 15}, -- mana potion
            {2120}, -- rope
        }
    },
    [3] = { -- paladin
        items = {
            {2525}, -- dwarven shield
            {2389, 5}, -- spear
            {2660}, -- ranger's cloak
            {8923}, -- ranger legs
            {2643}, -- leather boots
            {2460}, -- brass helmet
        },
        backpack = {
            {7618, 10}, -- health potion
            {7620, 10}, -- mana potion
            {2120}, -- rope
        }
    },
    [4] = { -- knight
        items = {
            {2525}, -- dwarven shield
            {8602}, -- jagged sword
            {2465}, -- brass armor
            {2460}, -- brass helmet
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {8601}, -- steel axe
            {2439}, -- daramian mace
            {7618, 5}, -- health potion
            {7620, 5}, -- mana potion
            {2120}, -- rope
        }
    }
}

local creatureevent = CreatureEvent("firstItems")

function creatureevent.onLogin(player)
    player:registerEvent("firstItems")
    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] or 1)
    end

    local demonBackpack = player:addItem(10518) -- demon backpack
    if not demonBackpack then
        return true
    end

    for i = 1, #targetVocation.backpack do
        demonBackpack:addItem(targetVocation.backpack[i][1], targetVocation.backpack[i][2] or 1, false)
    end
    return true
end

creatureevent:register()
Shall I put it on creaturescripts/scripts/firstitems.lua? It gave this error here:

Lua:
Lua Script Error: [Test Interface]
data/creaturescripts/scripts/firstitems.lua
data/creaturescripts/scripts/firstitems.lua:64: attempt to call global 'CreatureEvent' (a nil value)
stack traceback:
        [C]: in function 'CreatureEvent'
        data/creaturescripts/scripts/firstitems.lua:64: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/firstitems.lua
 
Just use this one
Evil Puncker's one won't work for you, Its for 1.3 RevScripts.
 
edita a tu gusto:
Lua:
configuración local = {
[1] = { -- hechicero
artículos = {
{2525}, -- escudo enano
{2190}, -- varita de vórtice
{8819}, -- túnica de mago
{8820}, -- sombrero de mago
{2478}, -- patas de latón
{2643}, -- botas de cuero
        },
mochila = {
{7620, 15}, -- poción de maná
{2120}, -- cuerda
        }
    },
[2] = { -- druida
artículos = {
{2525}, -- escudo enano
{2182}, -- vara de mordedura de serpiente
{8819}, -- túnica de mago
{8820}, -- sombrero de mago
{2478}, -- patas de latón
{2643}, -- botas de cuero
        },
mochila = {
{7620, 15}, -- poción de maná
{2120}, -- cuerda
        }
    },
[3] = { -- paladín
artículos = {
{2525}, -- escudo enano
{2389, 5}, -- lanza
{2660}, -- capa de guardabosques
{8923}, -- patas de guardabosques
{2643}, -- botas de cuero
{2121}, -- anillo de bodas
{2460}, -- casco de latón
        },
mochila = {
{7618, 10}, -- poción de salud
{7620, 10}, -- poción de maná
{2120}, -- cuerda
        }
    },
[4] = { -- caballero
artículos = {
{2525}, -- escudo enano
{8602}, -- espada dentada
{2465}, -- armadura de latón
{2460}, -- casco de latón
{2478}, -- patas de latón
{2643}, -- botas de cuero
        },
mochila = {
{8601}, -- hacha de acero
{2439}, -- maza daramiana
{7618, 5}, -- poción de salud
{7620, 5}, -- poción de maná
{2120}, -- cuerda
        }
    }
}

función onLogin(player)
    player:registerEvent("firstItems")
    local targetVocation = config[player:getVocation():getId()]
si no es targetVocation entonces
devolver true
fin

if player:getLastLoginSaved() ~= 0 entonces
devolver true
fin

si player:getSlotItem(CONST_SLOT_LEFT) entonces
devolver true
fin

para i = 1, #targetVocation.items do
player:addItem(targetVocation.items[i][1], targetVocation.items[i][2] o 1)
fin

local demonBackpack = player:addItem(10518) -- mochila demoníaca
si no demonBackpack entonces
devolver true
fin

para i = 1, #targetVocation.backpack do
demonBackpack:addItem(targetVocation.backpack[i][1], targetVocation.backpack[i][2] o 1, false)
fin
devolver true
fin
[/CÓDIGO]
[/QUOTE]
[QUOTE="Evil Puncker, post: 2626493, member: 43598"]
edit as your liking:
[CODE=lua]local config = {
    [1] = { -- sorcerer
        items = {
            {2525}, -- dwarven shield
            {2190}, -- wand of vortex
            {8819}, -- magician's robe
            {8820}, -- mage hat
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {7620, 15}, -- mana potion
            {2120}, -- rope
        }
    },
    [2] = { -- druid
        items = {
            {2525}, -- dwarven shield
            {2182}, -- snakebite rod
            {8819}, -- magician's robe
            {8820}, -- mage hat
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {7620, 15}, -- mana potion
            {2120}, -- rope
        }
    },
    [3] = { -- paladin
        items = {
            {2525}, -- dwarven shield
            {2389, 5}, -- spear
            {2660}, -- ranger's cloak
            {8923}, -- ranger legs
            {2643}, -- leather boots
            {2121}, -- wedding ring
            {2460}, -- brass helmet
        },
        backpack = {
            {7618, 10}, -- health potion
            {7620, 10}, -- mana potion
            {2120}, -- rope
        }
    },
    [4] = { -- knight
        items = {
            {2525}, -- dwarven shield
            {8602}, -- jagged sword
            {2465}, -- brass armor
            {2460}, -- brass helmet
            {2478}, -- brass legs
            {2643}, -- leather boots
        },
        backpack = {
            {8601}, -- steel axe
            {2439}, -- daramian mace
            {7618, 5}, -- health potion
            {7620, 5}, -- mana potion
            {2120}, -- rope
        }
    }
}

function onLogin(player)
    player:registerEvent("firstItems")
    local targetVocation = config[player:getVocation():getId()]
si no es targetVocation entonces
devolver true
fin

if player:getLastLoginSaved() ~= 0 entonces
devolver true
fin

si player:getSlotItem(CONST_SLOT_LEFT) entonces
devolver true
fin

para i = 1, #targetVocation.items do
player:addItem(targetVocation.items[i][1], targetVocation.items[i][2] o 1)
fin

local demonBackpack = player:addItem(10518) -- mochila demoníaca
si no demonBackpack entonces
devolver true
fin

para i = 1, #targetVocation.backpack do
demonBackpack:addItem(targetVocation.backpack[i][1], targetVocation.backpack[i][2] o 1, false)
fin
devolver true
fin
[/CÓDIGO]
[/QUOTE]
Post automatically merged:

Do you have these scripts for TFS 1.3 in RevScripts???
 
Last edited:
Back
Top