Mam problem z kilkoma pokemonami poniewa? nie chc? si? ?apa?, reszta dzia?a normalnie.
catch.lua :
Nie dzia?a :Nidoking, Nidoqueen, Cloyster, Nidoran male i female.
Tu dla przyk?adu Nidoking :
catch.lua :
Kod:
local pokes = {
["Magikarp"] = {chance = 2, corpse = 2818, health = 120, maxhealth = 120},
["Abra"] = {chance = 59, corpse = 2905, health = 620, maxhealth = 620},
["Kadabra"] = {chance = 142, corpse = 6060, health = 2500, maxhealth = 2500},
["Alakazam"] = {chance = 241, corpse = 6057, health = 2500, maxhealth = 2500},
["Rattata"] = {chance = 8, corpse = 5974, health = 350, maxhealth = 350},
["Raticate"] = {chance = 16, corpse = 6007, health = 900, maxhealth = 900},
["Pidgey"] = {chance = 11, corpse = 5961, health = 380, maxhealth = 380},
["Pidgeotto"] = {chance = 26, corpse = 5966, health = 1400, maxhealth = 1400},
["Pidgeot"] = {chance = 167, corpse = 6020, health = 3800, maxhealth = 3800},
["Zubat"] = {chance = 15, corpse = 5989, health = 450, maxhealth = 450},
["Golbat"] = {chance = 53, corpse = 6053, health = 1900, maxhealth = 1900},
["Bellsprout"] = {chance = 13, corpse = 2806, health = 420, maxhealth = 420},
["Weepinbell"] = {chance = 28, corpse = 2928, health = 1100, maxhealth = 1100},
["Victreebel"] = {chance = 140, corpse = 6332, health = 4000, maxhealth = 4000},
["Poliwag"] = {chance = 8, corpse = 6042, health = 400, maxhealth = 400},
["Poliwhirl"] = {chance = 29, corpse = 6054, health = 1200, maxhealth = 1200},
["Poliwrath"] = {chance = 186, corpse = 6033, health = 4400, maxhealth = 4400},
["Oddish"] = {chance = 7, corpse = 3008, health = 340, maxhealth = 340},
["Gloom"] = {chance = 25, corpse = 6017, health = 1400, maxhealth = 1400},
["Vileplume"] = {chance = 133, corpse = 6025, health = 3300, maxhealth = 3300},
["Horsea"] = {chance = 10, corpse = 2973, health = 300, maxhealth = 300},
["Seadra"] = {chance = 87, corpse = 2872, health = 2500, maxhealth = 2500},
["Grimer"] = {chance = 14, corpse = 6055, health = 600, maxhealth = 600},
["Weedle"] = {chance = 3, corpse = 5964, health = 325, maxhealth = 325},
["Kakuna"] = {chance = 18, corpse = 6000, health = 900, maxhealth = 900},
["Beedrill"] = {chance = 40, corpse = 5990, health = 1900, maxhealth = 1900},
["Muk"] = {chance = 55, corpse = 2845, health = 2400, maxhealth = 2400},
["Doduo"] = {chance = 16, corpse = 2842, health = 600, maxhealth = 600},
["Dodrio"] = {chance = 79, corpse = 6047, health = 2650, maxhealth = 2650},
["Magnemite"] = {chance = 19, corpse = 6056, health = 450, maxhealth = 450},
["Magneton"] = {chance = 70, corpse = 6076, health = 1750, maxhealth = 1750},
["Voltorb"] = {chance = 13, corpse = 6049, health = 620, maxhealth = 620},
["Electrode"] = {chance = 60, corpse = 6051, health = 2000, maxhealth = 2000},
["Geodude"] = {chance = 17, corpse = 6071, health = 700, maxhealth = 700},
["Graveler"] = {chance = 105, corpse = 6516, health = 3000, maxhealth = 3000},
["Golem"] = {chance = 205, corpse = 6043, health = 6500, maxhealth = 6500},
["Sandshrew"] = {chance = 16, corpse = 5988, health = 700, maxhealth = 700},
["Sandslash"] = {chance = 160, corpse = 6041, health = 3400, maxhealth = 3400},
["Charmander"] = {chance = 20, corpse = 5983, health = 970, maxhealth = 970},
["Charmeleon"] = {chance = 73, corpse = 5981, health = 2900, maxhealth = 2900},
["Charizard"] = {chance = 261, corpse = 6005, health = 5200, maxhealth = 5200},
["Aerodactyl"] = {chance = 1000, corpse = 6338, health = 7100, maxhealth = 7100},
["Arcanine"] = {chance = 205, corpse = 6031, health = 6000, maxhealth = 6000},
["Articuno"] = {chance = 1000, corpse = 7256, health = 20000, maxhealth = 20000},
["Blastoise"] = {chance = 261, corpse = 5999, health = 9000, maxhealth = 9000},
["Bulbasaur"] = {chance = 57, corpse = 5969, health = 700, maxhealth = 700},
["Butterfree"] = {chance = 87, corpse = 5985, health = 2500, maxhealth = 2500},
["Caterpie"] = {chance = 3, corpse = 5971, health = 200, maxhealth = 200},
["Chansey"] = {chance = 261, corpse = 6010, health = 1800, maxhealth = 1800},
["Cubone"] = {chance = 36, corpse = 6050, health = 700, maxhealth = 700},
["Clefable"] = {chance = 136, corpse = 6006, health = 1500, maxhealth = 1500},
["Clefairy"] = {chance = 32, corpse = 2968, health = 1400, maxhealth = 1400},
["Cloyster"] = {chance = 134, corpse = 2935, health = 4500, maxhealth = 4500},
["Crystal Onix"] = {chance = 501, corpse = 6320, health = 18000, maxhealth = 18000},
["Dratini"] = {chance = 75, corpse = 2879, health = 2000, maxhealth = 2000},
["Dewgong"] = {chance = 184, corpse = 6038, health = 4500, maxhealth = 4500},
["Diglett"] = {chance = 31, corpse = 6023, health = 470, maxhealth = 470},
["Ditto"] = {chance = 520, corpse = 2817, health = 2500, maxhealth = 2500},
["Dragonair"] = {chance = 261, corpse = 6002, health = 3000, maxhealth = 3000},
["Dragonite"] = {chance = 306, corpse = 4295, health = 9900, maxhealth = 9900},
["Mew"] = {chance = 61, corpse = 2939, health = 50000, maxhealth = 50000},
["Mewtwo"] = {chance = 61, corpse = 5973, health = 10000, maxhealth = 10000},
["Moltres"] = {chance = 61, corpse = 7330, health = 20000, maxhealth = 20000},
["Scyther"] = {chance = 61, corpse = 3002, health = 7000, maxhealth = 7000},
["Zapdos"] = {chance = 61, corpse = 6074, health = 20000, maxhealth = 20000},
["Mr.mime"] = {chance = 61, corpse = 6069, health = 3500, maxhealth = 3500},
["Eevee"] = {chance = 61, corpse = 6364, health = 1500, maxhealth = 1500},
["Drowzee"] = {chance = 61, corpse = 6026, health = 1200, maxhealth = 1200},
["Dugtrio"] = {chance = 61, corpse = 6024, health = 3220, maxhealth = 3220},
["Gengar"] = {chance = 61, corpse = 6336, health = 6000, maxhealth = 6000},
["Elder Charizard"] = {chance = 261, corpse = 2954, health = 11500, maxhealth = 11500},
["Electabuzz"] = {chance = 61, corpse = 6065, health = 7500, maxhealth = 7500},
["Exeggcute"] = {chance = 21, corpse = 2982, health = 350, maxhealth = 350},
["Exeggutor"] = {chance = 61, corpse = 3005, health = 4500, maxhealth = 4500},
["Farfetchd"] = {chance = 61, corpse = 2836, health = 4400, maxhealth = 4400},
["Fearow"] = {chance = 61, corpse = 5992, health = 2500, maxhealth = 2500},
["Flareon"] = {chance = 21, corpse = 6059, health = 5100, maxhealth = 5100},
["Gastly"] = {chance = 61, corpse = 5993, health = 5200, maxhealth = 5200},
["Golduck"] = {chance = 261, corpse = 6028, health = 3880, maxhealth = 3880},
["Ekans"] = {chance = 34, corpse = 5979, health = 425, maxhealth = 425},
["Arbok"] = {chance = 56, corpse = 5984, health = 2300, maxhealth = 2300},
["Hitmonlee"] = {chance = 56, corpse = 6067, health = 5200, maxhealth = 5200},
["Goldeen"] = {chance = 56, corpse = 2970, health = 185, maxhealth = 185},
["Growlithe"] = {chance = 56, corpse = 6036, health = 1600, maxhealth = 1600},
["Gyarados"] = {chance = 56, corpse = 6331, health = 6000, maxhealth = 6000},
["Haunter"] = {chance = 56, corpse = 6004, health = 2400, maxhealth = 2400},
["Hitmonchan"] = {chance = 56, corpse = 5977, health = 5200, maxhealth = 5200},
["Hypno"] = {chance = 56, corpse = 6046, health = 3005, maxhealth = 3005},
["Ivysaur"] = {chance = 56, corpse = 5982, health = 3000, maxhealth = 3000},
["Jigglypuff"] = {chance = 56, corpse = 6011, health = 1220, maxhealth = 1220},
["Jolteon"] = {chance = 56, corpse = 6044, health = 4500, maxhealth = 4500},
["Jynx"] = {chance = 56, corpse = 5765, health = 5000, maxhealth = 5000},
["Kabuto"] = {chance = 56, corpse = 5972, health = 1675, maxhealth = 1675},
["Kabutops"] = {chance = 56, corpse = 6345, health = 3020, maxhealth = 3020},
["Kangaskhan"] = {chance = 56, corpse = 6073, health = 3000, maxhealth = 3000},
["Kingler"] = {chance = 56, corpse = 6340, health = 2750, maxhealth = 2750},
["Koffing"] = {chance = 56, corpse = 5935, health = 700, maxhealth = 700},
["Mankey"] = {chance = 56, corpse = 6035, health = 800, maxhealth = 800},
["Krabby"] = {chance = 56, corpse = 6039, health = 600, maxhealth = 600},
["Lapras"] = {chance = 56, corpse = 6018, health = 7000, maxhealth = 7000},
["Lickitung"] = {chance = 56, corpse = 5953, health = 2350, maxhealth = 2350},
["Machamp"] = {chance = 56, corpse = 6048, health = 6100, maxhealth = 6100},
["Machoke"] = {chance = 56, corpse = 4251, health = 2850, maxhealth = 2850},
["Machop"] = {chance = 56, corpse = 6045, health = 425, maxhealth = 425},
["Magmar"] = {chance = 56, corpse = 7283, health = 7000, maxhealth = 7000},
["Omastar"] = {chance = 56, corpse = 5994, health = 4500, maxhealth = 4500},
["Marowak"] = {chance = 56, corpse = 6072, health = 3050, maxhealth = 3050},
["Meowth"] = {chance = 56, corpse = 6034, health = 500, maxhealth = 500},
["Metapod"] = {chance = 56, corpse = 5970, health = 1405, maxhealth = 1405},
["Nidoking"] = {chance = 56, corpse = 5995, health = 4200, maxhealth = 4200},
["Nidoqueen"] = {chance = 56, corpse = 3004, health = 6445, maxhealth = 6445},
["Nidoran Female"] = {chance = 56, corpse = 6013, health = 245, maxhealth = 245},
["Nidoran Male"] = {chance = 56, corpse = 6015, health = 300, maxhealth = 300},
["Nidorina"] = {chance = 56, corpse = 6014, health = 2135, maxhealth = 2135},
["Nidorino"] = {chance = 56, corpse = 6019, health = 3000, maxhealth = 3000},
["Ninetales"] = {chance = 56, corpse = 6040, health = 2650, maxhealth = 2650},
["Omanyte"] = {chance = 56, corpse = 5998, health = 500, maxhealth = 500},
["Ponyta"] = {chance = 56, corpse = 5975, health = 660, maxhealth = 660},
["Porygon"] = {chance = 56, corpse = 5963, health = 3000, maxhealth = 3000},
["Primeape"] = {chance = 56, corpse = 6032, health = 2550, maxhealth = 2550},
["Onix"] = {chance = 56, corpse = 2990, health = 2800, maxhealth = 2800},
["Paras"] = {chance = 56, corpse = 3007, health = 200, maxhealth = 200},
["Parasect"] = {chance = 56, corpse = 6027, health = 2000, maxhealth = 2000},
["Persian"] = {chance = 56, corpse = 6009, health = 2000, maxhealth = 2000},
["Pikachu"] = {chance = 56, corpse = 6001, health = 1250, maxhealth = 1250},
["Pinsir"] = {chance = 56, corpse = 7282, health = 2205, maxhealth = 2205},
["Raichu"] = {chance = 56, corpse = 5996, health = 3500, maxhealth = 3500},
["Rapidash"] = {chance = 56, corpse = 4323, health = 8000, maxhealth = 8000},
["Rhydon"] = {chance = 56, corpse = 2858, health = 4200, maxhealth = 4200},
["Rhyhorn"] = {chance = 56, corpse = 3035, health = 2900, maxhealth = 2900},
["Psyduck"] = {chance = 56, corpse = 6029, health = 330, maxhealth = 330},
["Snorlax"] = {chance = 56, corpse = 6016, health = 9000, maxhealth = 9000},
["Seaking"] = {chance = 56, corpse = 3038, health = 685, maxhealth = 685},
["Seel"] = {chance = 56, corpse = 6030, health = 515, maxhealth = 515},
["Shellder"] = {chance = 56, corpse = 2837, health = 300, maxhealth = 300},
["Slowbro"] = {chance = 56, corpse = 5986, health = 2000, maxhealth = 2000},
["Slowpoke"] = {chance = 56, corpse = 2926, health = 800, maxhealth = 800},
["Staryu"] = {chance = 56, corpse = 5987, health = 875, maxhealth = 875},
["Tangela"] = {chance = 56, corpse = 5976, health = 4700, maxhealth = 4700},
["Tauros"] = {chance = 56, corpse = 6302, health = 2400, maxhealth = 2400},
["Tentacool"] = {chance = 56, corpse = 5961, health = 725, maxhealth = 725},
["Tentacruel"] = {chance = 56, corpse = 6037, health = 10100, maxhealth = 10100},
["Vaporeon"] = {chance = 56, corpse = 5960, health = 4500, maxhealth = 4500},
["Wigglytuff"] = {chance = 56, corpse = 6012, health = 1600, maxhealth = 1600},
["Venomoth"] = {chance = 56, corpse = 2920, health = 1380, maxhealth = 1380},
["Venonat"] = {chance = 56, corpse = 5997, health = 300, maxhealth = 300},
["Venusaur"] = {chance = 56, corpse = 5962, health = 10000, maxhealth = 10000},
["Vulpix"] = {chance = 56, corpse = 6003, health = 600, maxhealth = 600},
["Wartotle"] = {chance = 56, corpse = 5978, health = 2300, maxhealth = 2300},
["Weezing"] = {chance = 56, corpse = 6306, health = 1250, maxhealth = 1250},
}
local description = "Contains a %pokename."
function onUse(cid, item, frompos, item2, topos)
local name = getItemNameById(item2.itemid)
if item.itemid == 2147 then
catchrate = 1
oncatch = 24
onfail = 23
bolabola = 2222
elseif item.itemid == 2146 then
catchrate = 100
oncatch = 200
onfail = 199
bolabola = 2220
end
local rate = (catchrate)
local catch = oncatch
local fail = onfail
local newid = bolabola
for i,x in pairs(pokes) do
if getItemNameById(item2.itemid):find(i:lower()) then
if getItemIdByName(name) == pokes[i].corpse then
if cid ~= getItemAttribute(item2.uid, "corpseowner") and isInArray({1,8}, getPlayerGroupId(cid)) then
doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
return true
end
doRemoveItem(item.uid, 1)
doRemoveItem(item2.uid, 1)
local pegar = math.random(0, x.chance)
if pegar <= 1*(rate) then
doSendMagicEffect(topos, catch)
local nas = {
["%%pokename"] = i
}
for i,x in pairs(nas) do
if description:find(i) then
description = description:gsub(i, x)
end
end
local function capturou(params)
if not isCreature(params.cid) then
return true
end
if not string.find(getPlayerStorageValue(cid, 54842), ""..i..",") then
doPlayerAddSoul(cid, 1)
setPlayerStorageValue(cid, 54842, getPlayerStorageValue(cid, 54842)..""..i..", ")
end
if getPlayerFreeCap(cid) <= 0.99 then
item = doCreateItemEx(newid-1)
doItemSetAttribute(item, "poke", params.poke)
doItemSetAttribute(item, "nome", params.nome)
doItemSetAttribute(item, "description", params.description)
doPlayerSendMailByName(getCreatureName(params.cid), item, 1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")
else
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "poke", params.poke)
doItemSetAttribute(item, "nome", params.nome)
doItemSetAttribute(item, "description", params.description)
doPlayerAddItemEx(params.cid, item, true)
doTransformItem(item, newid)
doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
end
if #getCreatureSummons(cid) >= 1 then
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)
else
doSendMagicEffect(getThingPos(cid), 178)
end
end
local description = "Contains a "..i.."."
local poke1 = "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]"
addEvent(capturou, 4000, {cid = cid, poke = poke1, nome = i, description = description, ball = 2219, letter = 2597})
else
function ruim(params)
if not isCreature(params.cid) then
return true
end
doPlayerSendTextMessage(params.cid, 27, "Sorry, you didn\'t catch that pokemon.")
if #getCreatureSummons(params.cid) >= 1 then
doSendMagicEffect(getThingPos(getCreatureSummons(params.cid)[1]), 166)
else
doSendMagicEffect(getThingPos(params.cid), 166)
end
end
addEvent(ruim, 4000, {cid = cid})
doSendMagicEffect(topos, fail)
end
end
end
end
return TRUE
end
Tu dla przyk?adu Nidoking :
Kod:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Nidoking" nameDescription="a Nidoking" race="undead" experience="3000" speed="275" manacost="10000">
<health now="4200" max="4200"/>
<look type="35" corpse="5995"/>
<targetchange interval="5" chance="1000"/>
<strategy attack="90" defense="10"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="100" attack="110"/>
<attack name="ing" interval="6500" chance="100" range="1" target="1" min="-0" max="-3000">
</attack>
<attack name="hit" interval="3500" chance="100" range="1" target="1" min="-330" max="-500">
</attack>
</attacks>
<defenses armor="55" defense="55">
</defenses>
<voices interval="5000" chance="10">
<voice sentence="Nidooking!" yell="1"/>
</voices>
<loot>
<item id="3976" countmax="100" chance="10000"/><!-- Pot of moss bug -->
</loot>
</monster>