i need to modify this script to heal all pokemons from pokebag, not from pokeball slot:
Lua:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Do zobaczenia.')
focus = 0
talk_start = 0
end
end
function getPokemonMaxLife(name)
local file = io.open('data/monster/monsters.xml','r')
local arquivo = file:read(-1):lower():match('<monster name="'..name:lower()..'" file="(.-)"/>')
file:close()
local data = io.open('data/monster/'..(arquivo or ''),'r')
if not data then
return 100
end
local maximo = data:read(-1):match('max%s*=%s*"(%d+)"')
data:close()
return maximo
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi')) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid, 25000) == 5 then
return selfSay('Zejdz z pokemona.')
end
if getPlayerStorageValue(cid, 23000) == 5 then
return selfSay('Zejdz z pokemona.')
end
if #getCreatureSummons(cid) >= 1 then
selfSay('Musisz schowac swojego pokemona do pokeballa.')
focus = 0
talk_start = 0
return TRUE
end
local idballs = {
[2532] = {2531},
[2653] = {2557},
[2654] = {2525},
[2652] = {2524},
[2195] = {2523},
[2531] = {2532},
[2557] = {2653},
[2525] = {2654},
[2524] = {2652},
[2523] = {2195},
}
local balls = idballs[getPlayerSlotItem(cid,8).itemid]
if balls == nil then
return selfSay('Umiesc pokemona w gniezdzie do tego przeznaczonym aby go uleczyc!!')
end
local nome = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name")
local poke_name1 = nome:match('(.-) Pokeball')
local poke_name2 = nome:match('(.-) Superball')
local poke_name3 = nome:match('(.-) Ultraball')
local poke_name4 = nome:match('(.-) Greatball')
local poke_name5 = nome:match('(.-) Masterball')
if poke_name1 == nil and poke_name2 == nil and poke_name3 == nil and poke_name4 == nil and poke_name5 == nil then
return doPlayerSendCancel(cid,"coloque no lugar correto")
end
if poke_name1 ~= nil then
poke_name = poke_name1
elseif poke_name2 ~= nil then
poke_name = poke_name2
elseif poke_name3 ~= nil then
poke_name = poke_name3
elseif poke_name4 ~= nil then
poke_name = poke_name4
elseif poke_name5 ~= nil then
poke_name = poke_name5
end
doItemSetAttribute(getPlayerSlotItem(cid,8).uid, "aid", getPokemonMaxLife(poke_name))
selfSay("Twoj pokemon zostal uleczony!!")
doTransformItem(getPlayerSlotItem(cid, 8).uid, balls[1])
local hp = getCreatureMaxHealth(cid)
doCreatureAddHealth(cid, hp)
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end