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

CreatureEvent First Items

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
First Items - Updated

This script is a pretty basic configuration for anyone who needs a first items script.
I hope you enjoy it, and I also hope I had the chance to assist you! :thumbup:

TFS 0.3.6pl1

creaturescripts/scripts/firstitems.lua
Code:
local storage = 67777
function onLogin(cid)
	local config = {
		voc_items = {
			{ -- SORC
				{2190}, -- wand of vortex
				{2175}, -- spellbook
				{8820}, -- mage hat
				{8819} -- mage robe
			},
			{ -- DRUID
				{2182}, -- snakebite rod
				{2175}, -- spellbook
				{8820}, -- mage hat
				{8819} -- mage robe
			},
			{ -- PALADIN
				{2410}, -- throwing knife
				{2530}, -- copper shield
				{2480}, -- legion helmet
				{2464} -- chain armor
			},
			{ -- KNIGHT
				{2409}, -- serpent sword
				{2530}, -- copper shield
				{2480}, -- legion helmet
				{2464} -- chain armor
			}
		},
		all_items = {
			{2468}, -- studded legs
			{2643} -- leather boots
		},
		extra_items = {
			{2789, 15},
			{2120},
			{5710}
		},
		knight_weapons = {
			{2423}, -- clerical mace
			{2429} -- barbarian axe
		}
	}
	if getPlayerGroupId(cid) < 3 then
		if getPlayerStorageValue(cid, storage) == -1 then
			local common = config.voc_items[getPlayerVocation(cid)]
			if common ~= nil then
				for _, v in ipairs(common) do
					doPlayerAddItem(cid, v[1], v[2] or 1)
				end
			end
			
			local all = config.all_items
			if all ~= nil then
				for _, v in ipairs(all) do
					doPlayerAddItem(cid, v[1], v[2] or 1)
				end
			end
			
			local extra = config.extra_items
			local bp = doPlayerAddItem(cid, 1988, 1)
			if extra ~= nil then
				for _, v in ipairs(extra) do
					doAddContainerItem(bp, v[1], v[2] or 1)
				end
			end
			
			local weapons = config.knight_weapons
			if weapons ~= nil then
				for _, w in ipairs(weapons) do
					if isKnight(cid) then
						doAddContainerItem(bp, w[1], w[2] or 1)
					end
				end
			end
			
			setPlayerStorageValue(cid, storage, 1)
		end
	end
	return true
end
 
Last edited:
good but is it made for an realmap? :O bec that isnt for an custom,roxor if u dont have time to change before use :D.
On custom,roxor you get k set an good weap (NOT TIBIA-HELPS MAP!)

/wlj:wub:
 
Last edited:
I just put in items for a good RPG server.
Any level 8 starts with those items, would be great.

You can change them, to whatever you like.
 
shorter..
Lua:
local items = {
    [0] = { 8819, 8820, 2468, 2509, 2643, 2190 },
    [1] = { 8819, 8820, 2468, 2509, 2643, 2190 },
    [2] = { 8819, 8820, 2468, 2509, 2643, 2182 },
    [3] = { 2509, 2643, 8923, 8892, 2481, 2389 },
    [4] = { 2643, 2478, 2465, 2481, 2509 }
}
    if getPlayerStorageValue(cid, 7878) == -1 then
        for voc, item in pairs(items) do
            if getPlayerVocation(cid) == voc then
                local container = doPlayerAddItem(cid, 1988, 1)
                for i = 1, table.maxn(item) do
                    doAddContainerItem(container, item[i], 1)
                end
                setPlayerStorageValue(cid, 7878, 1)
            end
        end
    end
    return TRUE
end
 
@Up,

Thanks for posting, but this is not a request thread.
 
Last edited:
JDB verison better because easier to understand what you are editing (neater)

how would i do this:

-- ITEMS ALL VOCS RECEIVE
(backpack with bp of mana potions, bp of sd runes, bp of magic wall) etc..
 
At new servers (atleast mine), you dont need firstitems.lua except for the storage. I'm just using the samples, else everything fucks up -.-
but for others that doesnt use samples, then its great =) Easy to understand & edit, and very nice because you can set it up for all vocs :) rep+ for posting
 
You're welcome.
:thumbup:
 
Last edited:
Love the scripts =D!

Im using this:
Code:
local commonItems = {
-- ITEMS ALL VOCS RECEIVE
{itemid=2459, count=1}, -- iron helmet
{itemid=2463, count=1}, -- plate armor
{itemid=2647, count=1}, -- plate legs
{itemid=2643, count=1}, -- leather boots
{itemid=2120, count=1}, -- rope
{itemid=5710, count=1} -- shovel
}

local firstItems = {
{ -- SORC ITEMS
{itemid=2190, count=1}, -- wand of vortex
{itemid=2175, count=1} -- spellbook
},
{ -- DRUID ITEMS
{itemid=2182, count=1}, -- snakebite rod
{itemid=2175, count=1} -- spellbook
},
{ -- PALADIN ITEMS
{itemid=2456, count=1}, -- bow
{itemid=2544, count=100} -- 100 arrows
},
{ -- KNIGHT ITEMS
{itemid=8602, count=1}, -- jagged sword
{itemid=2439, count=1}, -- daramanian mace
{itemid=8601, count=1}, -- steel axe
{itemid=2525, count=1} -- dwarven shield
}
}

for _, items in ipairs(firstItems) do
for _, item in ipairs(commonItems) do
table.insert(items, item)
end
end

function onLogin(cid)
if getPlayerGroupId(cid) < 2 then
local hasReceivedFirstItems = getPlayerStorageValue(cid, 67708)

if hasReceivedFirstItems ~= 1 then
--[[local backpack = ]]doPlayerAddItem(cid, 1988, 1)

local giveItems = firstItems[getPlayerVocation(cid)]

if giveItems ~= nil then
for _, v in ipairs(giveItems) do
--doAddContainerItem(backpack, v.itemid, v.count or 1)
doPlayerAddItem(cid, v.itemid, v.count or 1)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved your first items!")
end
setPlayerStorageValue(cid, 67708, 1)
end
end
return TRUE
end
 
Maj Werszyn. Only one loop.

Code:
local SORCERER = 1
local DRUID = 2
local PALADIN = 3
local KNIGHT = 4

local items =
{
    [SORCERER] = 
    {
        {item = 2461, count = 1}, 
        {item = 2170, count = 1}, 
        {item = 1988, count = 1}, 
        {item = 2467, count = 1}, 
        {item = 2512, count = 1}, 
        {item = 2190, count = 1}, 
        {item = 2649, count = 1}, 
        {item = 2643, count = 1}, 
        {item = 2120, count = 1}
    }, 
    [DRUID] = 
    {
        {item = 2461, count = 1}, 
        {item = 2170, count = 1}, 
        {item = 1988, count = 1}, 
        {item = 2467, count = 1}, 
        {item = 2512, count = 1}, 
        {item = 2182, count = 1}, 
        {item = 2649, count = 1}, 
        {item = 2643, count = 1}, 
        {item = 2120, count = 1}
    }, 
    [PALADIN] = 
    {
        {item = 2461, count = 1}, 
        {item = 2170, count = 1}, 
        {item = 1988, count = 1}, 
        {item = 2467, count = 1}, 
        {item = 2512, count = 1}, 
        {item = 2389, count = 10}, 
        {item = 2649, count = 1}, 
        {item = 2643, count = 1}, 
        {item = 2120, count = 1}
    }, 
    [KNIGHT] = 
    {
        {item = 2461, count = 1}, 
        {item = 2170, count = 1}, 
        {item = 1988, count = 1}, 
        {item = 2467, count = 1}, 
        {item = 2512, count = 1}, 
        {item = 2376, count = 1}, 
        {item = 2649, count = 1}, 
        {item = 2643, count = 1}, 
        {item = 2120, count = 1}
    }
}

function onLogin(cid)
    local vocation = items[getPlayerVocation(cid)]
    if(not vocation) then
        return true
    end
    
    local storage = getPlayerStorageValue(cid, 30001)
    if(storage > 0) then
        return true
    end
    
    for _, voc in ipairs(vocation) do
        doPlayerAddItem(cid, voc.item, voc.count)
    end
    
    setPlayerStorageValue(cid, 30001, 1)
     return true
end
 
Last edited:
I use this:
Code:
function onLogin(cid)
if getPlayerStorageValue(cid, 40045) == -1 then
	if getPlayerVocation(cid) == 1 then
		doPlayerAddItem(cid, 2518, 1)--Beholder Shield
		doPlayerAddItem(cid, 8820, 1)--Mage hat
		doPlayerAddItem(cid, 8819, 1)--Magician's robe
		doPlayerAddItem(cid, 2478, 1)--Brass Legs
		doPlayerAddItem(cid, 2643, 1)--Leather Boots
		local container = doPlayerAddItem(cid, 2000, 1)--Backpack
		doAddContainerItem(container, 2190, 1)--Wand Of Vortex
		doAddContainerItem(container, 2175, 1)--Spell Book
		doAddContainerItem(container, 2671, 3)--Ham
		doAddContainerItem(container, 2120, 1)--Rope
		doAddContainerItem(container, 2160, 1)--Crystal Coin
		doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." now you have the first items of "..getPlayerVocationName(cid)..".")
	end
	if getPlayerVocation(cid) == 2 then
		doPlayerAddItem(cid, 2518, 1)--Beholder Shield
		doPlayerAddItem(cid, 8820, 1)--Mage hat
		doPlayerAddItem(cid, 8819, 1)--Magician's robe
		doPlayerAddItem(cid, 2478, 1)--Brass Legs
		doPlayerAddItem(cid, 2643, 1)--Leather Boots
		local container = doPlayerAddItem(cid, 2000, 1)--Backpack
		doAddContainerItem(container, 2182, 1)--Snakekbite Rod
		doAddContainerItem(container, 2175, 1)--Spell Book
		doAddContainerItem(container, 2671, 3)--Ham
		doAddContainerItem(container, 2120, 1)--Rope
		doAddContainerItem(container, 2160, 1)--Crystal Coin
		doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." now you have the first items of "..getPlayerVocationName(cid)..".")
	end
	if getPlayerVocation(cid) == 3 then
		doPlayerAddItem(cid, 2518, 1)--Beholder Shield
		doPlayerAddItem(cid, 2457, 1)--Steel Helmet
		doPlayerAddItem(cid, 2465, 1)--Brass Armor
		doPlayerAddItem(cid, 2478, 1)--Brass Legs
		doPlayerAddItem(cid, 2643, 1)--Leather Boots
		local container = doPlayerAddItem(cid, 2000, 1)--Backpack
		doAddContainerItem(container, 8602, 1)--Jagged Sword
		doAddContainerItem(container, 2389, 2)--Spear
		doAddContainerItem(container, 2456, 1)--Bow
		doAddContainerItem(container, 2671, 3)--Ham
		doAddContainerItem(container, 2120, 1)--Rope
		doAddContainerItem(container, 2160, 1)--Crystal Coin
		doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." now you have the first items of "..getPlayerVocationName(cid)..".")
	end
	if getPlayerVocation(cid) == 4 then
		doPlayerAddItem(cid, 2518, 1)--Beholder Shield
		doPlayerAddItem(cid, 2457, 1)--Steel Helmet
		doPlayerAddItem(cid, 2465, 1)--Brass Armor
		doPlayerAddItem(cid, 2478, 1)--Brass Legs
		doPlayerAddItem(cid, 2643, 1)--Leather Boots
		local container = doPlayerAddItem(cid, 2000, 1)--Backpack
		doAddContainerItem(container, 8602, 1)--Jagged Sword
		doAddContainerItem(container, 2439, 1)--Daramanian mace
		doAddContainerItem(container, 8601, 1)--Steel Axe
		doAddContainerItem(container, 2671, 3)--Ham
		doAddContainerItem(container, 2120, 1)--Rope
		doAddContainerItem(container, 2160, 1)--Crystal Coin
		doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." now you have the first items of "..getPlayerVocationName(cid)..".")
	end
		setPlayerStorageValue(cid, 40045, 1)
	end
return true
end
 
Last edited:
Hmm am using the default one that comes with TFS. but any form to add ml and skills for an desired Vocation id?.

If someone knows how please send me a P.M.
 
Thanks for the comments :thumbup:
 
I already had a working one I made but Ill use yours its definitely better coded and I might aswell learn a couple of things from it :thumbup:
Thanks for posting.

+Repped
Keep it up.
 
Thanks for all the comments fellow OTLand members.
:thumbup:
 
Np Chip, thanks for the comment.
 
Back
Top