• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua quest chest not working

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
LUA:
local pos = {x=615, y=1241, z=7}

local legs = {x=563, y=1213, z=6}

function onUse(cid, item, frompos, item2, topos)
            doSendMagicEffect(pos, 10)		
			doPlayerAddItem(cid, 2407, 1) --backpack of holding
			doPlayerSetStorageValue(cid, 1020, 2)
			doPlayerAddExp(cid, 30000)
			doCreatureSay(cid, "You chose the brightsword!", TALKTYPE_ORANGE_1)
			doTeleportThing(cid, legs)
				else
				doCreatureSay(cid, "You have already gotten a reward.", TALKTYPE_ORANGE_1)
						return true
					end

The chest simply does nothing, the unique id is set on the map, and it is set in actions.xml as well, what's wrong with the script?
 
Enjoy!
LUA:
local pos = {x=615, y=1241, z=7}
 
local legs = {x=563, y=1213, z=6}
 
function onUse(cid, item, frompos, item2, topos)
	if isPlayer(cid) and getPlayerStorageValue(cid, 1020) == -1 then
		doSendMagicEffect(cid, 10)		
		doPlayerAddItem(cid, 2407, 1) --backpack of holding
		setPlayerStorageValue(cid, 1020, 2)
		doPlayerAddExp(cid, 30000)
		doCreatureSay(cid, "You chose the brightsword!", TALKTYPE_ORANGE_1)
		doTeleportThing(cid, legs)
	else
		doCreatureSay(cid, "You have already gotten a reward.", TALKTYPE_ORANGE_1)
		end
	return true
end
 
LUA:
	<action uniqueid="1013" event="script" value="quests/brightsword.lua"/>
	<action uniqueid="1014" event="script" value="quests/beastslayeraxe.lua"/>
	<action uniqueid="1015" event="script" value="quests/diamondsceptre.lua"/>

And I have other scripts that work in the quests folder so thats not the problem.
 
You will get prints on the console, when you open the chest, please post here.

LUA:
local pos = {x=615, y=1241, z=7}
 
local legs = {x=563, y=1213, z=6}
 
function onUse(cid, item, frompos, item2, topos)
        print("Cyko Report Stage 1")
	if isPlayer(cid) and getPlayerStorageValue(cid, 1020) == -1 then
                print("Cyko Report Stage 2")
		doSendMagicEffect(cid, 10)		
		doPlayerAddItem(cid, 2407, 1) --backpack of holding
		setPlayerStorageValue(cid, 1020, 2)
		doPlayerAddExp(cid, 30000)
		doCreatureSay(cid, "You chose the brightsword!", TALKTYPE_ORANGE_1)
		doTeleportThing(cid, legs)
	else
		doCreatureSay(cid, "You have already gotten a reward.", TALKTYPE_ORANGE_1)
                print("Cyko Report Stage 3")
		end
	return true
end
 
Only way to see its console and so far i see its nothing wrong with the script, i think.
 
Well, using anvils (since they aren't containers that open) I got it to work by making it only add the item. I'm now slowly adding each part to see what the problem is since the other 2 aren't working with all the lines of code uncommented in them.

- - - Updated - - -

this line

LUA:
doSendMagicEffect(cid, 10)
made it all not work, what's wrong with this line?
 
Back
Top