Ir para conteúdo
  • 0

[Resolvido] System Boost Stone não adicionando 500 hp ao pokémon


xxxttten

Pergunta

TFS Versão 0.3.6 

Bom, a boost stone funciona porém não adiciona vida ao pokémon

Booststone.lua

Spoiler

-- Scrit Por Marshmello
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
local meuovo = {
    qnt = 1,      --quantidade de boost q vai ser adicionada
    maxi = 50,      --maximo de boost 
    chance = 40,  --chance de falhar
    boost_fail = 6,  --- quanditade q ela pode falhar
    falhar = 6,   --- pra onde a boost vai voltar quando falhar
}
 
local minhabola = getPlayerSlotItem(cid, 8).uid
local boost = getItemAttribute(minhabola, "boost") or 0
 
    if minhabola <= 0 then
        return doPlayerSendCancel(cid, "Coloque um pokémon no Main Slot!")
    elseif boost >= meuovo.maxi then
        return doPlayerSendCancel(cid, "Seu pokémon já se encontra no nível máximo de boost!")
    end
    
    if boost >= meuovo.boost_fail  then
        if math.random(1, 100) <= meuovo.chance then
            doItemSetAttribute(minhabola, "boost", (boost + meuovo.qnt))
            doSendMagicEffect(fromPosition, 173)
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"Falhou!")
            doItemSetAttribute(minhabola, "boost", (meuovo.falhar))
            doRemoveItem(item.uid, 1)
        end
    else
        doItemSetAttribute(minhabola, "boost", (boost + meuovo.qnt))
        doSendMagicEffect(fromPosition, 173)
        doRemoveItem(item.uid, 1)
    end
    return true
end

Boost.lua

Spoiler

local ballslot = 12355
local ballslot_run = 12352

local stoneslot = 12354
local stoneslot_run = 12353

local button = 12356
local button_run = 12357

function isRunning(id)
    if isInArray({button_run, stoneslot_run, ballslot_run}, id) then
    return true
    end
return false
end

boost_stones = {                              --alterado v1.9 \/
["Bulbasaur"] = {leaf, boostStone},
["Ivysaur"] = {leaf, boostStone},
["Venusaur"] = {leaf, boostStone},
["Charmander"] = {fire, boostStone},
["Charmeleon"] = {fire, boostStone},
["Charizard"] = {fire, boostStone},
["Squirtle"] = {water, boostStone},
["Wartortle"] = {water, boostStone},
["Blastoise"] = {water, boostStone},
["Caterpie"] = {coccon, boostStone},
["Metapod"] = {coccon, boostStone},
["Butterfree"] = {coccon, boostStone},
["Weedle"] = {coccon, boostStone},
["Kakuna"] = {coccon, boostStone},
["Beedrill"] = {coccon, boostStone},
["Pidgey"] = {heart, boostStone},
["Pidgeotto"] = {heart, boostStone},
["Pidgeot"] = {heart, boostStone},
["Rattata"] = {heart, boostStone},
["Raticate"] = {heart, boostStone},
["Spearow"] = {heart, boostStone},
["Fearow"] = {heart, boostStone},
["Ekans"] = {venom, boostStone},
["Arbok"] = {venom, boostStone},
["Pikachu"] = {thunder, boostStone},
["Raichu"] = {thunder, boostStone},
["Sandshrew"] = {earth, boostStone},
["Sandslash"] = {earth, boostStone},
["Nidoran Female"] = {venom, boostStone},
["Nidorina"] = {venom, boostStone},
["Nidoqueen"] = {venom, earth, boostStone},
["Nidoran Male"] = {venom, boostStone},
["Nidorino"] = {venom, boostStone},
["Nidoking"] = {venom, earth, boostStone},
["Clefairy"] = {heart, boostStone},
["Clefable"] = {heart, boostStone},
["Vulpix"] = {fire, boostStone},
["Ninetales"] = {fire, boostStone},
["Jigglypuff"] = {heart, boostStone},
["Wigglytuff"] = {heart, boostStone},
["Zubat"] = {venom, boostStone},
["Golbat"] = {venom, boostStone},
["Oddish"] = {leaf, venom, boostStone},
["Gloom"] = {leaf, venom, boostStone},
["Vileplume"] = {leaf, venom, boostStone},
["Paras"] = {coccon, leaf, boostStone},
["Parasect"] = {coccon, leaf, boostStone},
["Venonat"] = {coccon, venom, boostStone},
["Venomoth"] = {coccon, venom, boostStone},
["Diglett"] = {earth, boostStone},
["Dugtrio"] = {earth, boostStone},
["Meowth"] = {heart, boostStone},
["Persian"] = {heart, boostStone},
["Psyduck"] = {water, boostStone},
["Golduck"] = {water, enigma, boostStone},
["Mankey"] = {punch, boostStone},
["Primeape"] = {punch, boostStone},
["Growlithe"] = {fire, boostStone},
["Arcanine"] = {fire, boostStone},
["Poliwag"] = {water, boostStone},
["Poliwhirl"] = {water, boostStone},
["Poliwrath"] = {water, punch, boostStone},
["Abra"] = {enigma, boostStone},
["Kadabra"] = {enigma, boostStone},
["Alakazam"] = {enigma, boostStone},
["Machop"] = {punch, boostStone},
["Machoke"] = {punch, boostStone},
["Machamp"] = {punch, boostStone},
["Bellsprout"] = {leaf, venom, boostStone},
["Weepinbell"] = {leaf, venom, boostStone},
["Victreebel"] = {leaf, venom, boostStone},
["Tentacool"] = {water, venom, boostStone},
["Tentacruel"] = {water, venom, boostStone},
["Geodude"] = {earth, rock, boostStone},
["Graveler"] = {earth, rock, boostStone},
["Golem"] = {earth, rock, boostStone},
["Ponyta"] = {fire, boostStone},
["Rapidash"] = {fire, boostStone},
["Slowpoke"] = {water, enigma, boostStone},
["Slowbro"] = {water, enigma, boostStone},
["Magnemite"] = {thunder, metal, boostStone},
["Magneton"] = {thunder, metal, boostStone},
["Farfetch'd"] = {heart, boostStone},
["Doduo"] = {heart, boostStone},
["Dodrio"] = {heart, boostStone},
["Seel"] = {water, ice, boostStone},
["Dewgong"] = {water, ice, boostStone},
["Grimer"] = {venom, boostStone},
["Muk"] = {venom, boostStone},
["Shellder"] = {water, ice, boostStone},
["Cloyster"] = {water, ice, boostStone},
["Gastly"] = {dark, boostStone},
["Haunter"] = {dark, boostStone},
["Gengar"] = {dark, boostStone},
["Onix"] = {rock, earth, boostStone},
["Drowzee"] = {enigma, boostStone},
["Hypno"] = {enigma, boostStone},
["Krabby"] = {water, boostStone},
["Kingler"] = {water, boostStone},
["Voltorb"] = {thunder, boostStone},
["Electrode"] = {thunder, boostStone},
["Exeggcute"] = {enigma, leaf, boostStone},
["Exeggutor"] = {enigma, leaf, boostStone},
["Cubone"] = {earth, boostStone},
["Marowak"] = {earth, boostStone},
["Hitmonlee"] = {punch, boostStone},
["Hitmonchan"] = {punch, boostStone},
["Lickitung"] = {heart, boostStone},
["Koffing"] = {venom, boostStone},
["Weezing"] = {venom, boostStone},
["Rhyhorn"] = {earth, rock, boostStone},
["Rhydon"] = {earth, rock, boostStone},
["Chansey"] = {heart, boostStone},
["Tangela"] = {leaf, boostStone},
["Kangaskhan"] = {heart, boostStone},
["Horsea"] = {water, boostStone},
["Seadra"] = {water, boostStone},
["Goldeen"] = {water, boostStone},
["Seaking"] = {water, boostStone},
["Staryu"] = {water, boostStone},
["Starmie"] = {water, boostStone},
["Mr. Mime"] = {enigma, boostStone},
["Scyther"] = {coccon, boostStone},
["Jynx"] = {enigma, ice, boostStone},
["Electabuzz"] = {thunder, boostStone},
["Magmar"] = {fire, boostStone},
["Pinsir"] = {coccon, boostStone},
["Tauros"] = {heart, boostStone},
["Magikarp"] = {water, boostStone},
["Gyarados"] = {water, crystal, boostStone},
["Lapras"] = {water, ice, boostStone},
["Ditto"] = {heart, boostStone},
["Eevee"] = {heart, boostStone},
["Vaporeon"] = {water, boostStone},
["Jolteon"] = {thunder, boostStone},
["Flareon"] = {fire, boostStone},
["Espeon"] = {enigma, boostStone},
["Umbreon"] = {dark, boostStone},
["Porygon"] = {heart, enigma, boostStone},
["Omanyte"] = {rock, water, boostStone},
["Omastar"] = {rock, water, boostStone},
["Kabuto"] = {rock, water, boostStone},
["Kabutops"] = {rock, water, boostStone},
["Aerodactyl"] = {rock, boostStone},
["Snorlax"] = {heart, boostStone},
["Articuno"] = {ice, boostStone},
["Zapdos"] = {thunder, boostStone},
["Moltres"] = {fire, boostStone},
["Dratini"] = {crystal, boostStone},
["Dragonair"] = {crystal, boostStone},
["Dragonite"] = {crystal, boostStone},
["Mewtwo"] = {enigma, boostStone},
["Mew"] = {enigma, boostStone},
--
["Shiny Bulbasaur"] = {leaf, boostStone},
["Shiny Ivysaur"] = {leaf, boostStone},
["Shiny Venusaur"] = {leaf, boostStone},
["Shiny Charmander"] = {fire, boostStone},
["Shiny Charmeleon"] = {fire, boostStone},
["Shiny Charizard"] = {fire, boostStone},
["Shiny Squirtle"] = {water, boostStone},
["Shiny Wartortle"] = {water, boostStone},
["Shiny Blastoise"] = {water, boostStone},
["Shiny Caterpie"] = {coccon, boostStone},
["Shiny Metapod"] = {coccon, boostStone},
["Shiny Butterfree"] = {coccon, boostStone},
["Shiny Weedle"] = {coccon, boostStone},
["Shiny Kakuna"] = {coccon, boostStone},
["Shiny Beedrill"] = {coccon, boostStone},
["Shiny Pidgey"] = {heart, boostStone},
["Shiny Pidgeotto"] = {heart, boostStone},
["Shiny Pidgeot"] = {heart, boostStone},
["Shiny Rattata"] = {heart, boostStone},
["Shiny Raticate"] = {heart, boostStone},
["Shiny Spearow"] = {heart, boostStone},
["Shiny Fearow"] = {heart, boostStone},
["Shiny Ekans"] = {venom, boostStone},
["Shiny Arbok"] = {venom, boostStone},
["Shiny Pikachu"] = {thunder, boostStone},
["Shiny Raichu"] = {thunder, boostStone},
["Shiny Sandshrew"] = {earth, boostStone},
["Shiny Sandslash"] = {earth, boostStone},
["Shiny Nidoran Female"] = {venom, boostStone},
["Shiny Nidorina"] = {venom, boostStone},
["Shiny Nidoqueen"] = {venom, earth, boostStone},
["Shiny Nidoran Male"] = {venom, boostStone},
["Shiny Nidorino"] = {venom, boostStone},
["Shiny Nidoking"] = {venom, earth, boostStone},
["Shiny Clefairy"] = {heart, boostStone},
["Shiny Clefable"] = {heart, boostStone},
["Shiny Vulpix"] = {fire, boostStone},
["Shiny Ninetales"] = {fire, boostStone},
["Shiny Jigglypuff"] = {heart, boostStone},
["Shiny Wigglytuff"] = {heart, boostStone},
["Shiny Zubat"] = {venom, boostStone},
["Shiny Golbat"] = {venom, boostStone},
["Shiny Oddish"] = {leaf, venom, boostStone},
["Shiny Gloom"] = {leaf, venom, boostStone},
["Shiny Vileplume"] = {leaf, venom, boostStone},
["Shiny Paras"] = {coccon, leaf, boostStone},
["Shiny Parasect"] = {coccon, leaf, boostStone},
["Shiny Venonat"] = {coccon, venom, boostStone},
["Shiny Venomoth"] = {coccon, venom, boostStone},
["Shiny Diglett"] = {earth, boostStone},
["Shiny Dugtrio"] = {earth, boostStone},
["Shiny Meowth"] = {heart, boostStone},
["Shiny Persian"] = {heart, boostStone},
["Shiny Psyduck"] = {water, boostStone},
["Shiny Golduck"] = {water, enigma, boostStone},
["Shiny Mankey"] = {punch, boostStone},
["Shiny Primeape"] = {punch, boostStone},
["Shiny Growlithe"] = {fire, boostStone},
["Shiny Arcanine"] = {fire, boostStone},
["Shiny Poliwag"] = {water, boostStone},
["Shiny Poliwhirl"] = {water, boostStone},
["Shiny Poliwrath"] = {water, punch, boostStone},
["Shiny Abra"] = {enigma, boostStone},
["Shiny Kadabra"] = {enigma, boostStone},
["Shiny Alakazam"] = {enigma, boostStone},
["Shiny Machop"] = {punch, boostStone},
["Shiny Machoke"] = {punch, boostStone},
["Shiny Machamp"] = {punch, boostStone},
["Shiny Bellsprout"] = {leaf, venom, boostStone},
["Shiny Weepinbell"] = {leaf, venom, boostStone},
["Shiny Victreebel"] = {leaf, venom, boostStone},
["Shiny Tentacool"] = {water, venom, boostStone},
["Shiny Tentacruel"] = {water, venom, boostStone},
["Shiny Geodude"] = {earth, rock, boostStone},
["Shiny Graveler"] = {earth, rock, boostStone},
["Shiny Golem"] = {earth, rock, boostStone},
["Shiny Ponyta"] = {fire, boostStone},
["Shiny Rapidash"] = {fire, boostStone},
["Shiny Slowpoke"] = {water, enigma, boostStone},
["Shiny Slowbro"] = {water, enigma, boostStone},
["Shiny Magnemite"] = {thunder, metal, boostStone},
["Shiny Magneton"] = {thunder, metal, boostStone},
["Shiny Farfetch'd"] = {heart, boostStone},
["Shiny Doduo"] = {heart, boostStone},
["Shiny Dodrio"] = {heart, boostStone},
["Shiny Seel"] = {water, ice, boostStone},
["Shiny Dewgong"] = {water, ice, boostStone},
["Shiny Grimer"] = {venom, boostStone},
["Shiny Muk"] = {venom, boostStone},
["Shiny Shellder"] = {water, ice, boostStone},
["Shiny Cloyster"] = {water, ice, boostStone},
["Shiny Gastly"] = {dark, boostStone},
["Shiny Haunter"] = {dark, boostStone},
["Shiny Gengar"] = {dark, boostStone},
["Shiny Onix"] = {rock, earth, boostStone},
["Shiny Drowzee"] = {enigma, boostStone},
["Shiny Hypno"] = {enigma, boostStone},
["Shiny Krabby"] = {water, boostStone},
["Shiny Kingler"] = {water, boostStone},
["Shiny Voltorb"] = {thunder, boostStone},
["Shiny Electrode"] = {thunder, boostStone},
["Shiny Exeggcute"] = {enigma, leaf, boostStone},
["Shiny Exeggutor"] = {enigma, leaf, boostStone},
["Shiny Cubone"] = {earth, boostStone},
["Shiny Marowak"] = {earth, boostStone},
["Shiny Hitmonlee"] = {punch, boostStone},
["Shiny Hitmonchan"] = {punch, boostStone},
["Shiny Hitmontop"] = {punch, boostStone}, --alterado v1.4
["Shiny Lickitung"] = {heart, boostStone},
["Shiny Koffing"] = {venom, boostStone},
["Shiny Weezing"] = {venom, boostStone},
["Shiny Rhyhorn"] = {earth, rock, boostStone},
["Shiny Rhydon"] = {earth, rock, boostStone},
["Shiny Chansey"] = {heart, boostStone},
["Shiny Tangela"] = {leaf, boostStone},
["Shiny Kangaskhan"] = {heart, boostStone},
["Shiny Horsea"] = {water, boostStone},
["Shiny Seadra"] = {water, boostStone},
["Shiny Goldeen"] = {water, boostStone},
["Shiny Seaking"] = {water, boostStone},
["Shiny Staryu"] = {water, boostStone},
["Shiny Starmie"] = {water, boostStone},
["Shiny Mr. Mime"] = {enigma, boostStone},
["Shiny Scyther"] = {coccon, boostStone},
["Shiny Jynx"] = {enigma, ice, boostStone},
["Shiny Electabuzz"] = {thunder, boostStone},
["Shiny Magmar"] = {fire, boostStone},
["Shiny Pinsir"] = {coccon, boostStone},
["Shiny Tauros"] = {heart, boostStone},
["Shiny Magikarp"] = {water, boostStone},
["Shiny Gyarados"] = {water, crystal, boostStone},
["Shiny Lapras"] = {water, ice, boostStone},
["Shiny Ditto"] = {heart, boostStone},
["Shiny Eevee"] = {heart, boostStone},
["Shiny Vaporeon"] = {water, boostStone},
["Shiny Jolteon"] = {thunder, boostStone},
["Shiny Flareon"] = {fire, boostStone},
["Shiny Porygon"] = {heart, enigma, boostStone},
["Shiny Omanyte"] = {rock, water, boostStone},
["Shiny Omastar"] = {rock, water, boostStone},
["Shiny Kabuto"] = {rock, water, boostStone},
["Shiny Kabutops"] = {rock, water, boostStone},
["Shiny Aerodactyl"] = {rock, boostStone},
["Shiny Snorlax"] = {heart, boostStone},
["Shiny Articuno"] = {ice, boostStone},
["Shiny Zapdos"] = {thunder, boostStone},
["Shiny Moltres"] = {fire, boostStone},
["Shiny Dratini"] = {crystal, boostStone},
["Shiny Dragonair"] = {crystal, boostStone},
["Shiny Dragonite"] = {crystal, boostStone},
["Shiny Mewtwo"] = {enigma, boostStone},
["Shiny Mew"] = {enigma, boostStone},
--
["Chikorita"] = {leaf, boostStone},
["Bayleef"] = {leaf, boostStone},
["Meganium"] = {leaf, boostStone},
["Cyndaquil"] = {fire, boostStone},
["Quilava"] = {fire, boostStone},
["Typhlosion"] = {fire, boostStone},
["Totodile"] = {water, boostStone},
["Croconaw"] = {water, boostStone},
["Feraligatr"] = {water, boostStone},
["Sentret"] = {heart, boostStone},
["Furret"] = {heart, boostStone},
["Hoothoot"] = {heart, enigma, boostStone},
["Noctowl"] = {heart, enigma, boostStone},
["Ledyba"] = {coccon, boostStone},
["Ledian"] = {coccon, boostStone},
["Spinarak"] = {coccon, venom, boostStone},
["Ariados"] = {coccon, venom, boostStone},
["Crobat"] = {venom, boostStone},
["Chinchou"] = {water, thunder, boostStone},
["Lanturn"] = {water, thunder, boostStone},
["Pichu"] = {thunder, boostStone},
["Cleffa"] = {heart, boostStone},
["Iglybuff"] = {venom, boostStone},
["Natu"] = {enigma, boostStone},
["Xatu"] = {enigma, boostStone},
["Mareep"] = {thunder, boostStone},
["Flaaffy"] = {thunder, boostStone},
["Ampharos"] = {thunder, boostStone},
["Bellossom"] = {leaf, boostStone},
["Marill"] = {water, boostStone},
["Azulmarill"] = {water, boostStone},
["Sudowoodo"] = {rock, earth, boostStone},
["Politoed"] = {water, earth, boostStone},
["Hoppip"] = {leaf, boostStone},
["Skiploom"] = {leaf, boostStone},
["Jumpluff"] = {leaf, boostStone},
["Aipom"] = {heart, boostStone},
["Sunkern"] = {leaf, boostStone},
["Sunflora"] = {leaf, boostStone},
["Yanma"] = {venom, coccon, boostStone},
["Wooper"] = {water, boostStone},
["Quagsire"] = {water, earth, boostStone},
["Murkrow"] = {dark, boostStone},
["Slowking"] = {water,enigma, boostStone},
["Misdreavus"] = {dark, boostStone},
["Wobbuffet"] = {enigma, boostStone},
["Girafarig"] = {enigma, boostStone},
["Pineco"] = {coccon, boostStone},
["Forretress"] = {coccon, boostStone},
["Gligar"] = {dark, heart, boostStone},
["Steelix"] = {earth, rock, boostStone},
["Snubbull"] = {heart, boostStone},
["Granbull"] = {heart, boostStone},
["Qwilfish"] = {water, boostStone},
["Shuckle"] = {earth, boostStone},
["Heracross"] = {coccon, boostStone},
["Teddiursa"] = {heart, boostStone},
["Ursaring"] = {heart, dark, boostStone},
["Slugma"] = {fire, boostStone},
["Magcargo"] = {fire, boostStone},
["Swinub"] = {ice, earth, boostStone},
["Piloswine"] = {ice, earth, boostStone},
["Corsola"] = {water, boostStone},
["Remoraid"] = {water, boostStone},
["Octillery"] = {water, boostStone},
["Delibird"] = {ice, heart, boostStone},
["Mantine"] = {water, boostStone},
["Skarmory"] = {heart, boostStone},
["Houndour"] = {fire, dark, boostStone},
["Houndoom"] = {fire, dark, boostStone},
["Kingdra"] = {water, crystal, boostStone},
["Phanpy"] = {earth, boostStone},
["Donphan"] = {earth, boostStone},
["porygon2"] = {enigma, boostStone},
["Stantler"] = {heart, boostStone},
["Smeargle"] = {heart, boostStone},
["Tyrogue"] = {punch, boostStone},
["Hitmontop"] = {punch, boostStone},
["Smoochum"] = {ice, enigma, boostStone},
["Elekid"] = {thunder, boostStone},
["Magby"] = {fire, boostStone},
["Miltank"] = {heart, boostStone},
["Blissey"] = {heart, boostStone},
["Raikou"] = {thunder, boostStone},
["Entei"] = {fire, boostStone},
["Suicune"] = {water, boostStone},
["Larvitar"] = {earth, dark, boostStone},
["Pupitar"] = {earth, dark, boostStone},
["Tyranitar"] = {earth, dark, boostStone},
["Lugia"] = {enigma, water, boostStone},
["Ho-oh"] = {enigma, fire, boostStone},
["Celebi"] = {leaf, enigma, boostStone}}

function doRestoreBoostMachine(cid, b_pos, p_pos, s_pos, msg, msg2)

    doSendAnimatedText(b_pos, "DONE.", 215)

    if isCreature(cid) then
        doCreatureSetNoMove(cid, false)
        doPlayerSendTextMessage(cid, 27, msg)
        doPlayerSendTextMessage(cid, 27, msg2)
    end

    local ball_s = getTileItemById(p_pos, ballslot_run)
    doTransformItem(ball_s.uid, ballslot)

    local stne_s = getTileItemById(s_pos, stoneslot_run)
    doTransformItem(stne_s.uid, stoneslot)

    local butn_s = getTileItemById(b_pos, button_run)
    doTransformItem(butn_s.uid, button)

end

local stones_required = {    -- custo base de stones para boostar
[heart] = 1,
[leaf] = 1,
[water] = 1,
[venom] = 1,
[thunder] = 1,
[rock] = 1,
[punch] = 1,
[fire] = 1,
[coccon] = 1,
[crystal] = 1,
[dark] = 1,
[earth] = 1,
[enigma] = 1,
[ice] = 1,
[boostStone] = 1,    --alterado v1.9
}

local stone_increase = {    -- a cada quantos boosts irá aumentar o custo de stones
[heart] = 3,
[leaf] = 3,
[water] = 3,
[venom] = 4,
[thunder] = 4,
[rock] = 3,
[punch] = 4,
[fire] = 3,
[coccon] = 2,
[crystal] = 15,
[dark] = 4,
[earth] = 4,
[enigma] = 4,
[ice] = 4,
[boostStone] = 10000, --alterado v1.9
}

local pbs = {
[11826] = 11737,  --normal acessa        --alterado v1.9 \/
[11828] = 11739,  --normal morto
[11832] = 11740,  --great acessa
[11834] = 11742,  --great morto
[11835] = 11743,  --super acessa
[11837] = 11745,  --super morto
[11829] = 11746,  --ultra acessa
[11831] = 11748,  --ultra morto
[10975] = 12621,  --saffari acessa
[10977] = 12623,  --saffari morto
}

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

    if isRunning(item.itemid) then
        doPlayerSendCancel(cid, "Wait until boosting finishes.")
    return true
    end

    if item.itemid == button then

        local pbpos = topos
              pbpos.x = pbpos.x + 1
        local ball_slot = getTileItemById(pbpos, ballslot)
        local myball = getContainerItem(ball_slot.uid, 0)

        if myball.uid <= 0 or getItemWeight(myball.uid) == 0 then
            doPlayerSendCancel(cid, "You need to put a pokeball in the ball slot.")
        return true
        end

        local pokemon = getItemAttribute(myball.uid, "poke")
        local boost = getItemAttribute(myball.uid, "boost") or 0

        if boost >= 50 then
            doPlayerSendCancel(cid, "Your pokemon is already at maximum boost.")
        return true
        end

        local stnpos = pbpos
              stnpos.x = stnpos.x - 2
        local stone_slot = getTileItemById(stnpos, stoneslot)

        local stone = getContainerItem(stone_slot.uid, 0)

        if stone.uid <= 0 then
            doPlayerSendCancel(cid, "You need to put a stone in the stone slot.")
        return true
        end

        if not isStone(stone.itemid) then
            doPlayerSendCancel(cid, "Please, put only stones in the stone slot.")
        return true
        end

        if not isInArray(boost_stones[pokemon], stone.itemid) then

            local cancelstr = "Sorry, you are not using the correct stone."

            if #boost_stones[pokemon] > 1 then
                local stonesused = ""
                cancelstr = cancelstr.." This pokemon needs "
                for su = 1, #boost_stones[pokemon] do
                    local n = doCorrectString(getItemNameById(boost_stones[pokemon][su]))
                    if su == #boost_stones[pokemon] then
                        stonesused = stonesused.." or "..getArticle(n).." "..n..""
                    elseif su == 1 then
                        stonesused = stonesused..""..getArticle(n).." "..n..""
                    else
                        stonesused = stonesused..", "..n..""
                    end
                end
                cancelstr = cancelstr..""..stonesused.." to be boosted."
            else
                cancelstr = cancelstr.." This pokemon needs a "..doCorrectString(getItemNameById(boost_stones[pokemon][1])).." to be boosted."
            end

            doPlayerSendCancel(cid, cancelstr)

        return true
        end

        local removeStones = 0
        local extraStones = math.floor(boost / stone_increase[stone.itemid])
        local required_stones = stones_required[stone.itemid] + extraStones

        local boosts = 0

        for a = 0, getContainerSize(stone_slot.uid) - 1 do
            local it = getContainerItem(stone_slot.uid, a)
            if it.uid > 0 then
               if not isStone(it.itemid) then
                  doPlayerSendCancel(cid, "Please, put only stones in the stone slot.")
                  return true
               end
               if it.itemid ~= stone.itemid then
                  doPlayerSendCancel(cid, "Please, put only one type of stone in the stone slot.")
                  return true
               end
               if required_stones > 0 then
                  required_stones = required_stones - (it.type ~= 0 and it.type or 1) --alterado v1.7
                  if required_stones <= 0 then
                     boosts = boosts + 1
                     removeStones = removeStones + stones_required[stone.itemid] + extraStones
                     if boost + boosts <= 49 then
                        extraStones = math.floor((boost + boosts) / stone_increase[stone.itemid])
                        required_stones = stones_required[stone.itemid] + extraStones
                     end
                     break
                  end
               end
            end
        end

        if required_stones > 0 and boosts == 0 then
            doPlayerSendCancel(cid, "You need more stones to boost this pokemon.")
        return true
        end
        
        for b = 1, removeStones do
            local i = getContainerItem(stone_slot.uid, 0)
            if i.type ~= 0 then
               doChangeTypeItem(i.uid, i.type - 1)    --alterado v1.7
            else
               doRemoveItem(i.uid, 1)
            end
        end

        doSetItemAttribute(myball.uid, "boost", boost + boosts)
        doSetItemAttribute(myball.uid, "boosting", 1)   --alterado v1.9.1
        
        if (boost + boosts) >= 10 then
           if pbs[myball.itemid] then              --alterado v1.9
                doTransformItem(myball.uid, pbs[myball.itemid])
           end
        end
        
        doItemEraseAttribute(myball.uid, "boosting")  --alterado v1.9.1

        local msg = "Your "..getPokeballName(myball.uid).." has been boosted!"
        local msg2 = "• Boost: "..(boost + boosts).." (+"..boosts..")"

        local downpos = getThingPos(cid)
        downpos.y = downpos.y + 1

        local mypos = getThingPos(cid)

        doTeleportThing(cid, downpos, false)
        doTeleportThing(cid, mypos, false)

        doTransformItem(ball_slot.uid, ballslot_run)
        doTransformItem(stone_slot.uid, stoneslot_run)
        doTransformItem(item.uid, button_run)

        doCreatureSetNoMove(cid, true)
        doCreatureAddCondition(cid, boostcondition)

        addEvent(doRestoreBoostMachine, 3000, cid, getThingPos(item.uid), getThingPos(ball_slot.uid), getThingPos(stone_slot.uid), msg, msg2)

    return true
    end
end

 

Link para o comentário
Compartilhar em outros sites

15 respostass a esta questão

Posts Recomendados

  • 0
Em 18/09/2018 em 16:17, Maiconmafrah disse:
Versão do Servidor: TFS - 0.3.5
Tipo de Script: actions

TFS Versão 0.3.6 

Bom, a boost stone funciona porém não adiciona vida ao pokémon

Booststone.lua

  Mostrar conteúdo oculto

-- Scrit Por Marshmello
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
local meuovo = {
    qnt = 1,      --quantidade de boost q vai ser adicionada
    maxi = 50,      --maximo de boost 
    chance = 40,  --chance de falhar
    boost_fail = 6,  --- quanditade q ela pode falhar
    falhar = 6,   --- pra onde a boost vai voltar quando falhar
}
 
local minhabola = getPlayerSlotItem(cid, 8).uid
local boost = getItemAttribute(minhabola, "boost") or 0
 
    if minhabola <= 0 then
        return doPlayerSendCancel(cid, "Coloque um pokémon no Main Slot!")
    elseif boost >= meuovo.maxi then
        return doPlayerSendCancel(cid, "Seu pokémon já se encontra no nível máximo de boost!")
    end
    
    if boost >= meuovo.boost_fail  then
        if math.random(1, 100) <= meuovo.chance then
            doItemSetAttribute(minhabola, "boost", (boost + meuovo.qnt))
            doSendMagicEffect(fromPosition, 173)
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"Falhou!")
            doItemSetAttribute(minhabola, "boost", (meuovo.falhar))
            doRemoveItem(item.uid, 1)
        end
    else
        doItemSetAttribute(minhabola, "boost", (boost + meuovo.qnt))
        doSendMagicEffect(fromPosition, 173)
        doRemoveItem(item.uid, 1)
    end
    return true
end

Boost.lua

  Mostrar conteúdo oculto

local ballslot = 12355
local ballslot_run = 12352

local stoneslot = 12354
local stoneslot_run = 12353

local button = 12356
local button_run = 12357

function isRunning(id)
    if isInArray({button_run, stoneslot_run, ballslot_run}, id) then
    return true
    end
return false
end

boost_stones = {                              --alterado v1.9 \/
["Bulbasaur"] = {leaf, boostStone},
["Ivysaur"] = {leaf, boostStone},
["Venusaur"] = {leaf, boostStone},
["Charmander"] = {fire, boostStone},
["Charmeleon"] = {fire, boostStone},
["Charizard"] = {fire, boostStone},
["Squirtle"] = {water, boostStone},
["Wartortle"] = {water, boostStone},
["Blastoise"] = {water, boostStone},
["Caterpie"] = {coccon, boostStone},
["Metapod"] = {coccon, boostStone},
["Butterfree"] = {coccon, boostStone},
["Weedle"] = {coccon, boostStone},
["Kakuna"] = {coccon, boostStone},
["Beedrill"] = {coccon, boostStone},
["Pidgey"] = {heart, boostStone},
["Pidgeotto"] = {heart, boostStone},
["Pidgeot"] = {heart, boostStone},
["Rattata"] = {heart, boostStone},
["Raticate"] = {heart, boostStone},
["Spearow"] = {heart, boostStone},
["Fearow"] = {heart, boostStone},
["Ekans"] = {venom, boostStone},
["Arbok"] = {venom, boostStone},
["Pikachu"] = {thunder, boostStone},
["Raichu"] = {thunder, boostStone},
["Sandshrew"] = {earth, boostStone},
["Sandslash"] = {earth, boostStone},
["Nidoran Female"] = {venom, boostStone},
["Nidorina"] = {venom, boostStone},
["Nidoqueen"] = {venom, earth, boostStone},
["Nidoran Male"] = {venom, boostStone},
["Nidorino"] = {venom, boostStone},
["Nidoking"] = {venom, earth, boostStone},
["Clefairy"] = {heart, boostStone},
["Clefable"] = {heart, boostStone},
["Vulpix"] = {fire, boostStone},
["Ninetales"] = {fire, boostStone},
["Jigglypuff"] = {heart, boostStone},
["Wigglytuff"] = {heart, boostStone},
["Zubat"] = {venom, boostStone},
["Golbat"] = {venom, boostStone},
["Oddish"] = {leaf, venom, boostStone},
["Gloom"] = {leaf, venom, boostStone},
["Vileplume"] = {leaf, venom, boostStone},
["Paras"] = {coccon, leaf, boostStone},
["Parasect"] = {coccon, leaf, boostStone},
["Venonat"] = {coccon, venom, boostStone},
["Venomoth"] = {coccon, venom, boostStone},
["Diglett"] = {earth, boostStone},
["Dugtrio"] = {earth, boostStone},
["Meowth"] = {heart, boostStone},
["Persian"] = {heart, boostStone},
["Psyduck"] = {water, boostStone},
["Golduck"] = {water, enigma, boostStone},
["Mankey"] = {punch, boostStone},
["Primeape"] = {punch, boostStone},
["Growlithe"] = {fire, boostStone},
["Arcanine"] = {fire, boostStone},
["Poliwag"] = {water, boostStone},
["Poliwhirl"] = {water, boostStone},
["Poliwrath"] = {water, punch, boostStone},
["Abra"] = {enigma, boostStone},
["Kadabra"] = {enigma, boostStone},
["Alakazam"] = {enigma, boostStone},
["Machop"] = {punch, boostStone},
["Machoke"] = {punch, boostStone},
["Machamp"] = {punch, boostStone},
["Bellsprout"] = {leaf, venom, boostStone},
["Weepinbell"] = {leaf, venom, boostStone},
["Victreebel"] = {leaf, venom, boostStone},
["Tentacool"] = {water, venom, boostStone},
["Tentacruel"] = {water, venom, boostStone},
["Geodude"] = {earth, rock, boostStone},
["Graveler"] = {earth, rock, boostStone},
["Golem"] = {earth, rock, boostStone},
["Ponyta"] = {fire, boostStone},
["Rapidash"] = {fire, boostStone},
["Slowpoke"] = {water, enigma, boostStone},
["Slowbro"] = {water, enigma, boostStone},
["Magnemite"] = {thunder, metal, boostStone},
["Magneton"] = {thunder, metal, boostStone},
["Farfetch'd"] = {heart, boostStone},
["Doduo"] = {heart, boostStone},
["Dodrio"] = {heart, boostStone},
["Seel"] = {water, ice, boostStone},
["Dewgong"] = {water, ice, boostStone},
["Grimer"] = {venom, boostStone},
["Muk"] = {venom, boostStone},
["Shellder"] = {water, ice, boostStone},
["Cloyster"] = {water, ice, boostStone},
["Gastly"] = {dark, boostStone},
["Haunter"] = {dark, boostStone},
["Gengar"] = {dark, boostStone},
["Onix"] = {rock, earth, boostStone},
["Drowzee"] = {enigma, boostStone},
["Hypno"] = {enigma, boostStone},
["Krabby"] = {water, boostStone},
["Kingler"] = {water, boostStone},
["Voltorb"] = {thunder, boostStone},
["Electrode"] = {thunder, boostStone},
["Exeggcute"] = {enigma, leaf, boostStone},
["Exeggutor"] = {enigma, leaf, boostStone},
["Cubone"] = {earth, boostStone},
["Marowak"] = {earth, boostStone},
["Hitmonlee"] = {punch, boostStone},
["Hitmonchan"] = {punch, boostStone},
["Lickitung"] = {heart, boostStone},
["Koffing"] = {venom, boostStone},
["Weezing"] = {venom, boostStone},
["Rhyhorn"] = {earth, rock, boostStone},
["Rhydon"] = {earth, rock, boostStone},
["Chansey"] = {heart, boostStone},
["Tangela"] = {leaf, boostStone},
["Kangaskhan"] = {heart, boostStone},
["Horsea"] = {water, boostStone},
["Seadra"] = {water, boostStone},
["Goldeen"] = {water, boostStone},
["Seaking"] = {water, boostStone},
["Staryu"] = {water, boostStone},
["Starmie"] = {water, boostStone},
["Mr. Mime"] = {enigma, boostStone},
["Scyther"] = {coccon, boostStone},
["Jynx"] = {enigma, ice, boostStone},
["Electabuzz"] = {thunder, boostStone},
["Magmar"] = {fire, boostStone},
["Pinsir"] = {coccon, boostStone},
["Tauros"] = {heart, boostStone},
["Magikarp"] = {water, boostStone},
["Gyarados"] = {water, crystal, boostStone},
["Lapras"] = {water, ice, boostStone},
["Ditto"] = {heart, boostStone},
["Eevee"] = {heart, boostStone},
["Vaporeon"] = {water, boostStone},
["Jolteon"] = {thunder, boostStone},
["Flareon"] = {fire, boostStone},
["Espeon"] = {enigma, boostStone},
["Umbreon"] = {dark, boostStone},
["Porygon"] = {heart, enigma, boostStone},
["Omanyte"] = {rock, water, boostStone},
["Omastar"] = {rock, water, boostStone},
["Kabuto"] = {rock, water, boostStone},
["Kabutops"] = {rock, water, boostStone},
["Aerodactyl"] = {rock, boostStone},
["Snorlax"] = {heart, boostStone},
["Articuno"] = {ice, boostStone},
["Zapdos"] = {thunder, boostStone},
["Moltres"] = {fire, boostStone},
["Dratini"] = {crystal, boostStone},
["Dragonair"] = {crystal, boostStone},
["Dragonite"] = {crystal, boostStone},
["Mewtwo"] = {enigma, boostStone},
["Mew"] = {enigma, boostStone},
--
["Shiny Bulbasaur"] = {leaf, boostStone},
["Shiny Ivysaur"] = {leaf, boostStone},
["Shiny Venusaur"] = {leaf, boostStone},
["Shiny Charmander"] = {fire, boostStone},
["Shiny Charmeleon"] = {fire, boostStone},
["Shiny Charizard"] = {fire, boostStone},
["Shiny Squirtle"] = {water, boostStone},
["Shiny Wartortle"] = {water, boostStone},
["Shiny Blastoise"] = {water, boostStone},
["Shiny Caterpie"] = {coccon, boostStone},
["Shiny Metapod"] = {coccon, boostStone},
["Shiny Butterfree"] = {coccon, boostStone},
["Shiny Weedle"] = {coccon, boostStone},
["Shiny Kakuna"] = {coccon, boostStone},
["Shiny Beedrill"] = {coccon, boostStone},
["Shiny Pidgey"] = {heart, boostStone},
["Shiny Pidgeotto"] = {heart, boostStone},
["Shiny Pidgeot"] = {heart, boostStone},
["Shiny Rattata"] = {heart, boostStone},
["Shiny Raticate"] = {heart, boostStone},
["Shiny Spearow"] = {heart, boostStone},
["Shiny Fearow"] = {heart, boostStone},
["Shiny Ekans"] = {venom, boostStone},
["Shiny Arbok"] = {venom, boostStone},
["Shiny Pikachu"] = {thunder, boostStone},
["Shiny Raichu"] = {thunder, boostStone},
["Shiny Sandshrew"] = {earth, boostStone},
["Shiny Sandslash"] = {earth, boostStone},
["Shiny Nidoran Female"] = {venom, boostStone},
["Shiny Nidorina"] = {venom, boostStone},
["Shiny Nidoqueen"] = {venom, earth, boostStone},
["Shiny Nidoran Male"] = {venom, boostStone},
["Shiny Nidorino"] = {venom, boostStone},
["Shiny Nidoking"] = {venom, earth, boostStone},
["Shiny Clefairy"] = {heart, boostStone},
["Shiny Clefable"] = {heart, boostStone},
["Shiny Vulpix"] = {fire, boostStone},
["Shiny Ninetales"] = {fire, boostStone},
["Shiny Jigglypuff"] = {heart, boostStone},
["Shiny Wigglytuff"] = {heart, boostStone},
["Shiny Zubat"] = {venom, boostStone},
["Shiny Golbat"] = {venom, boostStone},
["Shiny Oddish"] = {leaf, venom, boostStone},
["Shiny Gloom"] = {leaf, venom, boostStone},
["Shiny Vileplume"] = {leaf, venom, boostStone},
["Shiny Paras"] = {coccon, leaf, boostStone},
["Shiny Parasect"] = {coccon, leaf, boostStone},
["Shiny Venonat"] = {coccon, venom, boostStone},
["Shiny Venomoth"] = {coccon, venom, boostStone},
["Shiny Diglett"] = {earth, boostStone},
["Shiny Dugtrio"] = {earth, boostStone},
["Shiny Meowth"] = {heart, boostStone},
["Shiny Persian"] = {heart, boostStone},
["Shiny Psyduck"] = {water, boostStone},
["Shiny Golduck"] = {water, enigma, boostStone},
["Shiny Mankey"] = {punch, boostStone},
["Shiny Primeape"] = {punch, boostStone},
["Shiny Growlithe"] = {fire, boostStone},
["Shiny Arcanine"] = {fire, boostStone},
["Shiny Poliwag"] = {water, boostStone},
["Shiny Poliwhirl"] = {water, boostStone},
["Shiny Poliwrath"] = {water, punch, boostStone},
["Shiny Abra"] = {enigma, boostStone},
["Shiny Kadabra"] = {enigma, boostStone},
["Shiny Alakazam"] = {enigma, boostStone},
["Shiny Machop"] = {punch, boostStone},
["Shiny Machoke"] = {punch, boostStone},
["Shiny Machamp"] = {punch, boostStone},
["Shiny Bellsprout"] = {leaf, venom, boostStone},
["Shiny Weepinbell"] = {leaf, venom, boostStone},
["Shiny Victreebel"] = {leaf, venom, boostStone},
["Shiny Tentacool"] = {water, venom, boostStone},
["Shiny Tentacruel"] = {water, venom, boostStone},
["Shiny Geodude"] = {earth, rock, boostStone},
["Shiny Graveler"] = {earth, rock, boostStone},
["Shiny Golem"] = {earth, rock, boostStone},
["Shiny Ponyta"] = {fire, boostStone},
["Shiny Rapidash"] = {fire, boostStone},
["Shiny Slowpoke"] = {water, enigma, boostStone},
["Shiny Slowbro"] = {water, enigma, boostStone},
["Shiny Magnemite"] = {thunder, metal, boostStone},
["Shiny Magneton"] = {thunder, metal, boostStone},
["Shiny Farfetch'd"] = {heart, boostStone},
["Shiny Doduo"] = {heart, boostStone},
["Shiny Dodrio"] = {heart, boostStone},
["Shiny Seel"] = {water, ice, boostStone},
["Shiny Dewgong"] = {water, ice, boostStone},
["Shiny Grimer"] = {venom, boostStone},
["Shiny Muk"] = {venom, boostStone},
["Shiny Shellder"] = {water, ice, boostStone},
["Shiny Cloyster"] = {water, ice, boostStone},
["Shiny Gastly"] = {dark, boostStone},
["Shiny Haunter"] = {dark, boostStone},
["Shiny Gengar"] = {dark, boostStone},
["Shiny Onix"] = {rock, earth, boostStone},
["Shiny Drowzee"] = {enigma, boostStone},
["Shiny Hypno"] = {enigma, boostStone},
["Shiny Krabby"] = {water, boostStone},
["Shiny Kingler"] = {water, boostStone},
["Shiny Voltorb"] = {thunder, boostStone},
["Shiny Electrode"] = {thunder, boostStone},
["Shiny Exeggcute"] = {enigma, leaf, boostStone},
["Shiny Exeggutor"] = {enigma, leaf, boostStone},
["Shiny Cubone"] = {earth, boostStone},
["Shiny Marowak"] = {earth, boostStone},
["Shiny Hitmonlee"] = {punch, boostStone},
["Shiny Hitmonchan"] = {punch, boostStone},
["Shiny Hitmontop"] = {punch, boostStone}, --alterado v1.4
["Shiny Lickitung"] = {heart, boostStone},
["Shiny Koffing"] = {venom, boostStone},
["Shiny Weezing"] = {venom, boostStone},
["Shiny Rhyhorn"] = {earth, rock, boostStone},
["Shiny Rhydon"] = {earth, rock, boostStone},
["Shiny Chansey"] = {heart, boostStone},
["Shiny Tangela"] = {leaf, boostStone},
["Shiny Kangaskhan"] = {heart, boostStone},
["Shiny Horsea"] = {water, boostStone},
["Shiny Seadra"] = {water, boostStone},
["Shiny Goldeen"] = {water, boostStone},
["Shiny Seaking"] = {water, boostStone},
["Shiny Staryu"] = {water, boostStone},
["Shiny Starmie"] = {water, boostStone},
["Shiny Mr. Mime"] = {enigma, boostStone},
["Shiny Scyther"] = {coccon, boostStone},
["Shiny Jynx"] = {enigma, ice, boostStone},
["Shiny Electabuzz"] = {thunder, boostStone},
["Shiny Magmar"] = {fire, boostStone},
["Shiny Pinsir"] = {coccon, boostStone},
["Shiny Tauros"] = {heart, boostStone},
["Shiny Magikarp"] = {water, boostStone},
["Shiny Gyarados"] = {water, crystal, boostStone},
["Shiny Lapras"] = {water, ice, boostStone},
["Shiny Ditto"] = {heart, boostStone},
["Shiny Eevee"] = {heart, boostStone},
["Shiny Vaporeon"] = {water, boostStone},
["Shiny Jolteon"] = {thunder, boostStone},
["Shiny Flareon"] = {fire, boostStone},
["Shiny Porygon"] = {heart, enigma, boostStone},
["Shiny Omanyte"] = {rock, water, boostStone},
["Shiny Omastar"] = {rock, water, boostStone},
["Shiny Kabuto"] = {rock, water, boostStone},
["Shiny Kabutops"] = {rock, water, boostStone},
["Shiny Aerodactyl"] = {rock, boostStone},
["Shiny Snorlax"] = {heart, boostStone},
["Shiny Articuno"] = {ice, boostStone},
["Shiny Zapdos"] = {thunder, boostStone},
["Shiny Moltres"] = {fire, boostStone},
["Shiny Dratini"] = {crystal, boostStone},
["Shiny Dragonair"] = {crystal, boostStone},
["Shiny Dragonite"] = {crystal, boostStone},
["Shiny Mewtwo"] = {enigma, boostStone},
["Shiny Mew"] = {enigma, boostStone},
--
["Chikorita"] = {leaf, boostStone},
["Bayleef"] = {leaf, boostStone},
["Meganium"] = {leaf, boostStone},
["Cyndaquil"] = {fire, boostStone},
["Quilava"] = {fire, boostStone},
["Typhlosion"] = {fire, boostStone},
["Totodile"] = {water, boostStone},
["Croconaw"] = {water, boostStone},
["Feraligatr"] = {water, boostStone},
["Sentret"] = {heart, boostStone},
["Furret"] = {heart, boostStone},
["Hoothoot"] = {heart, enigma, boostStone},
["Noctowl"] = {heart, enigma, boostStone},
["Ledyba"] = {coccon, boostStone},
["Ledian"] = {coccon, boostStone},
["Spinarak"] = {coccon, venom, boostStone},
["Ariados"] = {coccon, venom, boostStone},
["Crobat"] = {venom, boostStone},
["Chinchou"] = {water, thunder, boostStone},
["Lanturn"] = {water, thunder, boostStone},
["Pichu"] = {thunder, boostStone},
["Cleffa"] = {heart, boostStone},
["Iglybuff"] = {venom, boostStone},
["Natu"] = {enigma, boostStone},
["Xatu"] = {enigma, boostStone},
["Mareep"] = {thunder, boostStone},
["Flaaffy"] = {thunder, boostStone},
["Ampharos"] = {thunder, boostStone},
["Bellossom"] = {leaf, boostStone},
["Marill"] = {water, boostStone},
["Azulmarill"] = {water, boostStone},
["Sudowoodo"] = {rock, earth, boostStone},
["Politoed"] = {water, earth, boostStone},
["Hoppip"] = {leaf, boostStone},
["Skiploom"] = {leaf, boostStone},
["Jumpluff"] = {leaf, boostStone},
["Aipom"] = {heart, boostStone},
["Sunkern"] = {leaf, boostStone},
["Sunflora"] = {leaf, boostStone},
["Yanma"] = {venom, coccon, boostStone},
["Wooper"] = {water, boostStone},
["Quagsire"] = {water, earth, boostStone},
["Murkrow"] = {dark, boostStone},
["Slowking"] = {water,enigma, boostStone},
["Misdreavus"] = {dark, boostStone},
["Wobbuffet"] = {enigma, boostStone},
["Girafarig"] = {enigma, boostStone},
["Pineco"] = {coccon, boostStone},
["Forretress"] = {coccon, boostStone},
["Gligar"] = {dark, heart, boostStone},
["Steelix"] = {earth, rock, boostStone},
["Snubbull"] = {heart, boostStone},
["Granbull"] = {heart, boostStone},
["Qwilfish"] = {water, boostStone},
["Shuckle"] = {earth, boostStone},
["Heracross"] = {coccon, boostStone},
["Teddiursa"] = {heart, boostStone},
["Ursaring"] = {heart, dark, boostStone},
["Slugma"] = {fire, boostStone},
["Magcargo"] = {fire, boostStone},
["Swinub"] = {ice, earth, boostStone},
["Piloswine"] = {ice, earth, boostStone},
["Corsola"] = {water, boostStone},
["Remoraid"] = {water, boostStone},
["Octillery"] = {water, boostStone},
["Delibird"] = {ice, heart, boostStone},
["Mantine"] = {water, boostStone},
["Skarmory"] = {heart, boostStone},
["Houndour"] = {fire, dark, boostStone},
["Houndoom"] = {fire, dark, boostStone},
["Kingdra"] = {water, crystal, boostStone},
["Phanpy"] = {earth, boostStone},
["Donphan"] = {earth, boostStone},
["porygon2"] = {enigma, boostStone},
["Stantler"] = {heart, boostStone},
["Smeargle"] = {heart, boostStone},
["Tyrogue"] = {punch, boostStone},
["Hitmontop"] = {punch, boostStone},
["Smoochum"] = {ice, enigma, boostStone},
["Elekid"] = {thunder, boostStone},
["Magby"] = {fire, boostStone},
["Miltank"] = {heart, boostStone},
["Blissey"] = {heart, boostStone},
["Raikou"] = {thunder, boostStone},
["Entei"] = {fire, boostStone},
["Suicune"] = {water, boostStone},
["Larvitar"] = {earth, dark, boostStone},
["Pupitar"] = {earth, dark, boostStone},
["Tyranitar"] = {earth, dark, boostStone},
["Lugia"] = {enigma, water, boostStone},
["Ho-oh"] = {enigma, fire, boostStone},
["Celebi"] = {leaf, enigma, boostStone}}

function doRestoreBoostMachine(cid, b_pos, p_pos, s_pos, msg, msg2)

    doSendAnimatedText(b_pos, "DONE.", 215)

    if isCreature(cid) then
        doCreatureSetNoMove(cid, false)
        doPlayerSendTextMessage(cid, 27, msg)
        doPlayerSendTextMessage(cid, 27, msg2)
    end

    local ball_s = getTileItemById(p_pos, ballslot_run)
    doTransformItem(ball_s.uid, ballslot)

    local stne_s = getTileItemById(s_pos, stoneslot_run)
    doTransformItem(stne_s.uid, stoneslot)

    local butn_s = getTileItemById(b_pos, button_run)
    doTransformItem(butn_s.uid, button)

end

local stones_required = {    -- custo base de stones para boostar
[heart] = 1,
[leaf] = 1,
[water] = 1,
[venom] = 1,
[thunder] = 1,
[rock] = 1,
[punch] = 1,
[fire] = 1,
[coccon] = 1,
[crystal] = 1,
[dark] = 1,
[earth] = 1,
[enigma] = 1,
[ice] = 1,
[boostStone] = 1,    --alterado v1.9
}

local stone_increase = {    -- a cada quantos boosts irá aumentar o custo de stones
[heart] = 3,
[leaf] = 3,
[water] = 3,
[venom] = 4,
[thunder] = 4,
[rock] = 3,
[punch] = 4,
[fire] = 3,
[coccon] = 2,
[crystal] = 15,
[dark] = 4,
[earth] = 4,
[enigma] = 4,
[ice] = 4,
[boostStone] = 10000, --alterado v1.9
}

local pbs = {
[11826] = 11737,  --normal acessa        --alterado v1.9 \/
[11828] = 11739,  --normal morto
[11832] = 11740,  --great acessa
[11834] = 11742,  --great morto
[11835] = 11743,  --super acessa
[11837] = 11745,  --super morto
[11829] = 11746,  --ultra acessa
[11831] = 11748,  --ultra morto
[10975] = 12621,  --saffari acessa
[10977] = 12623,  --saffari morto
}

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

    if isRunning(item.itemid) then
        doPlayerSendCancel(cid, "Wait until boosting finishes.")
    return true
    end

    if item.itemid == button then

        local pbpos = topos
              pbpos.x = pbpos.x + 1
        local ball_slot = getTileItemById(pbpos, ballslot)
        local myball = getContainerItem(ball_slot.uid, 0)

        if myball.uid <= 0 or getItemWeight(myball.uid) == 0 then
            doPlayerSendCancel(cid, "You need to put a pokeball in the ball slot.")
        return true
        end

        local pokemon = getItemAttribute(myball.uid, "poke")
        local boost = getItemAttribute(myball.uid, "boost") or 0

        if boost >= 50 then
            doPlayerSendCancel(cid, "Your pokemon is already at maximum boost.")
        return true
        end

        local stnpos = pbpos
              stnpos.x = stnpos.x - 2
        local stone_slot = getTileItemById(stnpos, stoneslot)

        local stone = getContainerItem(stone_slot.uid, 0)

        if stone.uid <= 0 then
            doPlayerSendCancel(cid, "You need to put a stone in the stone slot.")
        return true
        end

        if not isStone(stone.itemid) then
            doPlayerSendCancel(cid, "Please, put only stones in the stone slot.")
        return true
        end

        if not isInArray(boost_stones[pokemon], stone.itemid) then

            local cancelstr = "Sorry, you are not using the correct stone."

            if #boost_stones[pokemon] > 1 then
                local stonesused = ""
                cancelstr = cancelstr.." This pokemon needs "
                for su = 1, #boost_stones[pokemon] do
                    local n = doCorrectString(getItemNameById(boost_stones[pokemon][su]))
                    if su == #boost_stones[pokemon] then
                        stonesused = stonesused.." or "..getArticle(n).." "..n..""
                    elseif su == 1 then
                        stonesused = stonesused..""..getArticle(n).." "..n..""
                    else
                        stonesused = stonesused..", "..n..""
                    end
                end
                cancelstr = cancelstr..""..stonesused.." to be boosted."
            else
                cancelstr = cancelstr.." This pokemon needs a "..doCorrectString(getItemNameById(boost_stones[pokemon][1])).." to be boosted."
            end

            doPlayerSendCancel(cid, cancelstr)

        return true
        end

        local removeStones = 0
        local extraStones = math.floor(boost / stone_increase[stone.itemid])
        local required_stones = stones_required[stone.itemid] + extraStones

        local boosts = 0

        for a = 0, getContainerSize(stone_slot.uid) - 1 do
            local it = getContainerItem(stone_slot.uid, a)
            if it.uid > 0 then
               if not isStone(it.itemid) then
                  doPlayerSendCancel(cid, "Please, put only stones in the stone slot.")
                  return true
               end
               if it.itemid ~= stone.itemid then
                  doPlayerSendCancel(cid, "Please, put only one type of stone in the stone slot.")
                  return true
               end
               if required_stones > 0 then
                  required_stones = required_stones - (it.type ~= 0 and it.type or 1) --alterado v1.7
                  if required_stones <= 0 then
                     boosts = boosts + 1
                     removeStones = removeStones + stones_required[stone.itemid] + extraStones
                     if boost + boosts <= 49 then
                        extraStones = math.floor((boost + boosts) / stone_increase[stone.itemid])
                        required_stones = stones_required[stone.itemid] + extraStones
                     end
                     break
                  end
               end
            end
        end

        if required_stones > 0 and boosts == 0 then
            doPlayerSendCancel(cid, "You need more stones to boost this pokemon.")
        return true
        end
        
        for b = 1, removeStones do
            local i = getContainerItem(stone_slot.uid, 0)
            if i.type ~= 0 then
               doChangeTypeItem(i.uid, i.type - 1)    --alterado v1.7
            else
               doRemoveItem(i.uid, 1)
            end
        end

        doSetItemAttribute(myball.uid, "boost", boost + boosts)
        doSetItemAttribute(myball.uid, "boosting", 1)   --alterado v1.9.1
        
        if (boost + boosts) >= 10 then
           if pbs[myball.itemid] then              --alterado v1.9
                doTransformItem(myball.uid, pbs[myball.itemid])
           end
        end
        
        doItemEraseAttribute(myball.uid, "boosting")  --alterado v1.9.1

        local msg = "Your "..getPokeballName(myball.uid).." has been boosted!"
        local msg2 = "• Boost: "..(boost + boosts).." (+"..boosts..")"

        local downpos = getThingPos(cid)
        downpos.y = downpos.y + 1

        local mypos = getThingPos(cid)

        doTeleportThing(cid, downpos, false)
        doTeleportThing(cid, mypos, false)

        doTransformItem(ball_slot.uid, ballslot_run)
        doTransformItem(stone_slot.uid, stoneslot_run)
        doTransformItem(item.uid, button_run)

        doCreatureSetNoMove(cid, true)
        doCreatureAddCondition(cid, boostcondition)

        addEvent(doRestoreBoostMachine, 3000, cid, getThingPos(item.uid), getThingPos(ball_slot.uid), getThingPos(stone_slot.uid), msg, msg2)

    return true
    end
end

 

manda seu level system.lua da lib

Link para o comentário
Compartilhar em outros sites

  • 0

simples, vá em level system.lua na lib e procure a storage que se refere a vitalidade do pokémon do jogador, feito isso adicione ao final a soma do boost do pokémon! simples!

Link para o comentário
Compartilhar em outros sites

  • 0
Em 19/09/2018 em 18:11, Marshmello disse:

manda seu level system.lua da lib

Tá aqui mano desculpa a demora 

Spoiler

function adjustWildPoke(cid, optionalLevel)
if isMonster(cid) and pokes[getCreatureName(cid)] then

    local level = (optionalLevel and optionalLevel >= 1) and optionalLevel or getPokemonLevel(cid)  --alterado v1.8
    
    setPlayerStorageValue(cid, 1000, level) --alterado v1.8
    setPlayerStorageValue(cid, 1001, pokes[getCreatureName(cid)].offense * level)
    setPlayerStorageValue(cid, 1002, pokes[getCreatureName(cid)].defense)
    setPlayerStorageValue(cid, 1003, pokes[getCreatureName(cid)].agility)                                  
    setPlayerStorageValue(cid, 1004, pokes[getCreatureName(cid)].vitality * level)
    setPlayerStorageValue(cid, 1005, pokes[getCreatureName(cid)].specialattack * level * 5)
    
    doRegainSpeed(cid)         --alterado!
    setCreatureMaxHealth(cid, (getVitality(cid) * HPperVITwild)) 
    doCreatureAddHealth(cid,  getCreatureMaxHealth(cid))
   
    if pokes[getCreatureName(cid)].exp then
       local exp = pokes[getCreatureName(cid)].exp * baseExpRate + pokes[getCreatureName(cid)].vitality * pokemonExpPerLevelRate
       setPlayerStorageValue(cid, 1006, (exp * generalExpRate/2)*10)
       if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)      
       end   
    end
end
end       

function getPokemonXMLOutfit(name)                --alterado v1.9 \/
local path = "data/monster/pokes/Shiny/"..name..".xml"
local tpw = io.type(io.open(path))

if not tpw then
   path = "data/monster/pokes/geracao 2/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/geracao 1/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/"..name..".xml"
   tpw = io.type(io.open(path))
end   
if not tpw then
   return print("[getPokemonXMLOutfit] Poke with name: "..name.." ins't in any paste on monster/pokes/") and 2
end
   local arq = io.open(path, "a+")
   local txt = arq:read("*all")
   arq:close()
   local a, b = txt:find('look type="(.-)"')
   txt = string.sub(txt, a + 11, b - 1)
return tonumber(txt)
end 

function doEvolutionOutfit(cid, oldout, outfit)
    if not isCreature(cid) then return true end
        if getCreatureOutfit(cid).lookType == oldout then
            doSetCreatureOutfit(cid, {lookType = outfit}, -1)
        else
            doSetCreatureOutfit(cid, {lookType = oldout}, -1)
        end
end

function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve, f, h)
    if not isCreature(cid) then
        doSendAnimatedText(pos, "CANCEL", 215)
        return true 
    end
    if evolve then
        doEvolvePokemon(getCreatureMaster(cid), {uid = cid}, evolution, 0, 0)
    return true
    end
    doSendMagicEffect(pos, 18)
        if ssj then
            sendSSJEffect(evo)
        end
    doEvolutionOutfit(cid, f, h)
    addEvent(doSendEvolutionEffect, math.pow(1900, turn/20), cid, getThingPos(cid), evolution, turn - 1, turn == 19, turn == 2, f, h)
end

function sendSSJEffect(cid)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)
    local pos2 = getThingPos(cid)
    pos2.x = pos2.x + math.random(-1, 1)
    pos2.y = pos2.y - math.random(1, 2)
    doSendDistanceShoot(pos1, pos2, 37)
    addEvent(sendSSJEffect, 45, cid)
end

function sendFinishEvolutionEffect(cid, alternate)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)

    if alternate then
        local pos = {
        [1] = {-2, 0},
        [2] = {-1, -1},
        [3] = {0, -2},
        [4] = {1, -1},
        [5] = {2, 0},
        [6] = {1, 1},
        [7] = {0, 2},
        [8] = {-1, 1}}
        for a = 1, 8 do
            local pos2 = getThingPos(cid)
            pos2.x = pos2.x + pos[a][1]
            pos2.y = pos2.y + pos[a][2]
            local pos = getThingPos(cid)
            doSendDistanceShoot(pos2, pos, 37)
            addEvent(doSendDistanceShoot, 300, pos, pos2, 37)
        end
    else
        for a = 0, 3 do
            doSendDistanceShoot(pos1, getPosByDir(pos1, a), 37)
        end
        for a = 4, 7 do
            addEvent(doSendDistanceShoot, 600, pos1, getPosByDir(pos1, a), 37)
        end
    end
end

function doEvolvePokemon(cid, item2, theevo, stone1, stone2)

    if not isCreature(cid) then return true end

    if not pokes[theevo] or not pokes[theevo].offense then
    doReturnPokemon(cid, item2.uid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true)
    return true
    end

    local owner = getCreatureMaster(item2.uid)
    local pokeball = getPlayerSlotItem(cid, ?
    local description = "Contains a "..theevo.."."
    local pct = getCreatureHealth(item2.uid) / getCreatureMaxHealth(item2.uid)

        doItemSetAttribute(pokeball.uid, "hp", pct)

        doItemSetAttribute(pokeball.uid, "poke", theevo)
        doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".")

        doPlayerSendTextMessage(cid, 27, "Congratulations! Your "..getPokeName(item2.uid).." evolved into a "..theevo.."!")        

        doSendMagicEffect(getThingPos(item2.uid), 18)
        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
        doSendMagicEffect(getThingPos(cid), 173)

        local oldpos = getThingPos(item2.uid)
        local oldlod = getCreatureLookDir(item2.uid)
        doRemoveCreature(item2.uid)

        doSummonMonster(cid, theevo)
        local pk = getCreatureSummons(cid)[1]

        doTeleportThing(pk, oldpos, false)
        doCreatureSetLookDir(pk, oldlod)

        sendFinishEvolutionEffect(pk, true)
        addEvent(sendFinishEvolutionEffect, 550, pk, true)
        addEvent(sendFinishEvolutionEffect, 1050, pk)
        
        doPlayerRemoveItem(cid, stone1, 1)
        doPlayerRemoveItem(cid, stone2, 1)

        doAddPokemonInOwnList(cid, theevo)

        local happy = getItemAttribute(pokeball.uid, "happy")

        doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution)

        if happy + happyGainedOnEvolution > 255 then
            doItemSetAttribute(pokeball.uid, "happy", 255)
        end

        adjustStatus(pk, pokeball.uid, true, false)

        if useKpdoDlls then
            doUpdateMoves(cid)
        end
end

function doMathDecimal(number, casas)

    if math.floor(number) == number then return number end

    local c = casas and casas + 1 or 3

    for a = 0, 10 do
        if math.floor(number) < math.pow(10, a) then
            local str = string.sub(""..number.."", 1, a + c)
            return tonumber(str)    
        end
    end

return number
end

function doAdjustWithDelay(cid, pk, health, vit, status)
if isCreature(cid) then                                   
   adjustStatus(pk, getPlayerSlotItem(cid, 8).uid, health, vir, status)
end
end

function adjustStatus(pk, item, health, vite, conditions)

    if not isCreature(pk) then return true end

    local gender = getItemAttribute(item, "gender") and getItemAttribute(item, "gender") or 0
    addEvent(doCreatureSetSkullType, 10, pk, gender)

    setPlayerStorageValue(pk, 1001, pokes[getCreatureName(pk)].offense * (getMasterLevel(pk) + getPokemonBoost(pk)))
    setPlayerStorageValue(pk, 1002, pokes[getCreatureName(pk)].defense)             
    setPlayerStorageValue(pk, 1003, pokes[getCreatureName(pk)].agility)
    setPlayerStorageValue(pk, 1004, pokes[getCreatureName(pk)].vitality * 75)
    setPlayerStorageValue(pk, 1005, pokes[getCreatureName(pk)].specialattack * (getMasterLevel(pk) + getPokemonBoost(pk) )*9)
    
    if vite == true then
        local pct = getCreatureHealth(pk) / getCreatureMaxHealth(pk)
        local vit = getVitality(pk)
        setCreatureMaxHealth(pk, ( vit * HPperVITsummon ))
        doCreatureAddHealth(pk, pct * vit * HPperVITsummon)
    end
                                                                      
    doRegainSpeed(pk)  

    local nick = getItemAttribute(item, "poke")

    if isGhostPokemon(pk) then
       setPlayerStorageValue(pk, 8981, 1)
       updateGhostWalk(pk)
    end
        

    if getItemAttribute(item, "nick") then
        nick = getItemAttribute(item, "nick")
    end

    setPlayerStorageValue(pk, 1007, nick)
    
    local lvl = getItemAttribute(item, "level") or 0
    nick = nick
    
    doCreatureSetNick(pk, nick)

    if not getItemAttribute(item, "happy") then
        doItemSetAttribute(item, "happy", 120)
    end

    if not getItemAttribute(item, "hunger") then
        doItemSetAttribute(item, "hunger", 5)
    end

    local happy = getItemAttribute(item, "happy")
        if happy < 0 then
            happy = 1
        end
    setPlayerStorageValue(pk, 1008, happy)

    local hunger = getItemAttribute(item, "hunger")
    setPlayerStorageValue(pk, 1009, hunger)

    if health == true then
        local mh = HPperVITsummon * getVitality(pk)
        local rd = 1 - (tonumber(getItemAttribute(item, "hp")))
        setCreatureMaxHealth(pk, mh)                                  
        doCreatureAddHealth(pk, getCreatureMaxHealth(pk))
        doCreatureAddHealth(pk, -(getCreatureMaxHealth(pk) * rd))
    end

    if isSummon(pk) and conditions then
        local burn = getItemAttribute(item, "burn")   
        if burn and burn >= 0 then
           local ret = {id = pk, cd = burn, check = false, damage = getItemAttribute(item, "burndmg"), cond = "Burn"}
           addEvent(doCondition2, 3500, ret)
        end

        local poison = getItemAttribute(item, "poison")
        if poison and poison >= 0 then
           local ret = {id = pk, cd = poison, check = false, damage = getItemAttribute(item, "poisondmg"), cond = "Poison"}
           addEvent(doCondition2, 1500, ret)
        end

        local confuse = getItemAttribute(item, "confuse")
        if confuse and confuse >= 0 then
           local ret = {id = pk, cd = confuse, check = false, cond = "Confusion"}
           addEvent(doCondition2, 1200, ret)                                                
        end

        local sleep = getItemAttribute(item, "sleep")
        if sleep and sleep >= 0 then
           local ret = {id = pk, cd = sleep, check = false, first = true, cond = "Sleep"}
           doCondition2(ret)
        end
        
        local miss = getItemAttribute(item, "miss")     
        if miss and miss >= 0 then      
          local ret = {id = pk, cd = miss, eff = getItemAttribute(item, "missEff"), check = false, spell = getItemAttribute(item, "missSpell"), cond = "Miss"}
          doCondition2(ret)
        end
        
        local fear = getItemAttribute(item, "fear")
        if fear and fear >= 0 then
           local ret = {id = pk, cd = fear, check = false, skill = getItemAttribute(item, "fearSkill"), cond = "Fear"}
           doCondition2(ret)
        end
        
        local silence = getItemAttribute(item, "silence")
        if silence and silence >= 0 then      
           local ret = {id = pk, cd = silence, eff = getItemAttribute(item, "silenceEff"), check = false, cond = "Silence"}
           doCondition2(ret)
        end                                     
        
        local stun = getItemAttribute(item, "stun")
        if stun and stun >= 0 then
           local ret = {id = pk, cd = stun, eff = getItemAttribute(item, "stunEff"), check = false, spell = getItemAttribute(item, "stunSpell"), cond = "Stun"}
           doCondition2(ret)
        end 
                                                       
        local paralyze = getItemAttribute(item, "paralyze")
        if paralyze and paralyze >= 0 then
           local ret = {id = pk, cd = paralyze, eff = getItemAttribute(item, "paralyzeEff"), check = false, first = true, cond = "Paralyze"}
           doCondition2(ret)
        end  
                                                     
        local slow = getItemAttribute(item, "slow")
        if slow and slow >= 0 then
           local ret = {id = pk, cd = slow, eff = getItemAttribute(item, "slowEff"), check = false, first = true, cond = "Slow"}
           doCondition2(ret)
        end                                              
        
        local leech = getItemAttribute(item, "leech")
        if leech and leech >= 0 then
           local ret = {id = pk, cd = leech, attacker = 0, check = false, damage = getItemAttribute(item, "leechdmg"), cond = "Leech"}
           doCondition2(ret)
        end                               
        
        for i = 1, 3 do
            local buff = getItemAttribute(item, "Buff"..i)
            if buff and buff >= 0 then
               local ret = {id = pk, cd = buff, eff = getItemAttribute(item, "Buff"..i.."eff"), check = false, 
               buff = getItemAttribute(item, "Buff"..i.."skill"), first = true, attr = "Buff"..i}
               doCondition2(ret)
            end
        end
               
    end
                                                                          --alterado v1.9
    if getItemAttribute(item, "boost") and getItemAttribute(item, "boost") >= 50 and getItemAttribute(item, "aura") then
       sendAuraEffect(pk, auraSyst[getItemAttribute(item, "aura")])        
    end
    
    if getPlayerStorageValue(getCreatureMaster(pk), 6598754) >= 1 then
        setPlayerStorageValue(pk, 6598754, 1)                               
    elseif getPlayerStorageValue(getCreatureMaster(pk), 6598755) >= 1 then
        setPlayerStorageValue(pk, 6598755, 1)
    end

return true
end

function setWildPokemonLevel(cid, optionalLevel, optionalStatus, optionalNick, optionalExtraExp)

    if not isCreature(cid) then return true end
    if not pokes[getCreatureName(cid)] then return true end  --alterado v2.6

    local levelRange = 0
    local off = 0
    local def = 0
    local agi = 0
    local spatk = 0
    local vit = 0
    local this = getCreatureName(cid)
    local ee = 1

    if optionalExtraExp then
        ee = optionalExtraExp
    end


    if optionalLevel and tonumber(optionalLevel) >= 1 then                --alterado v2.8\/
        levelRange = optionalLevel
    else
        levelRange = math.random(pokes[this].wildLvlMin, pokes[this].wildLvlMax) 
    end                                                                                          

    local status = getPokemonStatus(this)
        if status then
            off = status.off
            def = status.def
            agi = status.agi
            vit = status.vit
            spatk = status.spatk
        end

    setPlayerStorageValue(cid, 1000, (levelRange > 100 and 100 or levelRange)) --alterado v2.8

    if optionalStatus and optionalStatus.off then
        setPlayerStorageValue(cid, 1001, optionalStatus.offense)
        setPlayerStorageValue(cid, 1002, optionalStatus.defense)
        setPlayerStorageValue(cid, 1003, optionalStatus.agility)
        setPlayerStorageValue(cid, 1004, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1005, optionalStatus.specialattack)
        setPlayerStorageValue(cid, 1011, optionalStatus.offense)
        setPlayerStorageValue(cid, 1012, optionalStatus.defense)
        setPlayerStorageValue(cid, 1013, optionalStatus.agility)
        setPlayerStorageValue(cid, 1014, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1015, optionalStatus.specialattack)
    else
        setPlayerStorageValue(cid, 1001, 5 + math.random(off * levelRange * 0.9, off * levelRange * 1.8))
        setPlayerStorageValue(cid, 1002, 5 + math.random(def * levelRange * 0.9, def * levelRange * 1.8))
        setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.9, agi * levelRange * 1.8))
        setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.9, vit * levelRange * 1.8))
        setPlayerStorageValue(cid, 1005, 5 + math.random(spatk * levelRange * 0.9, spatk * levelRange * 1.8))
        setPlayerStorageValue(cid, 1011, getPlayerStorageValue(cid, 1001))
        setPlayerStorageValue(cid, 1012, getPlayerStorageValue(cid, 1002))
        setPlayerStorageValue(cid, 1013, getPlayerStorageValue(cid, 1003))
        setPlayerStorageValue(cid, 1014, getPlayerStorageValue(cid, 1004))
        setPlayerStorageValue(cid, 1015, getPlayerStorageValue(cid, 1005))
    end

    doRegainSpeed(cid)

    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + getPlayerStorageValue(cid, 1004) * HPperVIT * vitReductionForWild)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    
    if pokes[getCreatureName(cid)].exp then
        --getMonsterInfo(getCreatureName(cid)).experience
        local exp = (50 + pokes[getCreatureName(cid)].exp) * baseExpRate + pokes[getCreatureName(cid)].vitality * levelRange * pokemonExpPerLevelRate
        setPlayerStorageValue(cid, 1006, exp * generalExpRate * ee)
        if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)         --edited golden arena
       end  
    end

    local wildshow = wildBeforeNames and "Wild " or ""
    if optionalNick then
        if hideWildsLevel then
            doCreatureSetNick(cid, optionalNick)
        else
            doCreatureSetNick(cid, optionalNick.." ["..getWildPokemonLevel(cid).."]")
        end
    else
        if hideWildsLevel then
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).."")
        else
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).." ["..getWildPokemonLevel(cid).."]")
        end
    end
end

function getOffense(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1001))
end

function getDefense(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1002))
end

function getSpeed(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1003))
end

function getVitality(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1004))
end

function getSpecialAttack(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1005))
end

function getHappiness(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1008))
end

function getSpecialDefense(cid)
    if not isCreature(cid) then return 0 end
return getSpecialAttack(cid) * 0.85 + getDefense(cid) * 0.2      
end

function getPokemonLevel(cid, dex)
if not isCreature(cid) then return 0 end 
    if not dex then                      --alterado v1.9
       if ehMonstro(cid) and getPlayerStorageValue(cid, 1000) > 0 then  
          return getPlayerStorageValue(cid, 1000)
       elseif ehMonstro(cid) then 
          return pokes[getCreatureName(cid)].wildLvl             
       end
    end   
return pokes[getCreatureName(cid)].level
end

function getPokemonLevelByName(name)
return pokes[name] and pokes[name].level or 0  --alterado v1.9
end

function getMasterLevel(poke)
    if not isSummon(poke) then return 0 end
return getPlayerLevel(getCreatureMaster(poke))
end

function getPokemonBoost(poke)
    if not isSummon(poke) then return 0 end
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(poke), 8).uid, "boost") or 0
end

function getPokeballBoost(ball)
    if not isPokeball(ball.itemid) then return 0 end  --alterado v1.8
return getItemAttribute(ball.uid, "boost") or 0
end

function getPokeName(cid)
    if not isSummon(cid) then return getCreatureName(cid) end
    if getCreatureName(cid) == "Evolution" then return getPlayerStorageValue(cid, 1007) end
    
local item = getPlayerSlotItem(getCreatureMaster(cid), ?
    if getItemAttribute(item.uid, "nick") then
       return getItemAttribute(item.uid, "nick")
    end
return getCreatureName(cid)
end

function getPokeballName(item, truename)
if not truename and getItemAttribute(item, "nick") then
return getItemAttribute(item, "nick")
end
return getItemAttribute(item, "poke")
end

function getPokemonName(cid)
return getCreatureName(cid)
end

function getPokemonGender(cid) --alterado v1.9
return getCreatureSkullType(cid)
end

function setPokemonGender(cid, gender)
if isCreature(cid) and gender then        --alterado v1.8
   doCreatureSetSkullType(cid, gender)
   return true
end
return false
end

function getWildPokemonExp(cid)
return getPlayerStorageValue(cid, 1006)
end

 

Link para o comentário
Compartilhar em outros sites

  • 0

@Maiconmafrah

Spoiler

function adjustWildPoke(cid, optionalLevel)
if isMonster(cid) and pokes[getCreatureName(cid)] then

    local level = (optionalLevel and optionalLevel >= 1) and optionalLevel or getPokemonLevel(cid)  --alterado v1.8
    
    setPlayerStorageValue(cid, 1000, level) --alterado v1.8
    setPlayerStorageValue(cid, 1001, pokes[getCreatureName(cid)].offense * level)
    setPlayerStorageValue(cid, 1002, pokes[getCreatureName(cid)].defense)
    setPlayerStorageValue(cid, 1003, pokes[getCreatureName(cid)].agility)                                  
    setPlayerStorageValue(cid, 1004, pokes[getCreatureName(cid)].vitality * level)
    setPlayerStorageValue(cid, 1005, pokes[getCreatureName(cid)].specialattack * level * 5)
    
    doRegainSpeed(cid)         --alterado!
    setCreatureMaxHealth(cid, (getVitality(cid) * HPperVITwild)) 
    doCreatureAddHealth(cid,  getCreatureMaxHealth(cid))
   
    if pokes[getCreatureName(cid)].exp then
       local exp = pokes[getCreatureName(cid)].exp * baseExpRate + pokes[getCreatureName(cid)].vitality * pokemonExpPerLevelRate
       setPlayerStorageValue(cid, 1006, (exp * generalExpRate/2)*10)
       if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)      
       end   
    end
end
end       

function getPokemonXMLOutfit(name)                --alterado v1.9 \/
local path = "data/monster/pokes/Shiny/"..name..".xml"
local tpw = io.type(io.open(path))

if not tpw then
   path = "data/monster/pokes/geracao 2/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/geracao 1/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/"..name..".xml"
   tpw = io.type(io.open(path))
end   
if not tpw then
   return print("[getPokemonXMLOutfit] Poke with name: "..name.." ins't in any paste on monster/pokes/") and 2
end
   local arq = io.open(path, "a+")
   local txt = arq:read("*all")
   arq:close()
   local a, b = txt:find('look type="(.-)"')
   txt = string.sub(txt, a + 11, b - 1)
return tonumber(txt)
end 

function doEvolutionOutfit(cid, oldout, outfit)
    if not isCreature(cid) then return true end
        if getCreatureOutfit(cid).lookType == oldout then
            doSetCreatureOutfit(cid, {lookType = outfit}, -1)
        else
            doSetCreatureOutfit(cid, {lookType = oldout}, -1)
        end
end

function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve, f, h)
    if not isCreature(cid) then
        doSendAnimatedText(pos, "CANCEL", 215)
        return true 
    end
    if evolve then
        doEvolvePokemon(getCreatureMaster(cid), {uid = cid}, evolution, 0, 0)
    return true
    end
    doSendMagicEffect(pos, 18)
        if ssj then
            sendSSJEffect(evo)
        end
    doEvolutionOutfit(cid, f, h)
    addEvent(doSendEvolutionEffect, math.pow(1900, turn/20), cid, getThingPos(cid), evolution, turn - 1, turn == 19, turn == 2, f, h)
end

function sendSSJEffect(cid)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)
    local pos2 = getThingPos(cid)
    pos2.x = pos2.x + math.random(-1, 1)
    pos2.y = pos2.y - math.random(1, 2)
    doSendDistanceShoot(pos1, pos2, 37)
    addEvent(sendSSJEffect, 45, cid)
end

function sendFinishEvolutionEffect(cid, alternate)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)

    if alternate then
        local pos = {
        [1] = {-2, 0},
        [2] = {-1, -1},
        [3] = {0, -2},
        [4] = {1, -1},
        [5] = {2, 0},
        [6] = {1, 1},
        [7] = {0, 2},
        [8] = {-1, 1}}
        for a = 1, 8 do
            local pos2 = getThingPos(cid)
            pos2.x = pos2.x + pos[a][1]
            pos2.y = pos2.y + pos[a][2]
            local pos = getThingPos(cid)
            doSendDistanceShoot(pos2, pos, 37)
            addEvent(doSendDistanceShoot, 300, pos, pos2, 37)
        end
    else
        for a = 0, 3 do
            doSendDistanceShoot(pos1, getPosByDir(pos1, a), 37)
        end
        for a = 4, 7 do
            addEvent(doSendDistanceShoot, 600, pos1, getPosByDir(pos1, a), 37)
        end
    end
end

function doEvolvePokemon(cid, item2, theevo, stone1, stone2)

    if not isCreature(cid) then return true end

    if not pokes[theevo] or not pokes[theevo].offense then
    doReturnPokemon(cid, item2.uid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true)
    return true
    end

    local owner = getCreatureMaster(item2.uid)
    local pokeball = getPlayerSlotItem(cid, ?
    local description = "Contains a "..theevo.."."
    local pct = getCreatureHealth(item2.uid) / getCreatureMaxHealth(item2.uid)

        doItemSetAttribute(pokeball.uid, "hp", pct)

        doItemSetAttribute(pokeball.uid, "poke", theevo)
        doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".")

        doPlayerSendTextMessage(cid, 27, "Congratulations! Your "..getPokeName(item2.uid).." evolved into a "..theevo.."!")        

        doSendMagicEffect(getThingPos(item2.uid), 18)
        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
        doSendMagicEffect(getThingPos(cid), 173)

        local oldpos = getThingPos(item2.uid)
        local oldlod = getCreatureLookDir(item2.uid)
        doRemoveCreature(item2.uid)

        doSummonMonster(cid, theevo)
        local pk = getCreatureSummons(cid)[1]

        doTeleportThing(pk, oldpos, false)
        doCreatureSetLookDir(pk, oldlod)

        sendFinishEvolutionEffect(pk, true)
        addEvent(sendFinishEvolutionEffect, 550, pk, true)
        addEvent(sendFinishEvolutionEffect, 1050, pk)
        
        doPlayerRemoveItem(cid, stone1, 1)
        doPlayerRemoveItem(cid, stone2, 1)

        doAddPokemonInOwnList(cid, theevo)

        local happy = getItemAttribute(pokeball.uid, "happy")

        doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution)

        if happy + happyGainedOnEvolution > 255 then
            doItemSetAttribute(pokeball.uid, "happy", 255)
        end

        adjustStatus(pk, pokeball.uid, true, false)

        if useKpdoDlls then
            doUpdateMoves(cid)
        end
end

function doMathDecimal(number, casas)

    if math.floor(number) == number then return number end

    local c = casas and casas + 1 or 3

    for a = 0, 10 do
        if math.floor(number) < math.pow(10, a) then
            local str = string.sub(""..number.."", 1, a + c)
            return tonumber(str)    
        end
    end

return number
end

function doAdjustWithDelay(cid, pk, health, vit, status)
if isCreature(cid) then                                   
   adjustStatus(pk, getPlayerSlotItem(cid, 8).uid, health, vir, status)
end
end

function setBoost(cid, boost)
local boostc = boost
local boostcalculator = boostc * 500
local vida = 0
if(boost == 1) then
vida = 50
elseif(boost == 50) then
vida = 100
end
return vida;
end

function adjustStatus(pk, item, health, vite, conditions)

    if not isCreature(pk) then return true end

    local gender = getItemAttribute(item, "gender") and getItemAttribute(item, "gender") or 0
    addEvent(doCreatureSetSkullType, 10, pk, gender)

    setPlayerStorageValue(pk, 1001, pokes[getCreatureName(pk)].offense * (getMasterLevel(pk) + getPokemonBoost(pk)))
    setPlayerStorageValue(pk, 1002, pokes[getCreatureName(pk)].defense)             
    setPlayerStorageValue(pk, 1003, pokes[getCreatureName(pk)].agility)
    setPlayerStorageValue(pk, 1004, pokes[getCreatureName(pk)].vitality * 75)
    setPlayerStorageValue(pk, 1005, pokes[getCreatureName(pk)].specialattack * (getMasterLevel(pk) + getPokemonBoost(pk) )*9)
    
    if vite == true then
        local pct = getCreatureHealth(pk) / getCreatureMaxHealth(pk)
        local vit = getVitality(pk)
        setCreatureMaxHealth(pk, ( vit * HPperVITsummon ))
        doCreatureAddHealth(pk, pct * vit * HPperVITsummon)
    end
                                                                      
    doRegainSpeed(pk)  

    local nick = getItemAttribute(item, "poke")

    if isGhostPokemon(pk) then
       setPlayerStorageValue(pk, 8981, 1)
       updateGhostWalk(pk)
    end
        

    if getItemAttribute(item, "nick") then
        nick = getItemAttribute(item, "nick")
    end

    setPlayerStorageValue(pk, 1007, nick)
    
    local lvl = getItemAttribute(item, "level") or 0
    nick = nick
    
    doCreatureSetNick(pk, nick)

    if not getItemAttribute(item, "happy") then
        doItemSetAttribute(item, "happy", 120)
    end

    if not getItemAttribute(item, "hunger") then
        doItemSetAttribute(item, "hunger", 5)
    end

    local happy = getItemAttribute(item, "happy")
        if happy < 0 then
            happy = 1
        end
    setPlayerStorageValue(pk, 1008, happy)

    local hunger = getItemAttribute(item, "hunger")
    setPlayerStorageValue(pk, 1009, hunger)

    if health == true then
        local mh = HPperVITsummon * getVitality(pk)
        local rd = 1 - (tonumber(getItemAttribute(item, "hp")))
        setCreatureMaxHealth(pk, mh)                                  
        doCreatureAddHealth(pk, getCreatureMaxHealth(pk))
        doCreatureAddHealth(pk, -(getCreatureMaxHealth(pk) * rd))
    end

    if isSummon(pk) and conditions then
        local burn = getItemAttribute(item, "burn")   
        if burn and burn >= 0 then
           local ret = {id = pk, cd = burn, check = false, damage = getItemAttribute(item, "burndmg"), cond = "Burn"}
           addEvent(doCondition2, 3500, ret)
        end

        local poison = getItemAttribute(item, "poison")
        if poison and poison >= 0 then
           local ret = {id = pk, cd = poison, check = false, damage = getItemAttribute(item, "poisondmg"), cond = "Poison"}
           addEvent(doCondition2, 1500, ret)
        end

        local confuse = getItemAttribute(item, "confuse")
        if confuse and confuse >= 0 then
           local ret = {id = pk, cd = confuse, check = false, cond = "Confusion"}
           addEvent(doCondition2, 1200, ret)                                                
        end

        local sleep = getItemAttribute(item, "sleep")
        if sleep and sleep >= 0 then
           local ret = {id = pk, cd = sleep, check = false, first = true, cond = "Sleep"}
           doCondition2(ret)
        end
        
        local miss = getItemAttribute(item, "miss")     
        if miss and miss >= 0 then      
          local ret = {id = pk, cd = miss, eff = getItemAttribute(item, "missEff"), check = false, spell = getItemAttribute(item, "missSpell"), cond = "Miss"}
          doCondition2(ret)
        end
        
        local fear = getItemAttribute(item, "fear")
        if fear and fear >= 0 then
           local ret = {id = pk, cd = fear, check = false, skill = getItemAttribute(item, "fearSkill"), cond = "Fear"}
           doCondition2(ret)
        end
        
        local silence = getItemAttribute(item, "silence")
        if silence and silence >= 0 then      
           local ret = {id = pk, cd = silence, eff = getItemAttribute(item, "silenceEff"), check = false, cond = "Silence"}
           doCondition2(ret)
        end                                     
        
        local stun = getItemAttribute(item, "stun")
        if stun and stun >= 0 then
           local ret = {id = pk, cd = stun, eff = getItemAttribute(item, "stunEff"), check = false, spell = getItemAttribute(item, "stunSpell"), cond = "Stun"}
           doCondition2(ret)
        end 
                                                       
        local paralyze = getItemAttribute(item, "paralyze")
        if paralyze and paralyze >= 0 then
           local ret = {id = pk, cd = paralyze, eff = getItemAttribute(item, "paralyzeEff"), check = false, first = true, cond = "Paralyze"}
           doCondition2(ret)
        end  
                                                     
        local slow = getItemAttribute(item, "slow")
        if slow and slow >= 0 then
           local ret = {id = pk, cd = slow, eff = getItemAttribute(item, "slowEff"), check = false, first = true, cond = "Slow"}
           doCondition2(ret)
        end                                              
        
        local leech = getItemAttribute(item, "leech")
        if leech and leech >= 0 then
           local ret = {id = pk, cd = leech, attacker = 0, check = false, damage = getItemAttribute(item, "leechdmg"), cond = "Leech"}
           doCondition2(ret)
        end                               
        
        for i = 1, 3 do
            local buff = getItemAttribute(item, "Buff"..i)
            if buff and buff >= 0 then
               local ret = {id = pk, cd = buff, eff = getItemAttribute(item, "Buff"..i.."eff"), check = false, 
               buff = getItemAttribute(item, "Buff"..i.."skill"), first = true, attr = "Buff"..i}
               doCondition2(ret)
            end
        end
               
    end
                                                                          --alterado v1.9
    if getItemAttribute(item, "boost") and getItemAttribute(item, "boost") >= 50 and getItemAttribute(item, "aura") then
       sendAuraEffect(pk, auraSyst[getItemAttribute(item, "aura")])        
    end
    
    if getPlayerStorageValue(getCreatureMaster(pk), 6598754) >= 1 then
        setPlayerStorageValue(pk, 6598754, 1)                               
    elseif getPlayerStorageValue(getCreatureMaster(pk), 6598755) >= 1 then
        setPlayerStorageValue(pk, 6598755, 1)
    end

return true
end

function setWildPokemonLevel(cid, optionalLevel, optionalStatus, optionalNick, optionalExtraExp)

    if not isCreature(cid) then return true end
    if not pokes[getCreatureName(cid)] then return true end  --alterado v2.6

    local levelRange = 0
    local off = 0
    local def = 0
    local agi = 0
    local spatk = 0
    local vit = 0
    local this = getCreatureName(cid)
    local ee = 1

    if optionalExtraExp then
        ee = optionalExtraExp
    end


    if optionalLevel and tonumber(optionalLevel) >= 1 then                --alterado v2.8\/
        levelRange = optionalLevel
    else
        levelRange = math.random(pokes[this].wildLvlMin, pokes[this].wildLvlMax) 
    end                                                                                          

    local status = getPokemonStatus(this)
        if status then
            off = status.off
            def = status.def
            agi = status.agi
            vit = status.vit
            spatk = status.spatk
        end

    setPlayerStorageValue(cid, 1000, (levelRange > 100 and 100 or levelRange)) --alterado v2.8

    if optionalStatus and optionalStatus.off then
        setPlayerStorageValue(cid, 1001, optionalStatus.offense)
        setPlayerStorageValue(cid, 1002, optionalStatus.defense)
        setPlayerStorageValue(cid, 1003, optionalStatus.agility)
        setPlayerStorageValue(cid, 1004, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1005, optionalStatus.specialattack)
        setPlayerStorageValue(cid, 1011, optionalStatus.offense)
        setPlayerStorageValue(cid, 1012, optionalStatus.defense)
        setPlayerStorageValue(cid, 1013, optionalStatus.agility)
        setPlayerStorageValue(cid, 1014, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1015, optionalStatus.specialattack)
    else
        setPlayerStorageValue(cid, 1001, 5 + math.random(off * levelRange * 0.9, off * levelRange * 1.8))
        setPlayerStorageValue(cid, 1002, 5 + math.random(def * levelRange * 0.9, def * levelRange * 1.8))
        setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.9, agi * levelRange * 1.8))
        setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.9, vit * levelRange * 1.8))
        setPlayerStorageValue(cid, 1005, 5 + math.random(spatk * levelRange * 0.9, spatk * levelRange * 1.8))
        setPlayerStorageValue(cid, 1011, getPlayerStorageValue(cid, 1001))
        setPlayerStorageValue(cid, 1012, getPlayerStorageValue(cid, 1002))
        setPlayerStorageValue(cid, 1013, getPlayerStorageValue(cid, 1003))
        setPlayerStorageValue(cid, 1014, getPlayerStorageValue(cid, 1004))
        setPlayerStorageValue(cid, 1015, getPlayerStorageValue(cid, 1005))
    end

    doRegainSpeed(cid)

    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + getPlayerStorageValue(cid, 1004) * HPperVIT * vitReductionForWild)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    
    if pokes[getCreatureName(cid)].exp then
        --getMonsterInfo(getCreatureName(cid)).experience
        local exp = (50 + pokes[getCreatureName(cid)].exp) * baseExpRate + pokes[getCreatureName(cid)].vitality * levelRange * pokemonExpPerLevelRate
        setPlayerStorageValue(cid, 1006, exp * generalExpRate * ee)
        if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)         --edited golden arena
       end  
    end

    local wildshow = wildBeforeNames and "Wild " or ""
    if optionalNick then
        if hideWildsLevel then
            doCreatureSetNick(cid, optionalNick)
        else
            doCreatureSetNick(cid, optionalNick.." ["..getWildPokemonLevel(cid).."]")
        end
    else
        if hideWildsLevel then
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).."")
        else
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).." ["..getWildPokemonLevel(cid).."]")
        end
    end
end

function getOffense(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1001))
end

function getDefense(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1002))
end

function getSpeed(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1003))
end

function getVitality(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1004))
end

function getSpecialAttack(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1005))
end

function getHappiness(cid)
    if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1008))
end

function getSpecialDefense(cid)
    if not isCreature(cid) then return 0 end
return getSpecialAttack(cid) * 0.85 + getDefense(cid) * 0.2      
end

function getPokemonLevel(cid, dex)
if not isCreature(cid) then return 0 end 
    if not dex then                      --alterado v1.9
       if ehMonstro(cid) and getPlayerStorageValue(cid, 1000) > 0 then  
          return getPlayerStorageValue(cid, 1000)
       elseif ehMonstro(cid) then 
          return pokes[getCreatureName(cid)].wildLvl             
       end
    end   
return pokes[getCreatureName(cid)].level
end

function getPokemonLevelByName(name)
return pokes[name] and pokes[name].level or 0  --alterado v1.9
end

function getMasterLevel(poke)
    if not isSummon(poke) then return 0 end
return getPlayerLevel(getCreatureMaster(poke))
end

function getPokemonBoost(poke)
    if not isSummon(poke) then return 0 end
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(poke), 8).uid, "boost") or 0
end

function getPokeballBoost(ball)
    if not isPokeball(ball.itemid) then return 0 end  --alterado v1.8
return getItemAttribute(ball.uid, "boost") or 0
end

function getPokeName(cid)
    if not isSummon(cid) then return getCreatureName(cid) end
    if getCreatureName(cid) == "Evolution" then return getPlayerStorageValue(cid, 1007) end
    
local item = getPlayerSlotItem(getCreatureMaster(cid), ?
    if getItemAttribute(item.uid, "nick") then
       return getItemAttribute(item.uid, "nick")
    end
return getCreatureName(cid)
end

function getPokeballName(item, truename)
if not truename and getItemAttribute(item, "nick") then
return getItemAttribute(item, "nick")
end
return getItemAttribute(item, "poke")
end

function getPokemonName(cid)
return getCreatureName(cid)
end

function getPokemonGender(cid) --alterado v1.9
return getCreatureSkullType(cid)
end

function setPokemonGender(cid, gender)
if isCreature(cid) and gender then        --alterado v1.8
   doCreatureSetSkullType(cid, gender)
   return true
end
return false
end

function getWildPokemonExp(cid)
return getPlayerStorageValue(cid, 1006)
end

 

Link para o comentário
Compartilhar em outros sites

  • 0

Mano deu esses 2 erros > image.png.9f1cd574802bef77e747a400fda3edc9.pngTem esse erro 

image.png.3648ebb3e861ab4b8c0c33d3c1d07cc4.png e esse.

Agora, Maiconmafrah disse:

Mano deu esses 2 erros > image.png.9f1cd574802bef77e747a400fda3edc9.pngTem esse erro 

image.png.3648ebb3e861ab4b8c0c33d3c1d07cc4.png e esse.

Meu spawn.lua 

Spoiler

local shinys = {
"Venusaur", "Charizard", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Zubat", "Golbat", "Paras", "Parasect",
"Venonat", "Venomoth", "Growlithe", "Arcanine", "Abra", "Alakazam", "Tentacool", "Tentacruel", "Farfetch'd", "Grimer", "Muk", "Gengar", "Onix", "Krabby",
"Kingler", "Voltorb", "Electrode", "Cubone", "Marowak", "Hitmonlee", "Hitmonchan", "Tangela", "Horsea", "Seadra", "Scyther", "Jynx", "Electabuzz", "Pinsir",
"Magikarp", "Gyarados", "Snorlax", "Dragonair", "Dratini"}
local raros = {"Dragonite"}                               

local function doSetRandomGender(cid)
    if not isCreature(cid) then return true end
    local gender = 0
    local name = getCreatureName(cid)
    if not newpokedex[name] then return true end
    local rate = newpokedex[name].gender
        if rate == 0 then
            gender = 3
        elseif rate == 1000 then
            gender = 4
        elseif rate == -1 then
            gender = 0
        elseif math.random(1, 1000) <= rate then
            gender = 4
        else
            gender = 3
        end
    doCreatureSetSkullType(cid, gender)
end

local function doShiny(cid)
if isCreature(cid) then
   if isSummon(cid) then return true end
   if getPlayerStorageValue(cid, 74469) >= 1 then return true end
   if getPlayerStorageValue(cid, 22546) >= 1 then return true end
   if isNpcSummon(cid) then return true end
   if getPlayerStorageValue(cid, 637500) >= 1 then return true end  --alterado v1.9
   
if isInArray(shinys, getCreatureName(cid)) then  --alterado v1.9 \/
   chance = 0.1    --1% chance        
elseif isInArray(raros, getCreatureName(cid)) then   --n coloquem valores menores que 0.1 !!
   chance = 0.1   --1% chance       
else
   return true
end    
    if math.random(1, 1000) <= chance*10 then  
      doSendMagicEffect(getThingPos(cid), 18)               
      local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid)
      doRemoveCreature(cid)
      local shi = doCreateMonster(name, pos, false)
      setPlayerStorageValue(shi, 74469, 1)      
   else
       setPlayerStorageValue(cid, 74469, 1)
   end                                        --/\
else                                                            
return true
end
end
                                                                
function onSpawn(cid)

    registerCreatureEvent(cid, "Experience")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "DirectionSystem")
    registerCreatureEvent(cid, "CastSystem")
    
    if isSummon(cid) then
        registerCreatureEvent(cid, "SummonDeath")
    return true
    end
    
    addEvent(doSetRandomGender, 5, cid)
    addEvent(doShiny, 1, cid)
    addEvent(adjustWildPoke, 5, cid)

return true
end

 

Link para o comentário
Compartilhar em outros sites

  • 0

Mesmo assim ainda continua dando erro no spawn.lua tem lugar que você coloca > ? isso ai da erro

image.png.76d42a4f9cc7124574eebf4410a6e5c2.png

Editado por Maiconmafrah
Link para o comentário
Compartilhar em outros sites

  • 0
6 horas atrás, Maiconmafrah disse:

Mesmo assim ainda continua dando erro no spawn.lua tem lugar que você coloca > ? isso ai da erro

image.png.76d42a4f9cc7124574eebf4410a6e5c2.png

O Erro que está dando no spawn.lua não é por isso que as vezes acaba bugando "?é simplesmente pelo fato de que a chamada da função isSummon está passando valor nulo.

Link para o comentário
Compartilhar em outros sites

  • 0
Em 02/10/2018 em 18:05, DarkWore disse:

O Erro que está dando no spawn.lua não é por isso que as vezes acaba bugando "?é simplesmente pelo fato de que a chamada da função isSummon está passando valor nulo.

E pq o Forum ta adc um emojin no script e ta bugando o level system.lua

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...