Ir para conteúdo
  • Cadastre-se

(Resolvido)[BUG] Script de Healar o Boss


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Seguinte pessoal,

Tenho um script que heala o boss Gaz'Haragoth no 8.60 - 0.4 

Porem ele tem um problema, quando algum player ou qualquer outro bicho chegar a life que ta configurado no script. O script funciona, o certo seria APENAS PARA O MONSTRO Gaz'Haragoth.

Então queria que ele apenas funcionasse apenas para o MONSTRO Gaz'Haragoth. E não para players e para outros monstros.

Aqui está o script em creaturescripts.

Spoiler

local config = {
    life_ative = 500000,
    life_add = 300000,
    seconds_ative = 20,
    gStorage = 90702,
}

function AddHealth(cid)
    setGlobalStorageValue(config.gStorage, 0)
    if not isCreature(cid) then
        return false
    end
    doCreatureAddHealth(cid, config.life_add)
    doCreatureSay(cid, "Gaz'Haragoth HEALS himself!", TALKTYPE_MONSTER)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
end	

function onStatsChange(cid, attacker, type, combat, value)
    if (getGlobalStorageValue(config.gStorage) < 1 and type == STATSCHANGE_HEALTHLOSS and getCreatureHealth(cid) < config.life_ative) then
        doCreatureSay(cid, "Gaz'Haragoth beginns to draw on the miniums to HEAL himself!", TALKTYPE_MONSTER)
        addEvent(AddHealth, config.seconds_ative * 1000, cid)
        setGlobalStorageValue(config.gStorage, 1)
    end
   return true
end

 

E no meu creaturescript.xml está assim.

Citar

<event type="statschange" name="HealGaz" event="script" value="HealGaz.lua"/>

 

Editado por DigoleraBlow (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Tenta isso no script

-- <event type="healthchange" name="HealGaz" script="heal_gaz.lua"/>

local config = {
    life_ative = 500000,
    life_add = 300000,
    seconds_ative = 20,
    gStorage = 90702,
}

function AddHealth(cid)
    setGlobalStorageValue(config.gStorage, 0)
    if not isCreature(cid) then
        return false
    end
    doCreatureAddHealth(cid, config.life_add)
    doCreatureSay(cid, "Gaz'Haragoth HEALS himself!", TALKTYPE_MONSTER)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
end	

function onStatsChange(cid, attacker, type, combat, value)
    if (getGlobalStorageValue(config.gStorage) < 1 and type == STATSCHANGE_HEALTHLOSS and getCreatureHealth(cid) < config.life_ative) then
        doCreatureSay(cid, "Gaz'Haragoth beginns to draw on the miniums to HEAL himself!", TALKTYPE_MONSTER)
        addEvent(AddHealth, config.seconds_ative * 1000, cid)
        setGlobalStorageValue(config.gStorage, 1)
    end
   return true
end

 

e no creaturescript coloque isso

<event type="healthchange" name="HealGaz" script="HealGaz.lua"/>

 

Link para o post
Compartilhar em outros sites
  • Solução
local config = {
    life_ative = 500000,
    life_add = 300000,
    seconds_ative = 20,
    gStorage = 90702,
    monster = "Gaz'Haragoth" -- nome do monstro
}
function AddHealth(cid)
    setGlobalStorageValue(config.gStorage, 0)
    if not isCreature(cid) then
        return false
    end
    doCreatureAddHealth(cid, config.life_add)
    doCreatureSay(cid, "Gaz'Haragoth HEALS himself!", TALKTYPE_MONSTER)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
end	
function onStatsChange(cid, attacker, type, combat, value)
    if (getGlobalStorageValue(config.gStorage) < 1 and type == STATSCHANGE_HEALTHLOSS and getCreatureName(cid) == config.monster and getCreatureHealth(cid) < config.life_ative) then
        doCreatureSay(cid, "Gaz'Haragoth beginns to draw on the miniums to HEAL himself!", TALKTYPE_MONSTER)
        addEvent(AddHealth, config.seconds_ative * 1000, cid)
        setGlobalStorageValue(config.gStorage, 1)
    end
   return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo