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

First items

sibbe

New Member
Joined
Oct 28, 2007
Messages
51
Reaction score
0
Where do I edit the first items a character recieves after being created?

I'm using The Forgotten Server, version 0.3.5 (Crying Damson)
 
Thanks for reply, but that thread didnt help me, I dont have any file called firstitems.lua inside the creaturescripts/scripts.
I could create one but I dont know what code to have in the file.

I'm not using Geisor's AAC.
 
firstitems.lua sample from 0.3.4pl2:
Code:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) <= 0 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end

		if getPlayerSex(cid) == PLAYERSEX_FEMALE then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end

		local bag = doPlayerAddItem(cid, 1987, 1)
		doAddContainerItem(bag, 2674, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end

	return TRUE
end
Add in creaturescripts.xml:
Code:
	<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
 
firstitems.lua sample from 0.3.4pl2:
Code:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) <= 0 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end

		if getPlayerSex(cid) == PLAYERSEX_FEMALE then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end

		local bag = doPlayerAddItem(cid, 1987, 1)
		doAddContainerItem(bag, 2674, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end

	return TRUE
end
Add in creaturescripts.xml:
Code:
	<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>

Approved :peace:
 
Thanks alot, that'll work.
But maybe you know if there is a script that can give each vocation different items? So that druids will recieve a rod and sorcerers recieves a wand etc.
 
Code:
-- Colandus @ 1337Rox0r

-- How to think when adding items? Try fill the hands first, then the arrow slot. This because armor etc won't go to hand slot (Vocation items will be given before commonItems, as you usually use to have
-- the hand/arrow slot items there and not in common items. Take a look at how I did it:

local commonItems = {
	-- ITEMS ALL VOC RECEIVE
	{itemid=2493, count=1}, -- demon set (legs, helm, arm)
	{itemid=2494, count=1},
	{itemid=2495, count=1},
	{itemid=2160, count=50} -- 50cc
}

local firstItems = {
	{ -- SORC ITEMS
		{itemid=2190, count=1}, -- wand
		{itemid=2520, count=1}, -- demon shield
		{itemid=7890, count=1} -- an amulet (for test purpose)
	},
	{ -- DRUID ITEMS
		{itemid=2182, count=1}, -- rod
		{itemid=2520, count=1}, --demon shield
		{itemid=7888, count=1} -- an amulet (for test purpose)
	},
	{ -- PALADIN ITEMS
		{itemid=2455, count=1}, --xbow
		{itemid=2543, count=100}, --100 bolt
		{itemid=7887, count=1} -- an amulet (for test purpose)
	},
	{ -- KNIGHT ITEMS
		{itemid=2432, count=1}, -- fire axe O.o
		{itemid=2520, count=1}, --demon shield
		{itemid=7889, count=1} -- an amulet (for test purpose)
	}
}

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
		if getPlayerStorageValue(cid, 90808) < 1 then
			--[[local backpack = ]]doPlayerAddItem(cid, 1988, TRUE)
			local giveItems = firstItems[getPlayerVocation(cid)]
			if giveItems 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 received your first items depending on your vocation.")
			end
			setPlayerStorageValue(cid, 90808, 1)
		end
	end
	return true
end
 
Last edited:
On second thought..
When the character has recieved items and logs out and logs in again, the character recieves the items again.
(Or the items just falls on the ground since the character is out of capacity.)
Any ideas on this?

Ps, I havent changed anything at all in the script.
 
Great, now it works.

A really weird thing happend though.
I created a character and recieved my items.
Logged out and logged back in and i started to loose hp just like i walked on a firefield.
No npc nearby, i was in a temple with PZ.

I cant seem to recreate this incident.
Kinda freaky.
 
Great, now it works.

A really weird thing happend though.
I created a character and recieved my items.
Logged out and logged back in and i started to loose hp just like i walked on a firefield.
No npc nearby, i was in a temple with PZ.

I cant seem to recreate this incident.
Kinda freaky.
maybe hani hack your database too? xd :)
and modify blob data (conditions) :)))
 
Back
Top