Eu gostaria que não fosse possivel o player usar as potions/revive em area PZ.
Script das potions:
Spoiler
function doHealOverTime(cid, div, turn, effect)
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
if useOTClient then
onPokeHealthChange(getCreatureMaster(cid)) --alterei aki
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
end
local potions = {
[12347] = {effect = 13, div = 30}, --super potion
[12348] = {effect = 13, div = 60}, --great potion
[12346] = {effect = 12, div = 80}, --ultra potion
[12345] = {effect = 14, div = 90}, --hyper potion
}
function onUse(cid, item, frompos, item2, topos)
local pid = getThingFromPosWithProtect(topos)
if not isCreature(pid) or not isSummon(pid) then
return doPlayerSendCancel(cid, "You can only use potions on pokemons!")
end
if 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
doCreatureSay(cid, ""..getCreatureName(pid)..", take this potion!", 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
Script revive, aqui eu gostaria que nao resetasse o cooldawn também se possivel :c
Spoiler
local storage = 121212 --storage da quest
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid, storage) == 0 then
doPlayerSendCancel(cid, "You already have used the limit of revives for this quest.")
return true
elseif getPlayerStorageValue(cid, 990) >= 1 then
doPlayerSendCancel(cid, "You can't use revive during gym battles.")
return true
elseif getPlayerStorageValue(cid, 52481) >= 1 then
doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
return true
elseif isPlayer(item2.uid) then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
for a, b in pairs (pokeballs) do
if not item2.itemid == b.on or not item2.itemid == b.off then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
end
local pokeball = getPlayerSlotItem(cid, 8)
for a, b in pairs (pokeballs) do
if item2.itemid == b.on or item2.itemid == b.off then
doTransformItem(item2.uid, b.on)
doSetItemAttribute(item2.uid, "hp", 1)
for c = 1, 15 do
local str = "move"..c
setCD(item2.uid, str, 0)
end
setCD(item2.uid, "control", 0)
setCD(item2.uid, "blink", 0) --alterado v1.6
doSendMagicEffect(getThingPos(cid), 13)
doRemoveItem(item.uid, 1)
doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
doCureStatus(cid, "all", true)
cleanBuffs2(item2.uid) --alterado v1.5
if useOTClient then
onPokeHealthChange(cid)
end
if getPlayerStorageValue(cid, storage) > 0 then
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
end
return true
end
end
return true
end
Pergunta
M i s s 9
Oi, alguém pode me ajudar com isso?
Eu gostaria que não fosse possivel o player usar as potions/revive em area PZ.
Script das potions:
function doHealOverTime(cid, div, turn, effect)
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
if useOTClient then
onPokeHealthChange(getCreatureMaster(cid)) --alterei aki
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
end
local potions = {
[12347] = {effect = 13, div = 30}, --super potion
[12348] = {effect = 13, div = 60}, --great potion
[12346] = {effect = 12, div = 80}, --ultra potion
[12345] = {effect = 14, div = 90}, --hyper potion
}
function onUse(cid, item, frompos, item2, topos)
local pid = getThingFromPosWithProtect(topos)
if not isCreature(pid) or not isSummon(pid) then
return doPlayerSendCancel(cid, "You can only use potions on pokemons!")
end
if 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
doCreatureSay(cid, ""..getCreatureName(pid)..", take this potion!", 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
Script revive, aqui eu gostaria que nao resetasse o cooldawn também se possivel :c
local storage = 121212 --storage da quest
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid, storage) == 0 then
doPlayerSendCancel(cid, "You already have used the limit of revives for this quest.")
return true
elseif getPlayerStorageValue(cid, 990) >= 1 then
doPlayerSendCancel(cid, "You can't use revive during gym battles.")
return true
elseif getPlayerStorageValue(cid, 52481) >= 1 then
doPlayerSendCancel(cid, "You can't do that while a duel.") --alterado v1.6
return true
elseif isPlayer(item2.uid) then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
for a, b in pairs (pokeballs) do
if not item2.itemid == b.on or not item2.itemid == b.off then
doPlayerSendCancel(cid, "Please, use revive only on pokeballs.")
return true
end
end
local pokeball = getPlayerSlotItem(cid, 8)
for a, b in pairs (pokeballs) do
if item2.itemid == b.on or item2.itemid == b.off then
doTransformItem(item2.uid, b.on)
doSetItemAttribute(item2.uid, "hp", 1)
for c = 1, 15 do
local str = "move"..c
setCD(item2.uid, str, 0)
end
setCD(item2.uid, "control", 0)
setCD(item2.uid, "blink", 0) --alterado v1.6
doSendMagicEffect(getThingPos(cid), 13)
doRemoveItem(item.uid, 1)
doCureBallStatus(getPlayerSlotItem(cid, 8).uid, "all")
doCureStatus(cid, "all", true)
cleanBuffs2(item2.uid) --alterado v1.5
if useOTClient then
onPokeHealthChange(cid)
end
if getPlayerStorageValue(cid, storage) > 0 then
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
end
return true
end
end
return true
end
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados