• 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 (First Items) - Help

Nikkster

Programmer
Joined
May 9, 2008
Messages
2,848
Reaction score
9
Location
Confidential
Hello, ofcourse I will give you reputation if you help me with this, 14 points.

However, can someone change this firstitems.lua so when someone make a character and decides to be a sorcerer and logins to the game, they will get: Leather Boots, Plate Legs, Plate Armor, Dark Helmet, Dwarven shield & a wand of vortex.

Same with druid's but just a snakebite rod instead of a wand of vortex.

Same with Paladin's and Knight's, but for paladins, a spear and for knights, a katana.

Here are the item id's:

2238 - Leatehr Boots
2647 - Plate Legs
2463 - Plate Armor
2490 - Dark Helmet
2525 - Dwarven Shield
2190 - Wand of Vortex
2182 - Snaktebite Rod
2389 - Spear
2412 - Katana

firstitems.lua
Code:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		if getPlayerSex(cid) == 0 then
			doPlayerAddItem(cid, 2389, 1)
		else
			doPlayerAddItem(cid, 2389, 1)
		end
		local bag = doPlayerAddItem(cid, 1987, 1)
		doAddContainerItem(bag, 2674, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end

Thanks!
 
If you are using account manager, simply change his name in database (to stop him being accmanager) and set save to 1. Then add equipment that should be except the weapon.
If you are using gesior's AAC, do the same with sample characters (without changing name tho)
And here is edited firstitems to give players weapon depending on their vocation:
Lua:
function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
		if isSorcerer(cid) == TRUE then
			doPlayerAddItem(cid, 2190, 1)
		elseif isDruid(cid) == TRUE then
			doPlayerAddItem(cid, 2182, 1)
		elseif isPaladin(cid) == TRUE then
			doPlayerAddItem(cid, 2389, 1)
		elseif isKnight(cid) == TRUE then
			doPlayerAddItem(cid, 2412, 1)
		end
	end
 	return TRUE
end

It's alot better way than giving ALL equipment with script :f and every item will go on good place (by script you can have for example shield in bp because in hands you've got legs and helmet :f)

Thanks,
Hermes
 
@up
yea but that adds all eqs to all diffrent vocs he wants 1 voc to get a certain items

Ok heres what i use, open creatureevents folder and put this in scripts
Lua:
local firstItems =
{
2238, -- Leather Boots
2647, -- Plate Legs
2463, -- Plate Armor
2490, -- Dark Helmet
2525, -- Dwarven Shield
2190 -- wand of vortex
}

function onLogin(cid)
	if getPlayerVocation(cid) == 1 and getPlayerStorageValue(cid, 30951) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		local bag1 = doPlayerAddItem(cid, 2000, 1)
		doAddContainerItem(bag1, 2554, 1) -- shovel
		doAddContainerItem(bag1, 2120, 1) -- rope
		doAddContainerItem(bag1, 2152, 50) -- 50 plats

		setPlayerStorageValue(cid, 30951, 1)
	end
 	return TRUE
end

Lua:
local firstItems =
{
2238, -- Leather Boots
2647, -- Plate Legs
2463, -- Plate Armor
2490, -- Dark Helmet
2525, -- Dwarven Shield
2182 -- snakebite rod
}

function onLogin(cid)
	if getPlayerVocation(cid) == 2 and getPlayerStorageValue(cid, 30952) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		local bag1 = doPlayerAddItem(cid, 2000, 1)
		doAddContainerItem(bag1, 2554, 1) -- shovel
		doAddContainerItem(bag1, 2120, 1) -- rope
		doAddContainerItem(bag1, 2152, 50) -- 50 plats

		setPlayerStorageValue(cid, 30952, 1)
	end
 	return TRUE
end
Lua:
local firstItems =
{
2238, -- Leather Boots
2647, -- Plate Legs
2463, -- Plate Armor
2490, -- Dark Helmet
2525, -- Dwarven Shield
2389 -- spear
}

function onLogin(cid)
	if getPlayerVocation(cid) == 3 and getPlayerStorageValue(cid, 30953) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		local bag1 = doPlayerAddItem(cid, 2000, 1)
		doAddContainerItem(bag1, 2554, 1) -- shovel
		doAddContainerItem(bag1, 2120, 1) -- rope
		doAddContainerItem(bag1, 2152, 50) -- 50 plats

		setPlayerStorageValue(cid, 30953, 1)
	end
 	return TRUE
end
Lua:
local firstItems =
{
2238, -- Leather Boots
2647, -- Plate Legs
2463, -- Plate Armor
2490, -- Dark Helmet
2525, -- Dwarven Shield
2412 -- katana
}

function onLogin(cid)
	if getPlayerVocation(cid) == 4 and getPlayerStorageValue(cid, 30954) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		local bag1 = doPlayerAddItem(cid, 2000, 1)
		doAddContainerItem(bag1, 2554, 1) -- shovel
		doAddContainerItem(bag1, 2120, 1) -- rope
		doAddContainerItem(bag1, 2152, 50) -- 50 plats

		setPlayerStorageValue(cid, 30954, 1)
	end
 	return TRUE
end
open creatureevents.xml and copy and paste this

just rename the name of script
PHP:
first-pally.lua
<event type="login" name="PallyItems" event="script" value="first-pally.lua"/>
<event type="login" name="SorcItems" event="script" value="first-sorc.lua"/>
<event type="login" name="DruidItems" event="script" value="first-druid.lua"/>
<event type="login" name="KnightItems" event="script" value="first-knight.lua"/>
 
Last edited:
Code:
local firstItems =
{
}

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

		elseif getPlayerVocation(cid) == 2 then
			doPlayerAddItem(cid, 2182, 1)

		elseif getPlayerVocation(cid) == 3 then
			doPlayerAddItem(cid, 2456, 1)
			doPlayerAddItem(cid, 2544, 1)

		elseif getPlayerVocation(cid) == 4 then
			doPlayerAddItem(cid, 2428, 1)
			doPlayerAddItem(cid, 2383, 1)

		end
		local bag = doPlayerAddItem(cid, 1988, 1)
		doAddContainerItem(bag, 2120, 1)
		doAddContainerItem(bag, 2554, 1)
		doAddContainerItem(bag, 2490, 1)
		doAddContainerItem(bag, 2463, 1)
		doAddContainerItem(bag, 2647, 1)
		doAddContainerItem(bag, 2643, 1)
		doAddContainerItem(bag, 2525, 1)
		doAddContainerItem(bag, 2152, 30)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end

This will put all ur equips in your backpack, and the weapon of vocation in your hand

Druid - snakebite rod
Sorcerer - wand of vortex
Paladin - bow + arrow
Knight - orcish axe + spike sword
 
@guys which posted scripts there
You all (90% of you) are making alot of mistakes in scripts:
- you are not deleting empty tables (waste of space) and unused loops,
- you are making ALOT of scripts than merging all into one and 10x shorter one,
- do you really think that if you execute "doPlayerAddItem()" items given will go into their slots? Nope. All can be messed up, like helmet and armor in hands, legs in arrow slot, helmet and weapon in backpack.
- if someone put request, then for the pete sake do JUST AND ONLY thing that thread author wanted..
- etc.


Thanks,
Hermes
 
wtf does it matter where the eq goes as long as it goes on you and in ur backpack, people arnt that lazy to move their mouse they are just scripts
and i use my scripts and they work perfectly
 
Back
Top