[12/06/2015 11:09:04] [Error - CreatureScript Interface]
[12/06/2015 11:09:04] In a timer event called from:
[12/06/2015 11:09:04] data/creaturescripts/scripts/dropStone.lua:onKill
[12/06/2015 11:09:04] Description:
[12/06/2015 11:09:04] data/creaturescripts/scripts/dropStone.lua:4: attempt to compare nil with number
[12/06/2015 11:09:04] stack traceback:
[12/06/2015 11:09:04] data/creaturescripts/scripts/dropStone.lua:4: in function 'sendEffect'
[12/06/2015 11:09:04] data/creaturescripts/scripts/dropStone.lua:19: in function <data/creaturescripts/scripts/dropStone.lua:10>
- Fórum
- xTibia - Notícias e Suporte
- Soluções
- Archived
- Efeito Drop Stone.
info
Grupo: Visconde
Registrado: 28/07/12
Posts: 273
Reputação: +26
Char no Tibia: Kisame of Tenebra

info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino

Tenta:
local effect = 169 --by brun123 --alterado v1.9 \/
local arrow = {effect, duration} --Respectivamente, efeito e duração (segundos).
function doSendMagicEffect(pos, time)
if time < 0 then
return true
end
doSendMagicEffect(pos, arrow[1])
addEvent(sendEffect, 1000, pos, time - 1)
end
local function func(cid, position, corpseid, effect)
if not isCreature(cid) then return true end
local corpse = getTileItemById(position, corpseid).uid
if corpse <= 1 then return end
if not isContainer(corpse) then return true end
for slot = 0, (getContainerSize(corpse)-1) do
local item = getContainerItem(corpse, slot)
if item.uid <= 1 then return end
if isStone(item.itemid) then
return doSendMagicEffect(getThingPos(cid), effect) and sendEffect(position, arrow[2])
end
end
end
function onKill(cid, target, lastHit)
if not ehMonstro(target) then return true end
local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect)
return true
end
Você provavelmente se esqueceu de configurar a tabela arrow.
@ricardoberg
Desculpe, não conheço a estrutura dos códigos desta base, mas suponho que basta algumas alterações no script que enviei para que funcione.
Editado Junho 12 por zipter98
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

Você provavelmente se esqueceu de configurar a tabela arrow.
@ricardoberg
Desculpe, não conheço a estrutura dos códigos desta base, mas suponho que basta algumas alterações no script que enviei para que funcione.
Zipter, poderia me ajudar a fazer pegar essa script na base do Kpdo/Exaioros ? ou poderia modificar essa script para virar uma script própria ? tipo no meio da script a pessoa colocaria os ids das Stones, e adicionava uma Tag para fazer pegar a script, pq na base que uso n tem a script DropStone.lua
Claro.
local effect = 169 --by brun123 --alterado v1.9 \/
local arrow = {effect, duration} --Respectivamente, efeito e duração (segundos).
local items = {itemid, itemid, itemid, ...} --Tabela para configurar os items.
function sendEffect(pos, time)
if time < 0 then
return true
end
doSendMagicEffect(pos, arrow[1])
addEvent(sendEffect, 1000, pos, time - 1)
end
local function func(cid, position, corpseid, effect)
if not isCreature(cid) then return true end
local corpse = getTileItemById(position, corpseid).uid
if corpse <= 1 then return end
if not isContainer(corpse) then return true end
for slot = 0, (getContainerSize(corpse)-1) do
local item = getContainerItem(corpse, slot)
if item.uid <= 1 then return end
if isInArray(items, item.itemid) then
return doSendMagicEffect(getThingPos(cid), effect) and sendEffect(position, arrow[2])
end
end
end
function onKill(cid, target, lastHit)
if not isMonster(target) then return true end
local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect)
return true
end
<event type="kill" name="dropStone" script="nome_do_arquivo.lua"/>
Editado Junho 12 por zipter98
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

Claro.
local effect = 169 --by brun123 --alterado v1.9 \/ local arrow = {effect, duration} --Respectivamente, efeito e duração (segundos). local items = {itemid, itemid, itemid, ...} --Tabela para configurar os items. function sendEffect(pos, time) if time < 0 then return true end doSendMagicEffect(pos, arrow[1]) addEvent(sendEffect, 1000, pos, time - 1) end local function func(cid, position, corpseid, effect) if not isCreature(cid) then return true end local corpse = getTileItemById(position, corpseid).uid if corpse <= 1 then return end if not isContainer(corpse) then return true end for slot = 0, (getContainerSize(corpse)-1) do local item = getContainerItem(corpse, slot) if item.uid <= 1 then return end if isInArray(items, item.itemid) then return doSendMagicEffect(getThingPos(cid), effect) and sendEffect(position, arrow[2]) end end end function onKill(cid, target, lastHit) if not isMonster(target) then return true end local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect) return true endTag:<event type="kill" name="dropStone" script="nome_do_arquivo.lua"/>Não se esqueça de registrar o evento em login.lua.
Poderia mostrar a tag que eu colocaria pra registra no login.lua ? e poderia me dizer como eu configuro essa script ? rsrs
Editado Junho 12 por ricardoberg
info
Grupo: Herói
Registrado: 01/05/08
Posts: 2.6k
Reputação: +536
Gênero: Masculino

Poderia mostrar a tag que eu colocaria pra registra no login.lua ? e poderia me dizer como eu configuro essa script ? rsrs
registerCreatureEvent(cid, "dropStone")
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

registerCreatureEvent(cid, "dropStone")
Vlws U.u Consegui ^^ Reputado
Claro.
local effect = 169 --by brun123 --alterado v1.9 \/ local arrow = {effect, duration} --Respectivamente, efeito e duração (segundos). local items = {itemid, itemid, itemid, ...} --Tabela para configurar os items. function sendEffect(pos, time) if time < 0 then return true end doSendMagicEffect(pos, arrow[1]) addEvent(sendEffect, 1000, pos, time - 1) end local function func(cid, position, corpseid, effect) if not isCreature(cid) then return true end local corpse = getTileItemById(position, corpseid).uid if corpse <= 1 then return end if not isContainer(corpse) then return true end for slot = 0, (getContainerSize(corpse)-1) do local item = getContainerItem(corpse, slot) if item.uid <= 1 then return end if isInArray(items, item.itemid) then return doSendMagicEffect(getThingPos(cid), effect) and sendEffect(position, arrow[2]) end end end function onKill(cid, target, lastHit) if not isMonster(target) then return true end local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect) return true endTag:<event type="kill" name="dropStone" script="nome_do_arquivo.lua"/>Não se esqueça de registrar o evento em login.lua.
Zipter poderia complementar essa script pfv ? ^^ tipo queria que alem do efeito que fica em cima do corps, queria que aparece-se um nome também tipo " Vc Dropou Tal Stone " e esse nome ficava subindo em cima do corps do monstro e desaparecia e quando subi-se denovo ele vinha com outra cor
info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino

No meu n Funfo ¬¬ alguem poderia adaptar pro?? tipo, ao dropar a stone do pokémon, acontece um efeito encima do corpose do poke, e envia uma mensagem em azul para o player que ele dropou a stone! pfv alguem pode ajudar?
local effect = 173 --by brun123 --alterado v2.9 \/
local function func(cid, position, corpseid, effect)
if not isCreature(cid) then return true end
local corpse = getTileItemById(position, corpseid).uid
if corpse <= 1 then return end
if not isContainer(corpse) then return true end
for slot = 0, (getContainerSize(corpse)-1) do
local item = getContainerItem(corpse, slot)
if item.uid <= 1 then return end
if isStone(item.itemid) then
return doSendMagicEffect(getThingPos(cid), effect)
end
end
end
function onKill(cid, target, lastHit)
if not ehMonstro(target) then return true end
local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect)
return true
end
@ricardoberg
Seria possível fazer algo assim, porém com uma mensagem menor. Se conseguir pensar em outra (ex.: "Stone!"), avise que eu altero o código para você.
@Zet0N0Murmurouu
Por acaso seu servidor tem todas as funções utilizadas neste código?
info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino

@ricardoberg
Seria possível fazer algo assim, porém com uma mensagem menor. Se conseguir pensar em outra (ex.: "Stone!"), avise que eu altero o código para você.
@Zet0N0Murmurouu
Por acaso seu servidor tem todas as funções utilizadas neste código?
Sim
Não funcionou absolutamente nada? Você registrou o evento em login.lua? Se sim, use este código e informe o que for imprimido no console:
local effect = 173 --by brun123 --alterado v2.9 \/
local function func(cid, position, corpseid, effect)
print(1)
if not isCreature(cid) then return true end
local corpse = getTileItemById(position, corpseid).uid
if corpse <= 1 then return end
if not isContainer(corpse) then return true end
for slot = 0, (getContainerSize(corpse)-1) do
local item = getContainerItem(corpse, slot)
if item.uid <= 1 then return end
if isStone(item.itemid) then
print(2)
return doSendMagicEffect(position, effect) and doPlayerSendTextMessage(getCreatureMaster(cid), 27, "You found a "..getItemNameById(item.itemid).."!")
end
end
end
function onKill(cid, target, lastHit)
print(0)
if not ehMonstro(target) then return true end
local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
addEvent(func, 5, getCreatureSummons(cid)[1], getThingPos(target), corpse, effect)
return true
end
Editado Junho 12 por zipter98
info
Grupo: Conde
Registrado: 14/04/15
Posts: 956
Reputação: +333
Gênero: Masculino

Agora sei, qual era o problema ¬¬ é q n estava com a tag no creaturescript.xml!
agr terminei de testar e apareceu isto ao dropar a stone:
[12/06/2015 20:59:04] 0 [12/06/2015 20:59:04] 1 [12/06/2015 20:59:04] 2 [12/06/2015 20:59:04] [Error - CreatureScript Interface] [12/06/2015 20:59:04] In a timer event called from: [12/06/2015 20:59:04] data/creaturescripts/scripts/dropStone.lua:onKill [12/06/2015 20:59:04] Description: [12/06/2015 20:59:04] (luaDoPlayerSendTextMessage) Player not found





info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg
Zipter, poderia fazer esse sistema para a base do Kpdo Exaioros ?