Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
- local orig = player:getPosition()
- local nameplayer = player:getName()
- local x = 1
- local pokes = {
- ["Rat"] = {hp = 3000, maxhp = 3000, corpse = 5964, chance = 20, storage = 1031},
- ["Dragon"] = {hp = 10000, maxhp = 10000, corpse = 5973, chance = 20, storage = 1030},
- }
- for pokename, v in pairs(pokes) do
- local catchtry = player:getStorageValue(v.storage)
- if itemEx:getId() == v.corpse then
- if math.random(1, 100) <= v.chance then
- local catch = true
- itemEx:remove(1)
- item:remove(1)
- orig:sendMagicEffect(22)
- local pokeball = player:addItem(2650, 1)
- pokeball:setAttribute("text", ""..pokename.."")
- pokeball:setAttribute("defense", ""..v.hp.."")
- pokeball:setAttribute("attack", ""..v.maxhp.."")
- --pokeball:setAttribute("description", ""..pokename.."/"..v.hp.."/"..v.maxhp.."/Live")
- player:say("Parabens, voce capturou um "..pokename..".", TALKTYPE_MONSTER_SAY)
- player:say("Você gastou "..catchtry.." pokeballs para capturar um "..pokename..".", TALKTYPE_MONSTER_SAY)
- if catch == true then
- player:setStorageValue(v.storage, 1)
- return true
- end
- else
- player:say("Que pena, eu nao capturei o Pokemon ;/", TALKTYPE_MONSTER_SAY)
- itemEx:remove(1)
- local catchtimes = catchtry + x
- player:setStorageValue(v.storage, 1)
- player:setStorageValue(v.storage, catchtimes)
- item:remove(1)
- orig:sendMagicEffect(22)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement