BE
dúvida

Ajudar Com As Portas (Action) Docreateitem (Resolvido)

Por Bennyhappy, 10 de jul. de 2012 em Scripts

5
1.2k
BennyhappyB
11 de julho de 2012 às 10:33

function onUse(cid, item, fromPosition, itemEx, toPosition)
local monstros ={
{{x = 9168, y = 8572, z = 7}, "Dragon"},
{{x = 9175, y = 8558, z = 7}, "Dragon"},
{{x = 9169, y = 8575, z = 7}, "Dragon"},
{{x = 9172, y = 8556, z = 7}, "Dragon"},
{{x = 9173, y = 8567, z = 7}, "Dragon"},
{{x = 9161, y = 8566, z = 7}, "Dragon"},
{{x = 9165, y = 8567, z = 7}, "Dragon"},
{{x = 9163, y = 8557, z = 7}, "Dragon"},
{{x = 9183, y = 8560, z = 7}, "Dragon"},
{{x = 9181, y = 8566, z = 7}, "Dragon"},
{{x = 9165, y = 8560, z = 7}, "Dragon"},
{{x = 9171, y = 8575, z = 7}, "Dragon Lord"},
{{x = 9184, y = 8557, z = 7}, "Dragon Lord"},
{{x = 9184, y = 8565, z = 7}, "Dragon Lord"},
{{x = 9177, y = 8556, z = 7}, "Dragon Lord"},
{{x = 9168, y = 8558, z = 7}, "Dragon Lord"},
{{x = 9165, y = 8555, z = 7}, "Dragon Lord"},
{{x = 9162, y = 8563, z = 7}, "Dragon Lord"},
{{x = 9175, y = 8575, z = 7}, "Dragon Lord"},
{{x = 9170, y = 8565, z = 7}, "Dragon Lord"},
{{x = 9169, y = 8562, z = 7}, "Dragon Lord"},
{{x = 9177, y = 8567, z = 7}, "Dragon Lord"},
{{x = 9169, y = 8568, z = 7}, "Dragon Lord Hatchling"},
{{x = 9178, y = 8573, z = 7}, "Dragon Lord Hatchling"},
{{x = 9182, y = 8570, z = 7}, "Dragon Lord Hatchling"},
{{x = 9178, y = 8563, z = 7}, "Dragon Lord Hatchling"}
}
if SevenFloor() == false then
return doPlayerSendCancel(cid, "sorry already have monster.")
end
for _, summon in pairs(monstros) do
doCreateMonster(summon[2], summon[1])
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
wall1 = {x=9166, y=8574, z=7, stackpos=1}
getwall1 = getThingfromPos(wall1)
wall2 = {x=9173, y=8569, z=7, stackpos=1}
getwall2 = getThingfromPos(wall2)
wall3 = {x=9180, y=8581, z=7, stackpos=1}
getwall3 = getThingfromPos(wall3)

doCreateItem(9166,1,wall1)
doCreateItem(5278,1,wall2)
doCreateItem(9165,1,wall3)
return true
end
function SevenFloor()
local fromPosition,toPosition = {x = 9155, y = 8552, z = 7},{x = 9191, y = 8589, z = 7} -- começo e final da ára
for x = fromPosition.x, toPosition.x do
for y = fromPosition.y, toPosition.y  do
local pos = {x=x, y=y, z=fromPosition.z}
local m = getTopCreature(pos).uid
if m ~= 0 and isMonster(m) then
return false
end
doCleanTile(pos)
end
end
return true
end

 

Preciso de ajuda nestas linhas, eu preciso que se, no lugar onde as portas serão adicionados, reconhecer se você já é uma porta nessa posição, não agrege outra porta, porque eles são ensimadas as 2 portas,

 

 

doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)

wall1 = {x=9166, y=8574, z=7, stackpos=1}

getwall1 = getThingfromPos(wall1)

wall2 = {x=9173, y=8569, z=7, stackpos=1}

getwall2 = getThingfromPos(wall2)

wall3 = {x=9180, y=8581, z=7, stackpos=1}

getwall3 = getThingfromPos(wall3)

 

doCreateItem(9166,1,wall1)

doCreateItem(5278,1,wall2)

doCreateItem(9165,1,wall3)

return true

end

 

@bump

Editado Julho 12 por beenii

LeoxtibiaL
11 de julho de 2012 às 20:13

Assim:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
local monstros ={
{{x = 9168, y = 8572, z = 7}, "Dragon"},
{{x = 9175, y = 8558, z = 7}, "Dragon"},
{{x = 9169, y = 8575, z = 7}, "Dragon"},
{{x = 9172, y = 8556, z = 7}, "Dragon"},
{{x = 9173, y = 8567, z = 7}, "Dragon"},
{{x = 9161, y = 8566, z = 7}, "Dragon"},
{{x = 9165, y = 8567, z = 7}, "Dragon"},
{{x = 9163, y = 8557, z = 7}, "Dragon"},
{{x = 9183, y = 8560, z = 7}, "Dragon"},
{{x = 9181, y = 8566, z = 7}, "Dragon"},
{{x = 9165, y = 8560, z = 7}, "Dragon"},
{{x = 9171, y = 8575, z = 7}, "Dragon Lord"},
{{x = 9184, y = 8557, z = 7}, "Dragon Lord"},
{{x = 9184, y = 8565, z = 7}, "Dragon Lord"},
{{x = 9177, y = 8556, z = 7}, "Dragon Lord"},
{{x = 9168, y = 8558, z = 7}, "Dragon Lord"},
{{x = 9165, y = 8555, z = 7}, "Dragon Lord"},
{{x = 9162, y = 8563, z = 7}, "Dragon Lord"},
{{x = 9175, y = 8575, z = 7}, "Dragon Lord"},
{{x = 9170, y = 8565, z = 7}, "Dragon Lord"},
{{x = 9169, y = 8562, z = 7}, "Dragon Lord"},
{{x = 9177, y = 8567, z = 7}, "Dragon Lord"},
{{x = 9169, y = 8568, z = 7}, "Dragon Lord Hatchling"},
{{x = 9178, y = 8573, z = 7}, "Dragon Lord Hatchling"},
{{x = 9182, y = 8570, z = 7}, "Dragon Lord Hatchling"},
{{x = 9178, y = 8563, z = 7}, "Dragon Lord Hatchling"}
}

if SevenFloor() == false then
return doPlayerSendCancel(cid, "sorry already have monster.")
end
for _, summon in pairs(monstros) do
doCreateMonster(summon[2], summon[1])
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)

local walls = {{x=9166, y=8574, z=7, stackpos=1},{x=9173, y=8569, z=7, stackpos=1},{x=9180, y=8581, z=7, stackpos=1}}
local doors = {9166, 5278, 9165}

for i=1, 3 do
if getTileItemById(walls[i], doors[i]).uid > 0 then return false else doCreateItem(doors[i],1,walls[i]) end
end

function SevenFloor()
local fromPosition,toPosition = {x = 9155, y = 8552, z = 7},{x = 9191, y = 8589, z = 7} -- começo e final da ára
for x = fromPosition.x, toPosition.x do
for y = fromPosition.y, toPosition.y  do
local pos = {x=x, y=y, z=fromPosition.z}
local m = getTopCreature(pos).uid
if m ~= 0 and isMonster(m) then
return false
end
doCleanTile(pos)
end
end
return true
end

Editado Julho 11 por Leoxtibia

BennyhappyB
12 de julho de 2012 às 03:27

[Error - LuaScriptInterface::loadFile] data/actions/scripts/private 1/spawn dragys 1.lua:59: 'end' expected (to close 'function' at line 1) near '<eof>'

[Warning - Event::loadScript] Cannot load script (data/actions/scripts/private 1/spawn dragys 1.lua)

data/actions/scripts/private 1/spawn dragys 1.lua:59: 'end' expected (to close 'function' at line 1) near '<eof>'

 

xD

 

resolvido, apenas agrege a end no final, graças Leoxtibia

LeoxtibiaL
12 de julho de 2012 às 08:39

Verdade, devo ter apagado sem querer ^^. Tópico reportado para moverem.

ErimythE
13 de julho de 2012 às 01:25

Duvida sanada

Movido