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

Scripts with no error? Look here!

jpkulik

New Member
Joined
Mar 15, 2008
Messages
208
Reaction score
2
Hey guys!
I did a script here, but it does not work, i dont think there is an error, but im Newbie in .LUA, so i need your Help..
Script:
PHP:
BP.LUA
if item.uid == 8890 then
queststatus = getPlayerStorageValue(cid,8890)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You found a Backpack of Holding.")
container = doPlayerAddItem(cid, 2365, 1)
doAddContainerItem(container, 2273, 10)
doAddContainerItem(container, 2268, 10)
doAddContainerItem(container, 2313, 30)
doAddContainerItem(container, 2311,50)
setPlayerStorageValue(cid,8890,1)
else
doPlayerSendTextMessage(cid,24,"It is empty.")
end
end

PHP:
In actions.XML
	<action actionid="8890" script="quests/poi/bp.lua" />




Error:
PHP:
[17/09/2008  00:17:43] data/actions/scripts/quests/poi/bp.lua:1: attempt to index global 'item' (a nil value)
[17/09/2008  00:17:43] Warning: [Event::loadScript] Can not load script. data/actions/scripts/quests/poi/bp.lua
Can some one help me fast as possible please?
See you!:p
 
Try to replace the "item" in the first line by "Item". I had the same error with another script and this fixed the error, i'm not sure if it will work with your problem but, it worth a try i think!
 
change
if item.uid == 8890 then
to
if item.id == 8890 then

Reason, Your checking it for an items id not an conection uid.



use this as the backpack adding.
Code:
	if getPlayerFreeCap(cid) > (getItemWeightById(itemid, 20)*count + getItemWeightById(container, count)) then
			for i = 1, count do
				local containerItem = doPlayerAddItem(cid, container, 1)
				for x = 1, 20 do
					doAddContainerItem(containerItem, itemid, charges)



=================NOT TESTED==============
BP.LUA
Code:
if item.uid == 8890 then
queststatus = getPlayerStorageValue(cid,8890)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You found a Backpack of Holding.")
if getPlayerFreeCap(cid) > (getItemWeightById(itemid, 20)*count + getItemWeightById(container, count)) then
for i = 1, count do
local containerItem = doAddContainerItem(container, 2273, 10)
doAddContainerItem(container, 2268, 10)
doAddContainerItem(container, 2313, 30)
doAddContainerItem(container, 2311,50)
				for x = 1, 20 do
setPlayerStorageValue(cid,8890,1)
else
doPlayerSendTextMessage(cid,24,"You do not have enough of cap.")
else
doPlayerSendTextMessage(cid,24,"It is empty.")
end
end


Edit*
I see a bug in
Code:
if getPlayerFreeCap(cid) > (getItemWeightById(itemid, 20)*count + getItemWeightById(container, count)) then
for i = 1, count do
local containerItem = doAddContainerItem(container, 2273, 10)
But i'm in a hurry so i cant fix it now.


//Mokerhamer
 
Last edited:
HEIuhiuq
Exactli Guys!
Sorry aboult that :(
I had missed the header :X (onuse)
Tanks for all help, i fix it now, i will give rep for ya, cya
 
Back
Top