Ir para conteúdo

(Resolvido)[Resolvido] [Pedido] Sistema de potion que heala na hora.

Featured Replies

Postado

Olá Boa tarde.

A pedido dos meus players, eu queria um sistema de Potion que enchesse o HP do Pokemon na hora. Rep+

Se for preciso, aqui está o meu potion.lua

function doHealOverTime(cid, div, turn, effect) --alterado v2.6 peguem o script todo!!

if not isCreature(cid) then return true end

if turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then

setPlayerStorageValue(cid, 173, -1)

return true

end

local d = div / 10000

local amount = math.floor(getCreatureMaxHealth(cid) * d)

doCreatureAddHealth(cid, amount)

if math.floor(turn/10) == turn/10 then

doSendMagicEffect(getThingPos(cid), effect)

end

addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)

end

local potions = {

[12347] = {effect = 13, div = 30}, --Potion

[12348] = {effect = 13, div = 60}, --Super potion

[12346] = {effect = 12, div = 70}, --Hyper potion

[12345] = {effect = 14, div = 90}, --Max potion

}

function onUse(cid, item, frompos, item2, topos)

local pid = getThingFromPosWithProtect(topos)

if not isCreature(pid) or not isSummon(pid) then

return doPlayerSendCancel(cid, "Voce so pode usar potion em Pokemon's!")

end

if getCreatureMaster(pid) ~= cid then

return doPlayerSendCancel(cid, "Voce so pode usar potion em seus Pokemon's!")

end

if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then

return doPlayerSendCancel(cid, "Este Pokemon esta totalmente curado.")

end

if getPlayerStorageValue(pid, 173) >= 1 then

return doPlayerSendCancel(cid, "Este Pokemon ainda esta sendo curado.")

end

if getPlayerStorageValue(cid, 52481) >= 1 then

return doPlayerSendCancel(cid, "Voce nao pode usar isto em duelo.")

end

doCreatureSay(cid, ""..getCreatureName(pid)..", Venha ca, irei passar um potion em voce!", TALKTYPE_SAY)

doSendMagicEffect(getThingPos(pid), 172)

setPlayerStorageValue(pid, 173, 1)

doRemoveItem(item.uid, 1)

local a = potions[item.itemid]

doHealOverTime(pid, a.div, 100, a.effect)

return true

end

Editado por eliaspalermo (veja o histórico de edições)

Resolvido por zipter98

Ir para solução
  • Respostas 7
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Ou, se preferir: function onUse(cid, item, fromPosition, itemEx, toPosition)     if not isCreature(itemEx.uid) or not isSummon(itemEx.uid) then         return doPlayerSendCancel(cid, "Voce so pode

  • local potions = {     --[potion_id] = percent,           [12347] = 30,     [12348] = 60, } function onUse(cid, item, fromPosition, itemEx, toPosition)     if not isCreature(itemEx.uid) or not isSummon

Postado

Bom, todos esses potion?

Só configurar aqui:

local potions = {
[12347] = {effect = 13, div = 30}, --Potion
[12348] = {effect = 13, div = 60}, --Super potion
[12346] = {effect = 12, div = 70}, --Hyper potion
[12345] = {effect = 14, div = 90}, --Max potion
}

Configure a seu gosto.

 

div = 30.

Editado por Deadpool (veja o histórico de edições)

Se te ajudei, deixe seu curti, clique em melhor resposta, para que eu possa ajudar sempre.

 

skype.png

Trabalhos (C++):

Cor das mensagens nos channels

Ajusta/Mudar cor das mensagens de Loot

Liberação dos novos Remakes da PokeXGames.

NPC "Guild Master" que cria, deleta, invita, kicka players da guild.

 

 B4OBUkH.png At Soon, LIKE ON FACEBOOK. Clik on Imgs

Postado

Bom, todos esses potion?

Só configurar aqui:

local potions = {
[12347] = {effect = 13, div = 30}, --Potion
[12348] = {effect = 13, div = 60}, --Super potion
[12346] = {effect = 12, div = 70}, --Hyper potion
[12345] = {effect = 14, div = 90}, --Max potion
}

Configure a seu gosto.

 

div = 30.

é que ele quer q heale 100% da vida do pokemon independentemente da quantidade

Meus Contatos!

 

Minhas Funções:

 

               Skype: TsplayerT

         Facebook: TakaFukushii

          YouTube: ADoseDupla

           Twitter: @_Splayer_

 

 

 

 

 

 

 

                             Mapper:▓▓▓▓▓▓▓▓▓▓ 97%

     Programmer:▓▓▓▓▓▒▒▒▒▒ 45%

             Scripter:▓▓▓▓▓▓▓▓▓▒ 83%

              Spriter:▓▓▓▓▓▓▒▒▒▒ 57%

    Gamemaster:▓▓▓▓▓▓▓▓▓▓ 99%

        Ot Creator:▓▓▓▓▓▓▓▒▒▒71%

Ot Client Maker:▓▓▓▓▓▓▓▒▒▒74%

 

Postado

Na sua pasta mods, adicione um arquivo chamado potion.xml e coloque isso dentro

<?xml version="1.0" encoding="UTF-8"?>
<mod name="FullImediatlyHealPotion" version="1.0" author="desconhecido" enabled="yes">
	<action itemid="0000" event="script" allowfaruse="1" blockwalls="1"><![CDATA[
		function doHealOverTime(cid, div, turn, effect)                     --alterado v1.6 peguem o script todo!!
			if not isCreature(cid) then return true end

			if turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then 
			   setPlayerStorageValue(cid, 173, -1)
			   return true 
			end

			local d = div / 10000
			local amount = math.floor(getCreatureMaxHealth(cid) * d)
			doCreatureAddHealth(cid, amount)
			if math.floor(turn/10) == turn/10 then
			   doSendMagicEffect(getThingPos(cid), effect)
			end
			end

			function onUse(cid, item, frompos, item2, topos)
			local pid = getThingFromPosWithProtect(topos)

			if not isSummon(pid) or getCreatureMaster(pid) ~= cid then
			return doPlayerSendCancel(cid, "You can only use potions on your own Pokemons!")
			end

			if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then
			return doPlayerSendCancel(cid, "This pokemon is already at full health.")
			end

			if getPlayerStorageValue(pid, 173) >= 1 then
			return doPlayerSendCancel(cid, "This pokemon is already under effects of potions.")
			end

			if getPlayerStorageValue(cid, 52481) >= 1 then
			return doPlayerSendCancel(cid, "You can't do that while a duel.")
			end

			if getPlayerStorageValue(cid, 990) >= 1 then
			   doPlayerSendCancel(cid, "You can't use rpotion during gym battles.")
			   return true
			end

			doCreatureSay(cid, "".. getCreatureName(pid)..", take this potion!", TALKTYPE_SAY)
			doSendMagicEffect(getThingPos(pid), 0)
			setPlayerStorageValue(pid, 173, 1)
			doRemoveItem(item.uid, 1)

			doCreatureAddHealth(pid,getCreatureMaxHealth(pid) - getCreatureHealth(pid))

			return true
		end
	]]></action>
</mod>

Edite o ItemID nessa parte

<action itemid="0000" event="script" allowfaruse="1" blockwalls="1">

Oque eu editei?

 

troquei isso

doHealOverTime(pid, a.div, 100, a.effect) 

por isso

doCreatureAddHealth(pid,getCreatureMaxHealth(pid) - getCreatureHealth(pid))

removi a variável potions e essa linha

addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)

Editado por david0703 (veja o histórico de edições)

Atenciosamente, David Araujo

Meu Conteúdo

 

Fui útil? Gostou? 
Faça uma doação.

 
 
 

"É errando que se erra."

"Gambiarras resolvem instantemente, porém podem complicar em problemas futuros."

"Cada dia vivido é um aprendizado."

Postado

Ou, se preferir:

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isCreature(itemEx.uid) or not isSummon(itemEx.uid) then
        return doPlayerSendCancel(cid, "Voce so pode usar potion em Pokemon's!")
    elseif getCreatureMaster(itemEx.uid) ~= cid then
        return doPlayerSendCancel(cid, "Voce so pode usar potion em seus Pokemon's!")
    elseif getCreatureHealth(itemEx.uid) == getCreatureMaxHealth(itemEx.uid) then
        return doPlayerSendCancel(cid, "Este Pokemon esta totalmente curado.")
    elseif getPlayerStorageValue(cid, 52481) >= 1 then
        return doPlayerSendCancel(cid, "Voce nao pode usar isto em duelo.")
    end
    doPlayerSendTextMessage(cid, 27, "Your pokemon was healed.")
    doSendMagicEffect(getThingPos(itemEx.uid), 172)
    doSendAnimatedText(getThingPos(itemEx.uid), "+"..getCreatureMaxHealth(itemEx.uid) - getCreatureHealth(itemEx.uid), math.random(1, 255))
    doCreatureAddHealth(itemEx.uid, getCreatureMaxHealth(itemEx.uid) - getCreatureHealth(itemEx.uid))
    doRemoveItem(item.uid, 1)
    return true
end

não respondo pms solicitando suporte em programação/scripting

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo