Ir para conteúdo

Posts Recomendados

local effect = 169                                   --by brun123    --alterado v1.9 \/
local arrow = {effect, duration}                     --Respectivamente, efeito e duração (segundos).
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 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

Zipter, poderia fazer esse sistema para a base do Kpdo Exaioros ?

Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655504
Compartilhar em outros sites

[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>

Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655572
Compartilhar em outros sites

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
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655585
Compartilhar em outros sites

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 por zipter98
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655604
Compartilhar em outros sites

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

Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655610
Compartilhar em outros sites

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
Tag:
<event type="kill" name="dropStone" script="nome_do_arquivo.lua"/>
Não se esqueça de registrar o evento em login.lua.
Editado por zipter98
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655614
Compartilhar em outros sites

 

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
Tag:
<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 por ricardoberg
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655616
Compartilhar em outros sites

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
end
Tag:
<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

Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655620
Compartilhar em outros sites

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
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655626
Compartilhar em outros sites

@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?

Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655657
Compartilhar em outros sites

@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

Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655668
Compartilhar em outros sites

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 por zipter98
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655674
Compartilhar em outros sites

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
Link para o comentário
https://xtibia.com/forum/topic/234635-efeito-drop-stone/page/2/#findComment-1655677
Compartilhar em outros sites

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