Ir para conteúdo
  • 0

Script Pillow


GodalonexD

Pergunta

Meu server caiu depois de aparecer varios erros igual a este

 

[4/11/2012 18:41:18] [Error - MoveEvents Interface]

[4/11/2012 18:41:18] data/movements/scripts/pillow.lua:onStepOut

[4/11/2012 18:41:18] Description:

[4/11/2012 18:41:18] data/movements/scripts/pillow.lua:69: attempt to call global 'comparePos' (a nil value)

[4/11/2012 18:41:18] stack traceback:

[4/11/2012 18:41:18] data/movements/scripts/pillow.lua:69: in function <data/movements/scripts/pillow.lua:64>

 

[4/11/2012 18:41:19] [Error - MoveEvents Interface]

[4/11/2012 18:41:19] data/movements/scripts/pillow.lua:onStepOut

[4/11/2012 18:41:19] Description:

[4/11/2012 18:41:19] data/movements/scripts/pillow.lua:69: attempt to call global 'comparePos' (a nil value)

[4/11/2012 18:41:19] stack traceback:

[4/11/2012 18:41:19] data/movements/scripts/pillow.lua:69: in function <data/movements/scripts/pillow.lua:64>

 

porque isso aconteceu? alguem poderia me da uma ajuda e arrumar?

REP+

 

 

-- >>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 config = {

teleport_aid = 5408

}

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 = 32826, y = 32347, z = 9} -- Where should the teleport be spawned when you finnish the puzzle?

local newPosition = {x = 32764, y = 32273, z = 14} -- Where should you get teleported when you enter the teleport?

local position = {x = 32818, y = 32334, z = 9} -- Position of the north west (top left) side of the puzzle area.

local magicEffect = 49 -- 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.uid, 1)

end

local getPillow = {}

if item.actionid == verticalTiles then

for i = 0, 5 do

getPillow[i + 1] = getThingfromPos({x = position.x + i, 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, z = position.z, stackpos = 1})

end

end

doTransformItem(getPillow[1].uid, getPillow[6].itemid)

for i = 1, 5 do

doTransformItem(getPillow[i + 1].uid, getPillow.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)

doItemSetAttribute(newTeleport, "aid", config.teleport_aid)

if magicEffect ~= nil then

doSendMagicEffect(pos, magicEffect)

end

end

doTransformItem(item.uid, 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.uid, 1)

resetPuzzle()

return 1

else

doTransformItem(item.uid, 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.uid, 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

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

pq ta faltando a function comparePos(pos, teleportPosition)... ;x

tenta por isso ae no teu script..

function comparePos(pos1, pos2)
return (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z)
end

Link para o comentário
Compartilhar em outros sites

  • 0

ok irei fazer isso...

 

agora da uma pequena força nesse aqui tambem, aproveitando?...

 

 

 

 

[4/11/2012 19:12:57] [Error - Action Interface]

[4/11/2012 19:12:57] data/actions/scripts/zaolever.lua:onUse

[4/11/2012 19:12:57] Description:

[4/11/2012 19:12:57] (luaDoTeleportThing) Thing not found

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

if(item.actionid == 4830) then

doTeleportThing(getTopCreature({x=32991,y=31539,z=1}).uid, {x=32991,y=31539,z=4})

elseif (item.actionid == 4831) then

doTeleportThing(getTopCreature({x=32991,y=31539,z=4}).uid, {x=32991,y=31539,z=1})

elseif (item.actionid == 4832) then

doTeleportThing(getTopCreature({x=32993,y=31547,z=4}).uid, {x=33061,y=31527,z=10})

elseif (item.actionid == 4833) then

doTeleportThing(getTopCreature({x=33061,y=31527,z=10}).uid, {x=32993,y=31547,z=4})

end

return true

end

Link para o comentário
Compartilhar em outros sites

  • 0

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

 

local posis = {

[4830] = {getTopCreature({x=32991,y=31539,z=1}).uid, {x=32991,y=31539,z=4}},

[4831] = {getTopCreature({x=32991,y=31539,z=4}).uid, {x=32991,y=31539,z=1}},

[4832] = {getTopCreature({x=32993,y=31547,z=4}).uid, {x=33061,y=31527,z=10}},

[4833] = {getTopCreature({x=33061,y=31527,z=10}).uid, {x=32993,y=31547,z=4}},

}

 

if posis[item.actionid] then

local pid = posis[item.actionid][1]

local pos = posis[item.actionid][2]

if isCreature(pid) then

doTeleportThing(pid, pos, false)

doSendMagicEffect(getPlayerPosition(pid), 21)

end

end

 

return true

end

 

 

ta ae... e mano.. se puder, use spoiler em vez de QUOTE, deixa o topico melhor ^^

para usar..

[ spoiler] teu script [ /spoiler]

sem os espaços...

Link para o comentário
Compartilhar em outros sites

  • 0

é que meu navegador nao abre o spoiler tenho que fecha e abrir outro e as vezes nem pega dai uso so quote :S

 

mais beleza.

 

vou ve se funciona aquele la o primeiro que voce envio e o segundo, qualquer coisa edito aqui ou mando privado ok?

 

REP+

 

por mim ajudar, ja pedi pra arruma uns script aqui e ninguem respondeu ;[

 

 

edit

o erro do primeiro continuo...

Editado por TitanicoxD
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...