Ir para conteúdo

ADICIONAR CHANCE NAS BALLS ESPECIAIS


Posts Recomendados

GALERA estou colocando balls especiais no meu servidor  (magu , moon , tinker )  esta tudo certo  sprites  efeito e tudo mais , só que nao estou conseguindo por pra ter mais chance com tal pokemon

esta dando esse erro 

 

 

data/actions/scripts/catch.lua:1: attempt to index global 'x' (a nil value)

 

 

 

esse é meu catch.lua

maguchance = 3.5 * x.chance 
local ballcatch = {                    --id normal, id da ball shiy
[2394] = {cr = 10, on = 193, off = 192, ball = {11826, 11737}, send = 47, typeee = "normal", boost = "0"},  --alterado v1.9  \/
[2391] = {cr = 12, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great", boost = "0"},
[2393] = {cr = 14, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super", boost = "0"},
[2392] = {cr = 22, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra", boost = "0"},
[14299] = {cr = 24, on = 200, off = 199, ball = {11829, 11746}, send = 50, typeee = "mega", boost = "0"},
[12617] = {cr = 16, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari", boost = "0"}, 
[12832] = {cr = 100000, on = 196, off = 196, ball = {12826, 12829}, send = 181, typeee = "dark", boost = "50"},

    [24889] = {cr = 22, on = 705, off = 706, ball = {25019, 24991}, send = 707, typeee = "magu", boost = "0", type = {"fire", "ground"}},
	[24888] = {cr = 22, on = 708, off = 709, ball = {16182, 24992}, send = 711, typeee = "sora", boost = "0", type = {"ice", "flying"}},
	[24890] = {cr = 22, on = 711, off = 712, ball = {16183, 24993}, send = 714, typeee = "yume", boost = "0", type = {"normal", "psychic"}},
	[24892] = {cr =22, on = 714, off = 715, ball = {16184, 24994}, send = 717, typeee = "dusk", boost = "0", type = {"rock", "fighting"}},
	[24885] = {cr = 22, on = 723, off = 724, ball = {16187, 24997}, send = 726, typeee = "tale", boost = "0", type = {"dragon", "fairy"}},
	[24886] = {cr = 22, on = 726, off = 727, ball = {16188, 24998}, send = 729, typeee = "moon", boost = "0", type = {"dark", "ghost"}},
	[24887] = {cr = 22, on = 729, off = 730, ball = {16189, 24999}, send = 732, typeee = "net", boost = "0", type = {"bug", "water"}},
	[24893] = {cr = 22, on = 700, off = 701, ball = {16192, 25002}, send = 703, typeee = "tinker", boost = "0", type = {"electric", "steel"}},
	[24924] = {cr = 22, on = 732, off = 733, ball = {24922, 24923}, send = 735, typeee = "janguru", boost = "0", type = {"electric", "steel"}},
	
	[24891] = {cr = 22, on = 735, off = 736, ball = {16191, 25001}, send = 738, typeee = "premier", boost = "0"},
	
	[24894] = {cr = 22, on = 717, off = 718, ball = {16185, 24995}, send = 720, typeee = "fast", boost = "0", pokes = {"Shiny Dodrio", "Dodrio", "Shiny Arcanine", "Arcanine", "Pikachu", "Raichu", "Shiny Raichu", "Beedrill", "Shiny Beedrill"}},
	[24884] = {cr = 22, on = 720, off = 721, ball = {16186, 24996}, send = 723, typeee = "heavy", boost = "0", pokes = {"Snorlax", "Venusaur", "Blastoise", "Rhydon", "Shiny Snorlax", "Shiny Venusaur", "Shiny Blastoise", "Shiny Rhydon", "Graveler", "Golem", "Shiny Golem", "Lapras"}},
}

local cd = 2

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

setPlayerStorageValue(cid, 912351, os.time () + cd)

if getPlayerStorageValue(cid, 912352) > os.time () then
		doPlayerSendCancel(cid, "Espere "..getPlayerStorageValue(cid, 912352) - os.time ().." segundo(s) para usar novamente")
		return true
		end

local item2 = getTopCorpse(topos)
if item2 == null then
   return true
end

if getItemAttribute(item2.uid, "catching") == 1 then
   return true
end  

if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
   return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")   
end

local name = string.lower(getItemNameById(item2.itemid))
      name = string.gsub(name, "fainted ", "")
      name = string.gsub(name, "defeated ", "")
      name = doCorrectPokemonName(name)
local x = pokecatches[name]

if not x then return true end

local shinys = {"Shiny Aerodactyl","Shiny Snorlax","Shiny Abra","Shiny Aggron","Shiny Alakazam",
"Shiny Ampharos","Shiny Arcanine","Shiny Ariados","Shiny Azumarill","Shiny Beedrill","Shiny Blastoise","Shiny Blaziken",
"Shiny Bronzong","Shiny Butterfree","Shiny Charizard","Shiny Charizard","Shiny Cubone","Shiny Cubone","Shiny Dodrio",
"Shiny Dragonair","Shiny Dragonite","Shiny Dratini","Shiny Electabuzz","Shiny Electrode","Shiny Emboar",
"Shiny Espeon","Shiny Farfetch'd","Shiny Fearow","Shiny Feraligatr","Shiny Flareon","Shiny Flygon","Shiny Gardevoir",
"Shiny Gengar","Shiny Giant Magikarp","Shiny Golbat","Shiny Golem","Shiny Grimer","Shiny Growlithe","Shiny Gyarados",
"Shiny Hitmonchan","Shiny Hitmonlee","Shiny Hitmontop","Shiny Horsea","Shiny Houndoom","Shiny Hydreigon","Shiny Hypno",
"Shiny Jolteon","Shiny Jynx","Shiny Kabutops","Shiny Kingdra","Shiny Kingler","Shiny Krabby","Shiny Lanturn","Shiny Larvitar",
"Shiny Lucario","Shiny Ludicolo","Shiny Machamp","Shiny Magcargo","Shiny Magikarp","Shiny Magmar",
"Shiny Magneton","Shiny Mantine","Shiny Marowak","Shiny Meganium","Shiny Megenium","Shiny Milotic",
"Shiny Miltank","Shiny Mr. Mime","Shiny MrMime","Shiny Muk","Shiny Nidoking","Shiny Ninetales","Shiny Oddish","Shiny Onix",
"Shiny Paras","Shiny Parasect","Shiny Pidgeot","Shiny Pinsir","Shiny Politoed","Shiny Porygon","Shiny Porygon2",
"Shiny Pupitar","Shiny Raichu","Shiny Rapidash","Shiny Raticate","Shiny Rattata","Shiny Rhydon","Shiny Sandslash","Shiny Sceptile","Shiny Scizor","Shiny Scyther","Shiny Seadra","Shiny Shedinja",
"Shiny Skarmory","Shiny Slaking","Shiny Slowking","Shiny Stantler","Shiny Steelix","Shiny Sudowoodo","Shiny Swampert",
"Shiny Swellow","Shiny Tangela","Shiny Tauros","Shiny Tentacool","Shiny Tentacruel",
"Shiny Torterra","Shiny Tropius","Shiny Typhlosion","Shiny Tyranitar","Shiny Umbreon","Shiny Vaporeon","Shiny Venomoth",
"Shiny Venonat","Shiny Venusaur","Shiny Vileplume","Shiny Voltorb","Shiny Weezing","Shiny Wobbuffet","Shiny Xatu",
"Shiny Zoroark","Shiny Zubat","Aerodactyl","Mewtwo","Mew","Articuno",
"Zaptos","Moltres","Entei","Suicune","Raikou","Ho-oh","Lugia","Celebi","Regirock","Regice","Registeel","Regigigas",
"Latias","Latios","Groudon","Kyogre","Rayquaza","Jirachi","Deoxys","Uxie","Mesprit","Azelf","Dialga","Palkia","Giratina",
"Cresselia","Darkai","Manaphy","Heatran","Shaymin","Arceus","Victini","Virizion","Keldeo","Tornadus","Thundurus","Landorus",
"Zekrom","Reshiram","Kyurem","Meloetta","Genesect","Abomasnow"}
if item.itemid == 12832 and isInArray(shinys, name) then
   doPlayerSendCancel(cid, "Você não pode capturar esse pokemon com a master ball!")
return true
end

if item.itemid == 12832 and isInArray(shinys, name) then
   doPlayerSendCancel(cid, "Você não pode capturar esse shiny com a master ball!")
return true
end
	
local storage = newpokedex[name].stoCatch 

if type(getPlayerStorageValue(cid, storage)) ~= "string" or not string.find(getPlayerStorageValue(cid, storage), "magu") then  --alterado v1.9 

   setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0, dark = 0, magu = 0, sora = 0, yume = 0, dusk = 0, tale = 0, moon = 0, net = 0, premier = 0, tinker = 0, fast = 0, heavy = 0;")             --alterado v1.9 

end    

local owner = getItemAttribute(item2.uid, "corpseowner")
	
if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then   
   doPlayerSendCancel(cid, "Voce nao pode tentar capturar esse pokemon pois nao o matou.")
   return true
end

local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v1.9       
local typeee = ballcatch[item.itemid].typeee
local boost = ballcatch[item.itemid].boost

local catchinfo = {}
       
      catchinfo.rate = ballcatch[item.itemid].cr
      catchinfo.catch = ballcatch[item.itemid].on
      catchinfo.fail = ballcatch[item.itemid].off
      catchinfo.newid = newidd                      
      catchinfo.name = doCorrectPokemonName(name)
      catchinfo.topos = topos
      catchinfo.chance = x.chance
	  
	  if item.itemid == 24889 and (pokes[name].type == "fire" or pokes[name].type2 == "ground") then
    catchinfo.chance = maguchance 
	
  doBrokesCount(cid, newpokedex[doCorrectPokemonName(name)].stoCatch , typeee)
  
doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
doRemoveItem(item.uid, 1)
  
	  end


local d = getDistanceBetween(getThingPos(cid), topos)
		
if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then  --alterado v1.9
   setPlayerStorageValue(cid, 98796, -1) 
   setPlayerStorageValue(cid, 98797, -1)                                              
   doTeleportThing(cid, SafariOut, false)
   doSendMagicEffect(getThingPos(cid), 21)
   doPlayerSendTextMessage(cid, 27, "You spend all your saffari balls, good luck in the next time...")
end

	local catchBlocks = {"Milotic","Shiny Milotic","Togekiss","Magnezone","Dusknoir","Gliscor","lickilicky",
	 "Porygon-Z","Porygonz","Probopass","Weavile","Yanmega","Froslass","Mamoswine","Tangrowth","Shiny Togekiss","Shiny Tangrowth","Rhyperior",
	 "Gallade","Magmortar","Shiny Magmortar","Shiny Electivire","Electivire","Shiny Rhyperior","Lickilicky","Shiny Salamence",
	 "Salamence","Virus Gallade","Virus Magnezone","Virus Rhyperior","Virus Slaking","Virus Salamence","Virus Rhydon",
	 "Virus Zubat","Virus Zoroark","Virus Xatu","Virus Wooper","Virus Vulpix","Virus Voltorb","Virus Venusaur",
	 "Virus Tyranitar","Virus Togekiss","Virus Steelix","Virus Spiritomb","Virus Hydreigon","Virus Haxorus","Virus Gyarados",
	 "Virus Golurk","Virus Geodude","Virus Gastly","Virus Pineco","Virus Pidgey","Virus Metagross",
	 "Virus Magmortar","Virus Magikarp","Virus Machop","Virus Machamp","Virus Lucario","Virus Lucario","Virus Aron",
	 "Virus Alakazam","Virus Flygon","Virus Electivire","Virus Ekans","Virus Eevee","Virus Dragonite",
	 "Virus Charizard","Virus Caterpie","Virus Bronzong","Virus Blissey","Virus Blastoise","Virus Oddish","Virus Poliwag",}
	if isInArray(catchBlocks, name) then
	    doPlayerSendCancel(cid, "Este pokemon esta com o catch desabilitado!")
		return true
	end

addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee) 
addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
return true
end

 

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

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