arthurluna
Member
- Joined
- Apr 12, 2008
- Messages
- 180
- Reaction score
- 15
in cThing3 not putting the item 7185
Code:
-- Monstros para sumonar
local chakoyas = {
"chakoya toolshaper",
"chakoya tribewarden",
"chakoya windcaller"
}
-- Tempo de execução para transformar o item de volta.
local eventTimer = 15000
-- Posições dos alvos.
local cPos1 = {x=32399, y=31051, z=7}
local cPos2 = {x=32394, y=31062, z=7}
local cPos3 = {x=32393, y=31072, z=7}
-- ID do item antes de transformado e depois de ser transformado
local prevItem = 7185
local nextItem = 7186
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.actionid == 100 and itemEx.itemid == prevItem and item.itemid == 2553) then
if(getPlayerStorageValue(cid, 121) == 5) then
setPlayerStorageValue(cid, 122, getPlayerStorageValue(cid, 122) < 1 and 1 or getPlayerStorageValue(cid, 122) + 1)
-- Sumona uma das 3 criaturas.
doSummonCreature(chakoyas[math.random(1, 3)], toPosition)
doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
-- Transforma.
doTransformItem(itemEx.uid, nextItem)
-- Se usou pela terceira vez.
if(getPlayerStorageValue(cid, 122) >= 3) then
setPlayerStorageValue(cid, 121, 5)
addEvent(actionRestore, eventTimer)
end
end
end
return true
end
function actionRestore()
-- Items
local cThing1 = getThingfromPos(cPos1)
local cThing2 = getThingfromPos(cPos2)
local cThing3 = getThingfromPos(cPos3)
-- Transformação
if cThing1.itemid == nextItem then
doTransformItem(cThing1.uid,prevItem)
end
if cThing2.itemid == nextItem then
doTransformItem(cThing2.uid,prevItem)
end
if cThing3.itemid == nextItem then
doTransformItem(cThing3.uid,prevItem)
end
end