Porem caso ele morra, antes do evento sobe um retorno de erro na Distro!
Erro:
Spoiler
[17:34:36.353] [Error - Action Interface]
[17:34:36.354] In a timer event called from:
[17:34:36.355] data/actions/scripts/Petsystemm.lua:onUse
[17:34:36.355] Description:
[17:34:36.356] (luaDoRemoveCreature) Creature not found
Qual seria a forma de passar por isso ? sem tomar esse retorno de erro ?
Script.
Spoiler
function onUse(cid, item, fromPosition, itemEx, toPosition)
local go = dolls[item.itemid]
local summon = getCreatureSummons(cid)
local waittime = 600 -- Tempo de exhaustion em segundos
local strtime = 250663 -- Storage, nunca usar a mesma em outra Script do mesmo tipo. Ex: mesmo creaturescript, mesmo action e etc...
if exhaustion.check(cid, strtime) then
doPlayerSendTextMessage(cid, 19, "Aguarde " .. exhaustion.get(cid, strtime) .. " segundos para usar pet novamente .")
return true
end
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid then
doPlayerSendCancel(cid, "Voce deve colocar Contrato no lugar do escudo.")
return true
end
---------------------------------------------------
if not (getTilePzInfo(getCreaturePosition(cid))) then
if #summon >= 1 then
for _, pid in ipairs(summon) do
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você já tem criatura summonada")
exhaustion.set(cid, strtime, waittime) -- checar time
end
return true
end
if item.itemid == 13708 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13711 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13712 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13714 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13713 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13781 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13782 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13716 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13717 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13718 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13715 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13707 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13706 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13709 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13783 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13710 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13784 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
else
doPlayerSendTextMessage(cid, 19, "Voce nao pode sumonar seu PET em Protect Zone!")
return true
end
end
E teria como implementar um sandCancel ? para ele checar o storage e ficar posicionando quanto tempo falta para o summon sumir ? ( e qual seria a forma se possivel detalhar para meu melhor aprendizado)
Pergunta
ZeusMnc 0
Salve Xtibia tenho um Script de Summon!
e utilizo o Addevent para fazer ele sumir depois de 2 minutos!
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
Porem caso ele morra, antes do evento sobe um retorno de erro na Distro!
Erro:
[17:34:36.353] [Error - Action Interface]
[17:34:36.354] In a timer event called from:
[17:34:36.355] data/actions/scripts/Petsystemm.lua:onUse
[17:34:36.355] Description:
[17:34:36.356] (luaDoRemoveCreature) Creature not found
Qual seria a forma de passar por isso ? sem tomar esse retorno de erro ?
Script.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local dolls = {
[13708] = {pet = "Fly Summon"},
[13711] = {pet = "Dragon Summon"}, -- ID DO ITEM E NOME DO MONSTRO QUE IRÁ SUMONAR
[13712] = {pet = "Dog Summon"},
[13714] = {pet = "Cat Summon"},
[13713] = {pet = "Gregory Summon"},
[13781] = {pet = "Power Oozaru Summon"},
[13715] = {pet = "Ghost Summon"},
[13717] = {pet = "Golden Power Summon"},
[13718] = {pet = "Mini Summon"},
[13716] = {pet = "Mini Golden Summon"},
[13782] = {pet = "Red Ghost Summon"},
[13707] = {pet = "Black Power Summon"},
[13709] = {pet = "Orc Summon"},
[13783] = {pet = "Karin Summon"},
[13706] = {pet = "Anjo Summon"},
[13710] = {pet = "Wolf God Helper"},
[13784] = {pet = "Patinho Summon"},
}
local go = dolls[item.itemid]
local summon = getCreatureSummons(cid)
local waittime = 600 -- Tempo de exhaustion em segundos
local strtime = 250663 -- Storage, nunca usar a mesma em outra Script do mesmo tipo. Ex: mesmo creaturescript, mesmo action e etc...
if exhaustion.check(cid, strtime) then
doPlayerSendTextMessage(cid, 19, "Aguarde " .. exhaustion.get(cid, strtime) .. " segundos para usar pet novamente .")
return true
end
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid then
doPlayerSendCancel(cid, "Voce deve colocar Contrato no lugar do escudo.")
return true
end
---------------------------------------------------
if not (getTilePzInfo(getCreaturePosition(cid))) then
if #summon >= 1 then
for _, pid in ipairs(summon) do
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você já tem criatura summonada")
exhaustion.set(cid, strtime, waittime) -- checar time
end
return true
end
if item.itemid == 13708 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13711 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13712 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13714 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13713 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13781 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13782 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13716 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13717 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13718 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13715 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13707 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13706 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13709 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13783 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13710 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
if item.itemid == 13784 then -- ID DO ITEM
doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid)))
doCreatureSay(cid, ""..go.pet..", GO!", TALKTYPE_ORANGE_1) -- MENSAGEM AO SUMONAR O PET
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 350)
addEvent(doRemoveCreature, 120000, (getCreatureSummons(cid)[1]))
exhaustion.set(cid, strtime, waittime)
end
else
doPlayerSendTextMessage(cid, 19, "Voce nao pode sumonar seu PET em Protect Zone!")
return true
end
end
E teria como implementar um sandCancel ? para ele checar o storage e ficar posicionando quanto tempo falta para o summon sumir ? ( e qual seria a forma se possivel detalhar para meu melhor aprendizado)
Link para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados