• 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 Pillar quest Script

tosse12

Panchira Project Member
Joined
Jun 10, 2007
Messages
864
Reaction score
9
Location
Sweden
Hi Otlanders!

I am having a problem with my current script: Pillar quest

Some short info what this script SHOULD do,

1. You use a hammer at the pillar
2. When the hammer is used at the pillar, the pillar shall turn into a broken pillar
3. If, all 4 pillars are broken pillars a monster shall spawn.

Here is the script:
Lua:
local config = {
mpos = {x=10001, y=10644,z=7},
monster = "Dwarf",
hammer = 2557, -- Hammmer/item id.
pillar = 3766, -- Pillar Id
broken_pillar = 3767,
cancel = "This pillar is already broken.",
pillars_uid = {
 [3002] = { text="BROOOOM!!"},
 [3003] = { text="BRAAAM!!"},
 [3004] = { text="Kaboom!!"},
 [3005] = { text="Badam!!"}
},

}
function reset()
	doTransformItem(configt.pillars_aid[item.uid], pillar)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.itemid == config.pillar and item.itemid == config.hammer then
		local x = config.pillars_uid[item.uid]
		doTransformItem(x, config.broken_pillar)
		doPlayerSendTextMessage(cid, 19, x.text)
		addEven(reset, 90000)
		if config.pillars_uid[1] == config.broken_pillar and config.pillars_uid[2] == config.broken_pillar and config.pillars_uid[3] == config.broken_pillar and config.pillars_ud[4] == config.broken_pillar then
			doSummonCreature(config.monster, config.mpos)
		end
	else
		doPlayerSendTextMessage(cid, 19, config.cancel)
		

	end
	return TRUE
end

I am getting this error when using this script:
Code:
[Error - Action Interface]
data/actions/scripts/pillar_quest.lua:onUse
Description:
data/actions/scripts/pillar_quest.lua:26: attempt to index local 'x' (a nil valu
e)
stack traceback:
        data/actions/scripts/pillar_quest.lua:26: in function <data/actions/scri
pts/pillar_quest.lua:22>

The Transform part doesn't work, because the value is an index, not a value.

I now ask you, how I should solve this problem.

Thanks in advance!
 
I'm not sure but try this:
Code:
local config = {
mpos = {x=10001, y=10644,z=7},
monster = "Dwarf",
hammer = 2557, -- Hammmer/item id.
pillar = 3766, -- Pillar Id
broken_pillar = 3767,
cancel = "This pillar is already broken.",
pillars_uid = {
 [3002] = { text="BROOOOM!!"},
 [3003] = { text="BRAAAM!!"},
 [3004] = { text="Kaboom!!"},
 [3005] = { text="Badam!!"}
}
 
}
function reset()
    doTransformItem(configt.pillars_aid[item.uid], pillar)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == config.pillar and item.itemid == config.hammer then
        local x = config.pillars_uid[item.uid]
        doTransformItem(x, config.broken_pillar)
        doPlayerSendTextMessage(cid, 19, x.text)
        addEven(reset, 90000)
        if config.pillars_uid[1] == config.broken_pillar and config.pillars_uid[2] == config.broken_pillar and config.pillars_uid[3] == config.broken_pillar and config.pillars_ud[4] == config.broken_pillar then
            doSummonCreature(config.monster, config.mpos)
        end
    else
        doPlayerSendTextMessage(cid, 19, config.cancel)
 
 
    end
    return TRUE
end
 
Code:
[Error - Action Interface]
data/actions/scripts/pillar_quest.lua:onUse
Description:
data/actions/scripts/pillar_quest.lua:26: attempt to index local 'x' (a nil valu
e)
stack traceback:
        data/actions/scripts/pillar_quest.lua:26: in function <data/actions/scri
pts/pillar_quest.lua:22>

:(
 
here try sorry for delay :)
Lua:
local config = {
                  mpos = {x=93, y=141,z=7},
                  monster = "Dwarf",
                  hammer = 2557, -- Hammmer/item id.
                  pillar = 3766, -- Pillar Id
                  broken_pillar = 3767,
                  back = 1,   -- time fot pillar to get back in minutes
                  cancel = "This pillar is already broken.",
                  pillars_uid = {
                                   [3002] = { text="BROOOOM!!"},
                                   [3003] = { text="BRAAAM!!"},
                                   [3004] = { text="Kaboom!!"},
                                   [3005] = { text="Badam!!"}
                                },
                  pos = {{x=92, y=138,z=7}, {x=93, y=138,z=7}, {x=94, y=138,z=7}, {x=95, y=138,z=7}} --put here the places of the 4 pillars
 
                }
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local get = 0
local function reset(tp)
             if getTileItemById(tp, config.broken_pillar).uid > 0 then
	               doTransformItem(itemEx.uid, config.pillar)
             end
      end
      if itemEx.itemid == config.pillar then
		local x = config.pillars_uid[itemEx.uid]
			if not x then
				doPlayerSendTextMessage(cid, 19, "You must use on the right pillar.")
			else
				doTransformItem(itemEx.uid, config.broken_pillar)
				doPlayerSendTextMessage(cid, 19, x.text)
				addEvent(reset,config.back * 60 *1000 ,toPosition)
						for i = 1, #config.pos do
							if getTileItemById(config.pos[i], config.broken_pillar).uid > 0 then
								get = true
							else
								get=false
								break
							end
		                end
		                if get == true then
					doSummonCreature(config.monster, config.mpos)
		                end
	                end
      elseif itemEx.itemid == 3767 then
		doPlayerSendTextMessage(cid, 19,"The pillar is broken.")
      else
		doPlayerSendTextMessage(cid, 19,"You must use a hammer on a pillar.")
      end
	return true
end
 
Last edited:
Back
Top