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

Action Demon helmet quest

Cykotitan can you fix this?
 
[03/02/2010 16:47:56] [Error - Action Interface]
[03/02/2010 16:47:56] data/actions/scripts/quests/f-quest.lua:eek:nUse
[03/02/2010 16:47:56] Description:
[03/02/2010 16:47:56] attempt to index a nil value
[03/02/2010 16:47:56] stack traceback:
[03/02/2010 16:47:56] [C]: in function 'doCreateTeleport'
[03/02/2010 16:47:56] data/actions/scripts/quests/f-quest.lua:16: in function <data/actions/scripts/quests/f-quest.lua:8>
 
fixed:
Code:
local pinkstonepos1 = {x= XXXX, y= YYYY, z= Z} -- Blocking stone position.
local TeleportToPos = {x = XXXX, y = YYYY, z = Z} -- Position the player will be ported to when leaving the DHQ, like the Temple...
local TeleportInPos = {x = XXXX, y = YYYY, z = Z} -- Position In DHQ.
local LeverPos = {x = XXXX, y = YYYY, z = Z} -- Lever Position
local TeleportOutPos = {x = XXXX, y = YYYY, z = Z} -- Telporter out pos
local timeToRemove  = 40 -- Time before quest reset

local function doRemoveTeleport()
	local teleport = getTileItemById(TeleportInPos, 1387).uid
	if teleport > 0 then
		doCreateItem(1355, 1, pinkstonepos1)
		doRemoveItem(teleport)
		doSendMagicEffect(TeleportInPos, CONST_ME_POFF)
		doTransformItem(getTileItemById(LeverPos, 1946).uid, 1945)
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local pinkstone, teleport = getTileItemById(pinkstonepos1, 1355).uid, getTileItemById(TeleportInPos, 1387).uid
		doRemoveItem(pinkstone)
		doCreateTeleport(1387, TeleportToPos, TeleportOutPos)
		doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid,22,"The stone is removed, get the reward before the time runs out!")
		addEvent(doRemoveTeleport, timeToRemove * 1000)
	elseif item.itemid == 1946 then
		doPlayerSendCancel(cid,"Sorry, not possible.")
	end
	return TRUE
end
you have to configure the positions again, though
 
sorry but its still same bug!
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cfg = {
		stone = { x = 100, y = 100, z = 7 }, -- Stone is Located
		teleport = { x = 100, y = 100, z = 7 }, -- Teleport Creates
		to = { x = 100, y = 100, z = 7 }, -- Teleport Goes
		time = 60 * 1000
	}
	local function reset()
		local tp = getTileItemById(cfg.teleport, 1387)
		if(tp.uid > 0) then
			doRemoveItem(tp.uid)
			doCreateItem(1355, 1, cfg.stone)
			doTransformItem(item.uid, item.itemid - 1)
		end
		return true
	end
	if(item.itemid == 1945) then
		local stoneCheck = getTileItemById(cfg.stone, 1355)
		if(stoneCheck.uid > 0) then
			doRemoveItem(stoneCheck.uid)
			doCreateTeleport(1387, cfg.teleport, cfg.to)
			doCreatureSay(cid, "You have opened the passage.", TALKTYPE_ORANGE_1)
			addEvent(reset, cfg.time)
		end
	elseif(item.itemid == 1946)
		doPlayerSendCancel(cid, "The passage is already open.")
	end
	return true
end
 
Last edited:
fixed:
Code:
local pinkstonepos1 = {x= XXXX, y= YYYY, z= Z} -- Blocking stone position.
local TeleportToPos = {x = XXXX, y = YYYY, z = Z} -- Position the player will be ported to when leaving the DHQ, like the Temple...
local TeleportInPos = {x = XXXX, y = YYYY, z = Z} -- Position In DHQ.
local LeverPos = {x = XXXX, y = YYYY, z = Z} -- Lever Position
local TeleportOutPos = {x = XXXX, y = YYYY, z = Z} -- Telporter out pos
local timeToRemove  = 40 -- Time before quest reset

local function doRemoveTeleport()
	local teleport = getTileItemById(TeleportInPos, 1387).uid
	if teleport > 0 then
		doCreateItem(1355, 1, pinkstonepos1)
		doRemoveItem(teleport)
		doSendMagicEffect(TeleportInPos, CONST_ME_POFF)
		doTransformItem(getTileItemById(LeverPos, 1946).uid, 1945)
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local pinkstone, teleport = getTileItemById(pinkstonepos1, 1355).uid, getTileItemById(TeleportInPos, 1387).uid
		doRemoveItem(pinkstone)
		doCreateTeleport(1387, TeleportToPos, TeleportOutPos)
		doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid,22,"The stone is removed, get the reward before the time runs out!")
		addEvent(doRemoveTeleport, timeToRemove * 1000)
	elseif item.itemid == 1946 then
		doPlayerSendCancel(cid,"Sorry, not possible.")
	end
	return TRUE
end
you have to configure the positions again, though



teleport is not dissapearing and you can't remove flip lever.
 
[04/11/2010 19:20:46] [Error - LuaScriptInterface::loadFile] data/actions/scripts/Quest/demonhelmet.lua:25: 'end' expected (to close 'if' at line 21) near '='
[04/11/2010 19:20:46] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/Quest/demonhelmet.lua)
[04/11/2010 19:20:46] data/actions/scripts/Quest/demonhelmet.lua:25: 'end' expected (to close 'if' at line 21) near '='


can you help me qith this?
 
This will get the job done. ;)

Lua:
local config = {
	daily = "no" -- once a day?
}
 
local t = {
	{x = 33314, y = 31592, z = 15}, -- stone position
	{x = 33316, y = 31591, z = 15}, -- teleport creation position
	{x = 33322, y = 31592, z = 14} -- where the teleport takes you
}
 
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1945) then
		if(getPlayerLevel(cid) > 99) then
			local stone = getTileItemById(t[1], 1355).uid
			if(stone > 0) then
				doRemoveItem(stone)
			end
 
			doCreateTeleport(1387, t[3], t[2])
			doSendMagicEffect(t[2], CONST_ME_TELEPORT)
		else
			return doPlayerSendCancel(cid, "You cannot use this object.")
		end
	elseif(item.itemid == 1946) then
		if(config.daily) then
			return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doRemoveItem(getTileItemById(t[2], 1387).uid)
			doSendMagicEffect(t[2], CONST_ME_POFF)
			doCreateItem(1355, 1, t[1])
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top