-- Dreamer's Challenge Quest System zrobiony przez Smoczek Leon --
-- Dreamer's Challenge Quest System by Smoczek Leon --
function onStepIn(cid, item, pos)
pillow1pos = {x=pos.x+2, y=pos.y, z=pos.z, stackpos=1}
pillow2pos = {x=pos.x+3, y=pos.y, z=pos.z, stackpos=1}
pillow3pos = {x=pos.x+4, y=pos.y, z=pos.z, stackpos=1}
pillow4pos = {x=pos.x+5, y=pos.y, z=pos.z, stackpos=1}
pillow5pos = {x=pos.x+6, y=pos.y, z=pos.z, stackpos=1}
pillow6pos = {x=pos.x+7, y=pos.y, z=pos.z, stackpos=1}
pillow1 = getThingfromPos(pillow1pos)
pillow2 = getThingfromPos(pillow2pos)
pillow3 = getThingfromPos(pillow3pos)
pillow4 = getThingfromPos(pillow4pos)
pillow5 = getThingfromPos(pillow5pos)
pillow6 = getThingfromPos(pillow6pos)
doTransformItem(pillow1.uid,pillow6.itemid)
doTransformItem(pillow2.uid,pillow1.itemid)
doTransformItem(pillow3.uid,pillow2.itemid)
doTransformItem(pillow4.uid,pillow3.itemid)
doTransformItem(pillow5.uid,pillow4.itemid)
doTransformItem(pillow6.uid,pillow5.itemid)
return 1
end
-- Dreamer's Challenge Quest System zrobiony przez Smoczek Leon --
-- Dreamer's Challenge Quest System by Smoczek Leon --
function onStepIn(cid, item, pos)
local nextroom = {x=121, y=125, z=8}
-- blue pillows --
bpillowid = 1686
pillowb1pos = {x=76, y=136, z=8, stackpos=1}
pillowb2pos = {x=77, y=136, z=8, stackpos=1}
pillowb3pos = {x=78, y=136, z=8, stackpos=1}
pillowb4pos = {x=76, y=137, z=8, stackpos=1}
pillowb5pos = {x=77, y=137, z=8, stackpos=1}
pillowb6pos = {x=78, y=137, z=8, stackpos=1}
pillowb7pos = {x=76, y=138, z=8, stackpos=1}
pillowb8pos = {x=77, y=138, z=8, stackpos=1}
pillowb9pos = {x=78, y=138, z=8, stackpos=1}
pillowb1 = getThingfromPos(pillowb1pos)
pillowb2 = getThingfromPos(pillowb2pos)
pillowb3 = getThingfromPos(pillowb3pos)
pillowb4 = getThingfromPos(pillowb4pos)
pillowb5 = getThingfromPos(pillowb5pos)
pillowb6 = getThingfromPos(pillowb6pos)
pillowb7 = getThingfromPos(pillowb7pos)
pillowb8 = getThingfromPos(pillowb8pos)
pillowb9 = getThingfromPos(pillowb9pos)
-- green pillows --
gpillowid = 1688
pillowg1pos = {x=79, y=136, z=8, stackpos=1}
pillowg2pos = {x=80, y=136, z=8, stackpos=1}
pillowg3pos = {x=81, y=136, z=8, stackpos=1}
pillowg4pos = {x=79, y=137, z=8, stackpos=1}
pillowg5pos = {x=80, y=137, z=8, stackpos=1}
pillowg6pos = {x=81, y=137, z=8, stackpos=1}
pillowg7pos = {x=79, y=138, z=8, stackpos=1}
pillowg8pos = {x=80, y=138, z=8, stackpos=1}
pillowg9pos = {x=81, y=138, z=8, stackpos=1}
pillowg1 = getThingfromPos(pillowg1pos)
pillowg2 = getThingfromPos(pillowg2pos)
pillowg3 = getThingfromPos(pillowg3pos)
pillowg4 = getThingfromPos(pillowg4pos)
pillowg5 = getThingfromPos(pillowg5pos)
pillowg6 = getThingfromPos(pillowg6pos)
pillowg7 = getThingfromPos(pillowg7pos)
pillowg8 = getThingfromPos(pillowg8pos)
pillowg9 = getThingfromPos(pillowg9pos)
-- red pillows --
rpillowid = 1687
pillowr1pos = {x=76, y=139, z=8, stackpos=1}
pillowr2pos = {x=77, y=139, z=8, stackpos=1}
pillowr3pos = {x=78, y=139, z=8, stackpos=1}
pillowr4pos = {x=76, y=140, z=8, stackpos=1}
pillowr5pos = {x=77, y=140, z=8, stackpos=1}
pillowr6pos = {x=78, y=140, z=8, stackpos=1}
pillowr7pos = {x=76, y=141, z=8, stackpos=1}
pillowr8pos = {x=77, y=141, z=8, stackpos=1}
pillowr9pos = {x=78, y=141, z=8, stackpos=1}
pillowr1 = getThingfromPos(pillowr1pos)
pillowr2 = getThingfromPos(pillowr2pos)
pillowr3 = getThingfromPos(pillowr3pos)
pillowr4 = getThingfromPos(pillowr4pos)
pillowr5 = getThingfromPos(pillowr5pos)
pillowr6 = getThingfromPos(pillowr6pos)
pillowr7 = getThingfromPos(pillowr7pos)
pillowr8 = getThingfromPos(pillowr8pos)
pillowr9 = getThingfromPos(pillowr9pos)
-- yellow pillows --
ypillowid = 1689
pillowy1pos = {x=79, y=139, z=8, stackpos=1}
pillowy2pos = {x=80, y=139, z=8, stackpos=1}
pillowy3pos = {x=81, y=139, z=8, stackpos=1}
pillowy4pos = {x=79, y=140, z=8, stackpos=1}
pillowy5pos = {x=80, y=140, z=8, stackpos=1}
pillowy6pos = {x=81, y=140, z=8, stackpos=1}
pillowy7pos = {x=79, y=141, z=8, stackpos=1}
pillowy8pos = {x=80, y=141, z=8, stackpos=1}
pillowy9pos = {x=81, y=141, z=8, stackpos=1}
pillowy1 = getThingfromPos(pillowy1pos)
pillowy2 = getThingfromPos(pillowy2pos)
pillowy3 = getThingfromPos(pillowy3pos)
pillowy4 = getThingfromPos(pillowy4pos)
pillowy5 = getThingfromPos(pillowy5pos)
pillowy6 = getThingfromPos(pillowy6pos)
pillowy7 = getThingfromPos(pillowy7pos)
pillowy8 = getThingfromPos(pillowy8pos)
pillowy9 = getThingfromPos(pillowy9pos)
if
((pillowb1.itemid == bpillowid) and
(pillowb2.itemid == bpillowid) and
(pillowb3.itemid == bpillowid) and
(pillowb4.itemid == bpillowid) and
(pillowb5.itemid == bpillowid) and
(pillowb6.itemid == bpillowid) and
(pillowb7.itemid == bpillowid) and
(pillowb8.itemid == bpillowid) and
(pillowb9.itemid == bpillowid) and
(pillowg1.itemid == gpillowid) and
(pillowg2.itemid == gpillowid) and
(pillowg3.itemid == gpillowid) and
(pillowg4.itemid == gpillowid) and
(pillowg5.itemid == gpillowid) and
(pillowg6.itemid == gpillowid) and
(pillowg7.itemid == gpillowid) and
(pillowg8.itemid == gpillowid) and
(pillowg9.itemid == gpillowid) and
(pillowr1.itemid == rpillowid) and
(pillowr2.itemid == rpillowid) and
(pillowr3.itemid == rpillowid) and
(pillowr4.itemid == rpillowid) and
(pillowr5.itemid == rpillowid) and
(pillowr6.itemid == rpillowid) and
(pillowr7.itemid == rpillowid) and
(pillowr8.itemid == rpillowid) and
(pillowr9.itemid == rpillowid) and
(pillowy1.itemid == ypillowid) and
(pillowy2.itemid == ypillowid) and
(pillowy3.itemid == ypillowid) and
(pillowy4.itemid == ypillowid) and
(pillowy5.itemid == ypillowid) and
(pillowy6.itemid == ypillowid) and
(pillowy7.itemid == ypillowid) and
(pillowy8.itemid == ypillowid) and
(pillowy9.itemid == ypillowid)) then
doTeleportThing(cid, nextroom)
doSendMagicEffect(nextroom,10)
doTransformItem(pillowb1.uid,ypillowid)
doTransformItem(pillowb2.uid,bpillowid)
doTransformItem(pillowb3.uid,bpillowid)
doTransformItem(pillowb4.uid,gpillowid)
doTransformItem(pillowb5.uid,rpillowid)
doTransformItem(pillowb6.uid,gpillowid)
doTransformItem(pillowb7.uid,ypillowid)
doTransformItem(pillowb8.uid,bpillowid)
doTransformItem(pillowb9.uid,ypillowid)
doTransformItem(pillowg1.uid,bpillowid)
doTransformItem(pillowg2.uid,rpillowid)
doTransformItem(pillowg3.uid,gpillowid)
doTransformItem(pillowg4.uid,rpillowid)
doTransformItem(pillowg5.uid,ypillowid)
doTransformItem(pillowg6.uid,gpillowid)
doTransformItem(pillowg7.uid,ypillowid)
doTransformItem(pillowg8.uid,bpillowid)
doTransformItem(pillowg9.uid,gpillowid)
doTransformItem(pillowr1.uid,rpillowid)
doTransformItem(pillowr2.uid,ypillowid)
doTransformItem(pillowr3.uid,ypillowid)
doTransformItem(pillowr4.uid,rpillowid)
doTransformItem(pillowr5.uid,rpillowid)
doTransformItem(pillowr6.uid,gpillowid)
doTransformItem(pillowr7.uid,gpillowid)
doTransformItem(pillowr8.uid,bpillowid)
doTransformItem(pillowr9.uid,rpillowid)
doTransformItem(pillowy1.uid,gpillowid)
doTransformItem(pillowy2.uid,bpillowid)
doTransformItem(pillowy3.uid,gpillowid)
doTransformItem(pillowy4.uid,rpillowid)
doTransformItem(pillowy5.uid,ypillowid)
doTransformItem(pillowy6.uid,bpillowid)
doTransformItem(pillowy7.uid,bpillowid)
doTransformItem(pillowy8.uid,rpillowid)
doTransformItem(pillowy9.uid,ypillowid)
else
doTeleportThing(cid, {x=pos.x-3, y=pos.y, z=pos.z})
doSendMagicEffect({x=pos.x-3, y=pos.y, z=pos.z},10)
end
return 1
end
-- Dreamer's Challenge Quest System zrobiony przez Smoczek Leon --
-- Dreamer's Challenge Quest System by Smoczek Leon --
function onStepIn(cid, item, pos)
pillow1pos = {x=pos.x, y=pos.y+2, z=pos.z, stackpos=1}
pillow2pos = {x=pos.x, y=pos.y+3, z=pos.z, stackpos=1}
pillow3pos = {x=pos.x, y=pos.y+4, z=pos.z, stackpos=1}
pillow4pos = {x=pos.x, y=pos.y+5, z=pos.z, stackpos=1}
pillow5pos = {x=pos.x, y=pos.y+6, z=pos.z, stackpos=1}
pillow6pos = {x=pos.x, y=pos.y+7, z=pos.z, stackpos=1}
pillow1 = getThingfromPos(pillow1pos)
pillow2 = getThingfromPos(pillow2pos)
pillow3 = getThingfromPos(pillow3pos)
pillow4 = getThingfromPos(pillow4pos)
pillow5 = getThingfromPos(pillow5pos)
pillow6 = getThingfromPos(pillow6pos)
doTransformItem(pillow1.uid,pillow6.itemid)
doTransformItem(pillow2.uid,pillow1.itemid)
doTransformItem(pillow3.uid,pillow2.itemid)
doTransformItem(pillow4.uid,pillow3.itemid)
doTransformItem(pillow5.uid,pillow4.itemid)
doTransformItem(pillow6.uid,pillow5.itemid)
return 1
end
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
error
here is my error when i walk in the tile ...
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
[05/06/2009 22:30:49] lua script error: [moveevents interface]
[05/06/2009 22:30:49] data/movements/scripts/zeraks/puzzle1.luanstepin
[05/06/2009 22:30:49] luadotransformitem(). Item not found
![]()
-- >>CREDITS<< --
-- Script 100% by COLANDUS
-- Functions 100% by COLANDUS
-- OPENLUA.COM --
-- >>CREDITS<< --
-- >>INFO<< --
-- Don't forget: Place 9 pillows of each color in different order in the mapeditor!
-- Do you use a lever to teleport you to this room? Then you could make it randomize the puzzle when you press it!
-- If you do that, you could remove the randomize part, so it doesn't randomize in this script, make it randomize only when you pull the lever.
-- Your own choise, just giving you ideas!
-- Pilow order to complete:
-- BLUE, GREEN
-- RED, YELLOW
-- >>INFO<< --
-- >>CONFIG<< --
local verticalTiles = 5400 -- Action id of the vertical tiles.
local horizontalTiles = 5401 -- Action id of the horizontal tiles.
local ground = {normal = 426, used = 425} -- Itemid of the ground tile when it is normal or used (when you stand on it)
local teleport = {itemid = 1387, actionid = 5408} -- Enter the itemid and the actionid of the teleport.
local teleportPosition = {x = 896, y = 389, z = 7} -- Where should the teleport be spawned when you finnish the puzzle?
local newPosition = {x = 900, y = 284, z = 7} -- Where should you get teleported when you enter the teleport?
local position = {x = 886, y = 394, z = 7} -- Position of the north west (top left) side of the puzzle area.
local magicEffect = 34 -- What effect will appear when you finnish the puzzle? Leave blank or write "nil" if you don't want any.
-- >>CONFIG<< --
function onStepIn(cid, item, pos)
teleportPosition.stackpos = 1
local getTeleport = getThingfromPos(teleportPosition)
if getTeleport.itemid == teleport.itemid and getTeleport.actionid == teleport.actionid then
doRemoveItem(getTeleport.aid, 1)
end
local getPillow = {}
if item.actionid == verticalTiles then
for i = 0, 5 do
getPillow[i + 1] = getThingfromPos({x = position.x + (i * 1), y = getPlayerPosition(cid).y, z = position.z, stackpos = 1})
end
elseif item.actionid == horizontalTiles then
for i = 0, 5 do
getPillow[i + 1] = getThingfromPos({x = getPlayerPosition(cid).x, y = position.y + (i * 1), z = position.z, stackpos = 1})
end
end
doTransformItem(getPillow[1].aid, getPillow[6].itemid)
for i = 1, 5 do
doTransformItem(getPillow[i + 1].aid, getPillow[i].itemid)
end
if checkPillows(position.x, position.y, 1686) == 1 and checkPillows(position.x + 3, position.y, 1688) == 1 and checkPillows(position.x, position.y + 3, 1687) == 1 and checkPillows(position.x + 3, position.y + 3, 1689) == 1 then
local newTeleport = doCreateTeleport(teleport.itemid, newPosition, teleportPosition)
doSetItemActionId(newTeleport, teleport.actionid)
if magicEffect ~= nil then
doSendMagicEffect(pos, magicEffect)
end
end
doTransformItem(item.aid, ground.used)
return 1
end
function onStepOut(cid, item, pos)
pos.stackpos = 1
local getPos = getThingfromPos(pos)
teleportPosition.stackpos = 1
local getTeleport = getThingfromPos(teleportPosition)
if comparePos(pos, teleportPosition) and getPos.itemid == getTeleport.itemid and getPos.actionid == getTeleport.actionid then
teleportPosition.stackpos = 1
doRemoveItem(getTeleport.aid, 1)
resetPuzzle()
return 1
else
doTransformItem(item.aid, ground.normal)
return 1
end
end
function checkPillows(posx, posy, item)
local returnValue = 1
for gx = posx, posx + 2 do
for gy = posy, posy + 2 do
if getThingfromPos({x = gx, y = gy, z = position.z, stackpos = 1}).itemid ~= item then
returnValue = 0
break
end
end
end
return returnValue
end
function resetPuzzle()
local availablePillows = {}
for i = 0, 3 do
local pillowId = 1686 + i
for i = 1, 9 do
table.insert(availablePillows, pillowId)
end
end
availablePillows = shuffleTable(availablePillows)
for gx = position.x, position.x + 5 do
for gy = position.y, position.y + 5 do
local pillow = math.random(1, #availablePillows)
getItem = getThingfromPos({x = gx, y = gy, z = position.z, stackpos = 1})
doTransformItem(getItem.aid, availablePillows[pillow])
table.remove(availablePillows, pillow)
end
end
end
function shuffleTable(t)
local newTable = {}
for i = 1, #t do
randomId = math.random(1, #t)
table.insert(newTable, t[randomId])
table.remove(t, randomId)
end
return newTable
end