Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Em action.xml:


<action uniqueid="1334" script="NOME_SCRIPT.lua"/>

em action/script:

function onUse(cid, item, fromPosition, itemEx, toPosition)

local pos = getCreaturePosition(cid)

local storage = 9977 -- storage, se mudou aki mude no creaturescripts

local health = 10 -- vida que vai healar por segundo

local Und = 1334 -- unique id do item (adicione o uniqueid no map)

local delay = 1 -- delay por heal (segundos)

local effect = 12 -- efeito (nao precisa mecher)


function foder()

if getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == 1 then

doPlayerSendTextMessage(cid,4,"Seu hp esta cheio.")

doPlayerSetStorageValue(cid,storage,-1)

doCreatureSetNoMove(cid,false)

elseif getCreatureHealth(cid) < getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == 1 then

doCreatureSetNoMove(cid,true)

addEvent(doCreatureAddHealth,delay*1000,cid,health)

addEvent(doSendMagicEffect,delay*1000,pos,12)

addEvent(foder,1000)

end

end


if getPlayerStorageValue(cid,storage) == 1 then

doPlayerSendTextMessage(cid,4,"Voce esta sendo healado, espere.")


elseif item.uid == Und and getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == -1 then

doPlayerSendTextMessage(cid,4,"Seu hp esta full.")


elseif item.uid == Und and getCreatureHealth(cid) < getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == -1 then

doPlayerSendTextMessage(cid,4,"Heal.")

doPlayerSetStorageValue(cid,storage,1)

addEvent(foder,100)

end

return TRUE

end


Agora para não bugar, em creaturescript/scripts:

function onLogout(cid)

local storage = 9977

        if getPlayerStorageValue(cid,storage) == 1 then

        doPlayerSetStorageValue(cid,storage,-1)

        doCreatureSetNoMove(cid,false)

        end

        return TRUE

end



Agora em creaturescript/creaturescript.xml:

<event type="logout" name="Healing" event="script" value="NOME_SCRIPT.lua"/>

Bem, axo que não vai ter bugs..

Não esqueça de adicionar o UniqueID 1334 no mapa, no tile que você quer que heale.

Link para o post
Compartilhar em outros sites
  • Respostas 13
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

\data\movements\scripts\healing.lua

local config = {

health = 10,

delay = 5,

storage = 2454

}


function onStepIn(cid, item, position, fromPosition)

setPlayerStorageValue(cid, config.storage, -1)

Heal(cid)

return TRUE

end


function onStepOut(cid, item, position, fromPosition)

setPlayerStorageValue(cid, config.storage, 1)

return TRUE

end


function Heal(cid)

if getPlayerStorageValue(cid, config.storage) == -1 then

  doCreatureAddHealth(cid, config.health)

  doSendAnimatedText(getCreaturePosition(cid), "+ "..config.health.."", 30)

  addEvent(Heal, config.delay*1000, cid)

end

return TRUE

end
\data\movements\movements.xml
<movevent type="StepIn" actionid="ACTION_ID" event="script" value="healing.lua"/>

<movevent type="StepOut" actionid="ACTION_ID" event="script" value="healing.lua"/>

OBS: Você deve adicionar uma actionId no tile que você quer que carregue, pelo map editor e ai substituir esse numero no ACTION_ID.

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

heal = 10,

pos = {

{x = 186, y = 56, z = 7},

{x = 186, y = 57, z = 7},

{x = 187, y = 56, z = 7},

{x = 187, y = 57, z = 7}

}

}

function onThink(cid, interval, lastExecution)

     for _, k in ipairs(t.pos) do

        doSendMagicEffect(k, 56)

        local x = getTopCreature(k).uid

        if x > 0 and isPlayer(x) then

        doSendAnimatedText(getCreaturePosition(x), "+"..t.heal, 30)

        doCreatureAddHealth(x, t.heal)

        end

        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

\data\movements\scripts\healing.lua

local config = {

health = 10,

delay = 5,

storage = 2454

}


function onStepIn(cid, item, position, fromPosition)

setPlayerStorageValue(cid, config.storage, -1)

Heal(cid)

return TRUE

end


function onStepOut(cid, item, position, fromPosition)

setPlayerStorageValue(cid, config.storage, 1)

return TRUE

end


function Heal(cid)

if getPlayerStorageValue(cid, config.storage) == -1 then

  doCreatureAddHealth(cid, config.health)

  doSendAnimatedText(getCreaturePosition(cid), "+ "..config.health.."", 30)

  addEvent(Heal, config.delay*1000, cid)

end

return TRUE

end
\data\movements\movements.xml
<movevent type="StepIn" actionid="ACTION_ID" event="script" value="healing.lua"/>

<movevent type="StepOut" actionid="ACTION_ID" event="script" value="healing.lua"/>

OBS: Você deve adicionar uma actionId no tile que você quer que carregue, pelo map editor e ai substituir esse numero no ACTION_ID.

Mano deu certo so que eu saio dos Treiner ele continua Healando nao para Nunka, se Puder arrumar isso para min agradeço

Como Criar Um Trainer Room!

tk-melhor.png

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96843
    Tópicos
    519604
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo