Ir para conteúdo

[Encerrado] UsePotionInFightingPokemonCenturionV4.0


Watsson

Posts Recomendados

Queria saber como configurar meu script de potion para poder usar durante a batalha..

[/size]
[size=4]function setStorage(cid, storage, valor)[/size]
[size=4]if isCreature(cid) then[/size]
[size=4]if getPlayerStorageValue(cid, storage) >= 1 then[/size]
[size=4]setPlayerStorageValue(cid, storage, valor)[/size]
[size=4]end[/size]
[size=4]end[/size]
[size=4]end[/size]
[size=4]function doHealOverTime(cid, div, turn, effect)[/size]
[size=4]if not isCreature(cid) then return true end[/size]
[size=4]if turn <= 0 then return true end[/size]
[size=4]if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then return true end[/size]
[size=4]if getPlayerStorageValue(cid, 174) >= 1 then[/size]
[size=4]setPlayerStorageValue(cid, 174, 0)[/size]
[size=4]setPlayerStorageValue(cid, 173, 0)[/size]
[size=4]return true[/size]
[size=4]end[/size]
[size=4]local d = div / 10000[/size]
[size=4]local amount = math.floor(getCreatureMaxHealth(cid) * d)[/size]
[size=4]doCreatureAddHealth(cid, amount)[/size]
[size=4]if math.floor(turn/10) == turn/10 then[/size]
[size=4]doSendMagicEffect(getThingPos(cid), effect)[/size]
[size=4]end[/size]
[size=4]addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)[/size]
[size=4]end[/size]
[size=4]local potions = {[/size]
[size=4][12347] = {effect = 13, div = 30}, --super potion[/size]
[size=4][12348] = {effect = 13, div = 60}, --great potion --edited deixei igual as potions do PXG[/size]
[size=4][12346] = {effect = 12, div = 80}, --ultra potion[/size]
[size=4][12345] = {effect = 14, div = 90}, --hyper potion[/size]
[size=4]}[/size]
[size=4]--[12343] = {effect = 12, div = 100}}[/size]
[size=4]function onUse(cid, item, frompos, item2, topos)[/size]
[size=4]if isPlayer(item2.uid) then[/size]
[size=4]return doPlayerSendCancel(cid, "You can only use potions on pokemons!")[/size]
[size=4]end[/size]
[size=4]if not isCreature(item2.uid) then[/size]
[size=4]return doPlayerSendCancel(cid, "You can only use potions on pokemons!")[/size]
[size=4]end[/size]
[size=4]if not isPlayer(getCreatureMaster(item2.uid)) then[/size]
[size=4]return doPlayerSendCancel(cid, "You cant use potions on wild pokemons.")[/size]
[size=4]end[/size]
[size=4]if getCreatureHealth(item2.uid) == getCreatureMaxHealth(item2.uid) then[/size]
[size=4]return doPlayerSendCancel(cid, "This pokemon is already at full health.")[/size]
[size=4]end[/size]
[size=4]if getPlayerStorageValue(item2.uid, 173) >= 1 then[/size]
[size=4]return doPlayerSendCancel(cid, "This pokemon is already under effects of potions.")[/size]
[size=4]end[/size]
[size=4]if getCreatureMaster(item2.uid) ~= cid then[/size]
[size=4]return doPlayerSendCancel(cid, "You can only use potions on your own Pokemons!")[/size]
[size=4]end[/size]
[size=4]doCreatureSay(cid, ""..getCreatureName(item2.uid)..", take this potion!", TALKTYPE_SAY)[/size]
[size=4]doSendMagicEffect(getThingPos(item2.uid), 172)[/size]
[size=4]setPlayerStorageValue(item2.uid, 173, 1)[/size]
[size=4]doRemoveItem(item.uid, 1)[/size]
[size=4]local sid = item2.uid[/size]
[size=4]local a = potions[item.itemid][/size]
[size=4]doHealOverTime(item2.uid, a.div, 100, effect)[/size]
[size=4]addEvent(setStorage, 10000, sid, 173, 0)[/size]
[size=4]return true[/size]
[size=4]end[/size]
[size=4]
Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

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