DU
erro

Death System(ceifeiro) não funciona.

Por duasrodas, 17 de abr. de 2015 em Scripts

otserv
tibia
script
9
1.3k
duasrodasD
17 de abril de 2015 às 19:42

Galera estou tentando usar o script Death System(http://www.xtibia.com/forum/topic/230114-death-systemonde-o-ceifeiro-vem-pega-sua-almaoms/)

Mas não esta funcionando,ja me matei dezenas de vezes,ja chequei se esta tudo instalado corretamente,simplesmente não funciona e não da erros no console,no tópico do script não tem ninguem reclamando ou algo assim,pelo jeito pessoal elogiou mas não testou como de costume.

 

Alguem pode me ajudar,a fazer ele funcionar? Meu servidor é 8.6 (0.4)

Sou grato.

 

creaturescript (Deathsystem.lua):

function onDeath(cid, corpse, killer)
 
local pos = getCreaturePosition(cid)
local monster = 'ceifeiro'
local timer = 3 -- quanto tempo vai demorar pra sumir
 
   function removeMonster()
     for _, pid in ipairs(getCreatureSummons(killer[1])) do
       doRemoveCreature(pid)
     end
   return true
   end
 
if isPlayer(cid) and isPlayer(killer[1]) then
   doConvinceCreature(killer[1], doCreateMonster(monster, pos))
   doSendAnimatedText(getThingPos(cid), "DEATH!", 125)
   doSendMagicEffect(getThingPos(cid), 65)
   addEvent(removeMonster, timer*1000)
end
 
return true
end

tag registsrda do login.lua:

registerCreatureEvent(cid, "DeathSystem")

tag do creature.xml

<event type="death" name="DeathSystem" event="script" value="DeathSystem.lua"/>

monstro ceifeiro.xml

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ceifeiro" nameDescription="a ceifeiro" race="blood" experience="0" speed="0" manacost="220">
<health now="9999999999999" max="9999999999999"/>
<look type="300" corpse="5971"/>
<targetchange interval="2000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag skull="5"/>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="0"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="1"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="8"/>
</flags>
<defenses armor="1" defense="2"/>
<immunities>
<immunity physical="0"/>
<immunity energy="0"/>
<immunity fire="0"/>
<immunity poison="0"/>
<immunity lifedrain="0"/>
<immunity paralyze="0"/>
<immunity outfit="0"/>
<immunity drunk="0"/>
<immunity invisible="0"/>
</immunities>
<voices interval="2000" chance="100">
<voice sentence="HAHAHAHA"/>
</voices>
</monster>

O monstro esta normal,consigo sumonar ele normalmente com o God,o problema é que quando eu morro ele não aparece conforme é descriot no script,é como se o script não existisse.

Editado Abril 17 por duasrodas

zipter98Z
17 de abril de 2015 às 21:20

Hm, tenta assim:

local config = {
    time = 3,                 --Tempo para sumir, em segundos.
    monster = "ceifeiro",     --Nome do monstro.
}
function onPrepareDeath(cid, deathList)
    local killer = deathList[1]
    if isPlayer(killer) then
        doConvinceCreature(killer, doCreateMonster(config.monster, getThingPos(cid)))
        doSendAnimatedText(getThingPos(cid), "DEATH!", 125)
        doSendMagicEffect(getThingPos(cid), 65)
        addEvent(function()
            if isPlayer(killer) then
                for _, summon in pairs(getCreatureSummons(killer)) do
                    if getCreatureName(summon):lower() == config.monster:lower() then
                        doRemoveCreature(summon)
                        break
                    end
                end
            end
        end, config.time * 1000)
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "deathSystem")
    return true
end
Tags:
<event type="preparedeath" name="deathSystem" event="script" value="nome_do_arquivo.lua"/>
<event type="login" name="deathLogin" event="script" value="nome_do_arquivo.lua"/>
Não registre nada no login.lua.

Editado Abril 17 por zipter98

duasrodasD
17 de abril de 2015 às 22:01

 

Hm, tenta assim:

local config = {
    time = 3,                 --Tempo para sumir, em segundos.
    monster = "ceifeiro",     --Nome do monstro.
}
function onPrepareDeath(cid, deathList)
    local killer = deathList[1]
    if isPlayer(killer) then
        doConvinceCreature(killer, doCreateMonster(config.monster, getThingPos(cid)))
        doSendAnimatedText(getThingPos(cid), "DEATH!", 125)
        doSendMagicEffect(getThingPos(cid), 65)
        addEvent(function()
            if isPlayer(killer) then
                for _, summon in pairs(getCreatureSummons(killer)) do
                    if getCreatureName(summon):lower() == config.monster:lower() then
                        doRemoveCreature(summon)
                        break
                    end
                end
            end
        end, config.time * 1000)
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "deathSystem")
    return true
end
Tags:
<event type="preparedeath" name="deathSystem" event="script" value="nome_do_arquivo.lua"/>
<event type="login" name="deathLogin" event="script" value="nome_do_arquivo.lua"/>
Não registre nada no login.lua.

 

Mesma coisa,nenhum erro em console,morro e não acontece simplesmente nada,fiz conformo você disse,sad.png

zipter98Z
17 de abril de 2015 às 22:16

Ué. Tenta agora assim:

local config = {
    time = 3,                 --Tempo para sumir, em segundos.
    monster = "ceifeiro",     --Nome do monstro.
}
function onStatsChange(cid, attacker, type, combat, value)
    if value >= getCreatureHealth(cid) and isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS then
        doConvinceCreature(attacker, doCreateMonster(config.monster, getThingPos(cid)))
        doSendAnimatedText(getThingPos(cid), "DEATH!", 125)
        doSendMagicEffect(getThingPos(attacker), 65)
        addEvent(function()
            if isPlayer(attacker) then
                for _, summon in pairs(getCreatureSummons(attacker)) do
                    if getCreatureName(summon):lower() == config.monster:lower() then
                        doRemoveCreature(summon)
                        break
                    end
                end
            end
        end, config.time * 1000)
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "deathSystem")
    return true
end
Tags:
<event type="statschange" name="deathSystem" event="script" value="nome_do_arquivo.lua"/>
<event type="login" name="deathLogin" event="script" value="nome_do_arquivo.lua"/>

Editado Abril 17 por zipter98

duasrodasD
17 de abril de 2015 às 22:25

 

Ué. Tenta agora assim:

local config = {
    time = 3,                 --Tempo para sumir, em segundos.
    monster = "ceifeiro",     --Nome do monstro.
}
function onStatsChange(cid, attacker, type, combat, value)
    if value >= getCreatureHealth(cid) and isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS then
        doConvinceCreature(attacker, doCreateMonster(config.monster, getThingPos(cid)))
        doSendAnimatedText(getThingPos(cid), "DEATH!", 125)
        doSendMagicEffect(getThingPos(attacker), 65)
        addEvent(function()
            if isPlayer(attacker) then
                for _, summon in pairs(getCreatureSummons(attacker)) do
                    if getCreatureName(summon):lower() == config.monster:lower() then
                        doRemoveCreature(summon)
                        break
                    end
                end
            end
        end, config.time * 1000)
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "deathSystem")
    return true
end
Tags:
<event type="statschange" name="deathSystem" event="script" value="nome_do_arquivo.lua"/>
<event type="login" name="deathLogin" event="script" value="nome_do_arquivo.lua"/>

 

Mesma coisa....

Essa função ta certa?" for _, summon in pairs(getCreatureSummons(attacker))

Nunca vi esse tipo de code nos script "for _,"

zipter98Z
17 de abril de 2015 às 22:31

Sim, está certo.

Você por acaso está morrendo para um monstro ou para um player?

duasrodasD
17 de abril de 2015 às 22:51

Sim, está certo.

Você por acaso está morrendo para um monstro ou para um player?

Monstro,eu coloquei prints pelo script para ver e deu esses erros no logue

[22:48:41.562] Human has logged in.
login
time
time
[22:48:55.984] Human has logged out.
[22:48:57.093] Human has logged in.
login
time
time

script com as prints:

local config = {
    time = 3,                 --Tempo para sumir, em segundos.
    monster = "ceifeiro",     --Nome do monstro.
}
function onStatsChange(cid, attacker, type, combat, value)
    if value >= getCreatureHealth(cid) and isPlayer(cid) and isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS then
    print("value")
        doConvinceCreature(attacker, doCreateMonster(config.monster, getThingPos(cid)))
        doSendAnimatedText(getThingPos(cid), "DEATH!", 125)
        doSendMagicEffect(getThingPos(attacker), 65)
        addEvent(function()
            if isPlayer(attacker) then
            print("attacker")
                for _, summon in pairs(getCreatureSummons(attacker)) do
                    if getCreatureName(summon):lower() == config.monster:lower() then
                    print("summon")
                        doRemoveCreature(summon)
                        break
                    end
                end
            end
        end, config.time * 1000)  
    end
    print("time")
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "deathSystem")
    print("login")
    return true
end

Esse log de time,acontece quando eu passo em cima d eum piso que fica healando,toda vez que heala da o log time no console.

zipter98Z
17 de abril de 2015 às 23:27
Melhor resposta

Ah, isso explica. O script só vai funcionar se tanto quem morreu quanto quem matou forem players. Isso acontece pois o monstro Ceifeiro é invocado como summon do assassino.

Editado Abril 17 por zipter98

duasrodasD
18 de abril de 2015 às 01:02

Ah, isso explica. O script só vai funcionar se tanto quem morreu quanto quem matou forem players. Isso acontece pois o monstro Ceifeiro é invocado como summon do assassino.

Tem possibilidade para deixar em ambos?

 

Trocar a função

if isPlayer(cid) and isPlayer(killer[1]) then

por

if isPlayer(cid) and isCreature(killer[1]) then

?

 

 

Deu certo,obrigado pela disposição em ajudar,reputei você!

Editado Abril 18 por duasrodas