Por ploshvisk, 18 de dez. de 2010 em Archived
info
Grupo: Campones
Registrado: 16/10/10
Posts: 30
Reputação: +2
Olá, estou com um problema com o script do Matheus Mkalo da Nurse Joy. Queria que ao invés de ele pegar o maxhealth do atributo da pokebola (poke) pegasse da table que eu fiz. Porque assim evitaria os bugs que acontecem no Go/Back.
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local pokes = { ["Zubat"] = {maxh = 642}, ["Zapdos"] = {maxh = 100}, ["Wygglypuff"] = {maxh = 100}, ["Wigglytuff"] = {maxh = 4000}, ["Weezing"] = {maxh = 3450}, ["Weepinbell"] = {maxh = 1280}, ["Weedle"] = {maxh = 291}, ["Wartortle"] = {maxh = 4115}, ["Vulpix"] = {maxh = 1200}, ["Voltorb"] = {maxh = 1000}, ["Vileplume"] = {maxh = 4100}, ["Victribell"] = {maxh = 3850}, ["Venusaur"] = {maxh = 11170}, ["Venonat"] = {maxh = 1250}, ["Venomoth"] = {maxh = 3950}, ["Vaporeon"] = {maxh = 100}, ["Tentacruel"] = {maxh = 8200}, ["Tentacool"] = {maxh = 914}, ["Tauros"] = {maxh = 4100}, ["Tangela"] = {maxh = 4060}, ["Staryu"] = {maxh = 1000}, ["Starmie"] = {maxh = 3850}, ["Squirtle"] = {maxh = 1600}, ["Spearow"] = {maxh = 642}, ["Snorlax"] = {maxh = 15350}, ["Slowpoke"] = {maxh = 1280}, ["Slowbro"] = {maxh = 4020}, ["Shellder"] = {maxh = 968}, ["Seel"] = { maxh = 1470}, ["Seaking"] = {maxh = 2315}, ["Seadra"] = {maxh = 900}, ["Scyther"] = {maxh = 6810}, ["Sandslash"] = {maxh = 5700}, ["Sandshrew"] = {maxh = 1019}, ["Rhyhorn"] = {maxh = 1750}, ["Rhydon"] = {maxh = 5115}, ["Rattata"] = {maxh = 291}, ["Raticate"] = {maxh = 1300}, ["Rapidash"] = {maxh = 5020}, ["Raichu"] = {maxh = 4115}, ["Psyduck"] = {maxh = 1210}, ["Primeape"] = {maxh = 4760}, ["Porygon"] = {maxh = 100}, ["Ponyta"] = {maxh = 980}, ["Poliwrath"] = {maxh = 4950}, ["Poliwhirl"] = {maxh = 1650}, ["Poliwag"] = {maxh = 631}, ["Pinsir"] = {maxh = 3150}, ["Pikachu"] = {maxh = 1600}, ["Pidgeot"] = {maxh = 5870}, ["Pidgey"] = {maxh = 292}, ["Pidgeotto"] = {maxh = 1280}, ["Persian"] = {maxh = 2850}, ["Parasect"] = {maxh = 4100}, ["Paras"] = {maxh = 425}, ["Onix"] = {maxh = 4100}, ["Omastar"] = {maxh = 100}, ["Omanyte"] = {maxh = 4530}, ["Oddish"] = {maxh = 460}, ["Ninetales"] = {maxh = 5800}, ["Nidorino"] = {maxh = 2100}, ["Nidorina"] = {maxh = 2300}, ["Nidoranma"] = {maxh = 985}, ["Nidoranfe"] = {maxh = 100}, ["Nidoqueen"] = {maxh = 7800}, ["Nidoking"] = {maxh = 7800}, ["Muk"] = {maxh = 3250}, ["Mr.Mime"] = {maxh = 5320}, ["Moltres"] = {maxh = 100}, ["Mewtwo"] = {maxh = 100}, ["Mew"] = {maxh = 100}, ["Metapod"] = {maxh = 1120}, ["Meowth"] = {maxh = 1040}, ["Marowak"] = {maxh = 4125}, ["Mankey"] = {maxh = 1000}, ["Magneton"] = {maxh = 4100}, ["Magnemite"] = {maxh = 614}, ["Magmar"] = {maxh = 7050}, ["Magikarp"] = {maxh = 250}, ["Machop"] = {maxh = 1640}, ["Machoke"] = {maxh = 3755}, ["Machamp"] = {maxh = 7560}, ["Lickitung"] = {maxh = 5320}, ["Lapras"] = {maxh = 7320}, ["Krabby"] = {maxh = 744}, ["Koffing"] = {maxh = 975}, ["Kingler"] = {maxh = 3115}, ["Kangaskhan"] = {maxh = 7550}, ["Kakuna"] = {maxh = 1120}, ["Kadabra"] = {maxh = 2765}, ["Kabutops"] = {maxh = 100}, ["Kabuto"] = {maxh = 100}, ["Jynx"] = {maxh = 7060}, ["Jyglipuff"] = {maxh = 100}, ["Jolteon"] = {maxh = 100}, ["Jigglypuff"] = {maxh = 1695}, ["Ivysaur"] = {maxh = 4115}, ["Hypno"] = {maxh = 4590}, ["Horsea"] = {maxh = 604}, ["Hitmonlee"] = {maxh = 7000}, ["Hitmonchan"] = {maxh = 7000}, ["Haunter"] = {maxh = 4250}, ["Gyarados"] = {maxh = 10150}, ["Growlithe"] = {maxh = 1200}, ["Goldeen"] = {maxh = 900}, ["Golduck"] = {maxh = 5115}, ["Golem"] = {maxh = 5250}, ["Graveler"] = {maxh = 3100}, ["Grimer"] = {maxh = 1050}, ["Golbat"] = {maxh = 2480}, ["Gloom"] = {maxh = 1530}, ["Geodude"] = {maxh = 1528}, ["Gengar"] = {maxh = 8400}, ["Gastly"] = {maxh = 1160}, ["Flareon"] = {maxh = 100}, ["Fearow"] = {maxh = 3495}, ["Farfetch"] = {maxh = 3870}, ["Exeggutor"] = {maxh = 4550}, ["Exeggcute"] = {maxh = 1100}, ["Ekans"] = {maxh = 882}, ["Shiny Charizard"] = {maxh = 13170}, ["Electabuzz"] = {maxh = 7050}, ["Electrode"] = {maxh = 3150}, ["Dugtrio"] = {maxh = 3280}, ["Drowzee"] = {maxh = 1950}, ["Dratini"] = {maxh = 1810}, ["Dragonite"] = {maxh = 17150}, ["Dragonair"] = {maxh = 7600}, ["Doduo"] = {maxh = 936}, ["Dodrio"] = {maxh = 3570}, ["Ditto"] = {maxh = 4115}, ["Diglett"] = {maxh = 696}, ["Dewgong"] = {maxh = 7300}, ["Cubone"] = {maxh = 1640}, ["Crystal Onix"] = {maxh = 100}, ["Cloyster"] = {maxh = 5825}, ["Clefairy"] = {maxh = 1695}, ["Clefabe"] = {maxh = 4400}, ["Charmeleon"] = {maxh = 4115}, ["Charmander"] = {maxh = 1600}, ["Charizard"] = {maxh = 11170}, ["Chansey"] = {maxh = 5000}, ["Caterpie"] = {maxh = 291}, ["Butterfree"] = {maxh = 2200}, ["Bulbasaur"] = {maxh = 1600}, ["Blastoise"] = {maxh = 11170}, ["Bellsprout"] = {maxh = 838}, ["Beedrill"] = {maxh = 2200}, ["Articuno"] = {maxh = 100}, ["Arcanine"] = {maxh = 7800}, ["Arbok"] = {maxh = 2405}, ["Alakazam"] = {maxh = 7350}, ["Aerodactyl"] = {maxh = 100}, ["Abra"] = {maxh = 870}, } function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'heal') then if #getCreatureSummons(cid) >= 1 then return selfSay('Voce precisa botar seus pokemons dentro da pokebola.', cid) end for slo = CONST_SLOT_FIRST, CONST_SLOT_LAST do local item = getPlayerSlotItem(cid, slo) if isContainer(item.uid) then for i,x in pairs(pokes) do if i == getItemsInContainerById(item.uid, pokeout) then local s = pokeout doItemSetAttribute(s, "poke", getItemAttribute(s, "poke"):sub(1, findLetter(getItemAttribute(s, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]") doTransformItem(s, pokein) end end for i,x in pairs(pokes) do if i == getItemsInContainerById(item.uid, pokein) then local item = pokein doItemSetAttribute(item, "poke", getItemAttribute(item, "poke"):sub(1, findLetter(getItemAttribute(item, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]") end end elseif item.itemid == pokeout or item.itemid == pokein then for i,x in pairs(pokes) do if i == getItemAttribute(item, "poke") then doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]") doTransformItem(item.uid, pokein) end end end end selfSay('Pronto, Seus pokemons estao com a vida maxima.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
info
Grupo: Campones
Registrado: 16/10/10
Posts: 30
Reputação: +2
Olá, estou com um problema com o script do Matheus Mkalo da Nurse Joy. Queria que ao invés de ele pegar o maxhealth do atributo da pokebola (poke) pegasse da table que eu fiz. Porque assim evitaria os bugs que acontecem no Go/Back.
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local pokes = { ["Zubat"] = {maxh = 642}, ["Zapdos"] = {maxh = 100}, ["Wygglypuff"] = {maxh = 100}, ["Wigglytuff"] = {maxh = 4000}, ["Weezing"] = {maxh = 3450}, ["Weepinbell"] = {maxh = 1280}, ["Weedle"] = {maxh = 291}, ["Wartortle"] = {maxh = 4115}, ["Vulpix"] = {maxh = 1200}, ["Voltorb"] = {maxh = 1000}, ["Vileplume"] = {maxh = 4100}, ["Victribell"] = {maxh = 3850}, ["Venusaur"] = {maxh = 11170}, ["Venonat"] = {maxh = 1250}, ["Venomoth"] = {maxh = 3950}, ["Vaporeon"] = {maxh = 100}, ["Tentacruel"] = {maxh = 8200}, ["Tentacool"] = {maxh = 914}, ["Tauros"] = {maxh = 4100}, ["Tangela"] = {maxh = 4060}, ["Staryu"] = {maxh = 1000}, ["Starmie"] = {maxh = 3850}, ["Squirtle"] = {maxh = 1600}, ["Spearow"] = {maxh = 642}, ["Snorlax"] = {maxh = 15350}, ["Slowpoke"] = {maxh = 1280}, ["Slowbro"] = {maxh = 4020}, ["Shellder"] = {maxh = 968}, ["Seel"] = { maxh = 1470}, ["Seaking"] = {maxh = 2315}, ["Seadra"] = {maxh = 900}, ["Scyther"] = {maxh = 6810}, ["Sandslash"] = {maxh = 5700}, ["Sandshrew"] = {maxh = 1019}, ["Rhyhorn"] = {maxh = 1750}, ["Rhydon"] = {maxh = 5115}, ["Rattata"] = {maxh = 291}, ["Raticate"] = {maxh = 1300}, ["Rapidash"] = {maxh = 5020}, ["Raichu"] = {maxh = 4115}, ["Psyduck"] = {maxh = 1210}, ["Primeape"] = {maxh = 4760}, ["Porygon"] = {maxh = 100}, ["Ponyta"] = {maxh = 980}, ["Poliwrath"] = {maxh = 4950}, ["Poliwhirl"] = {maxh = 1650}, ["Poliwag"] = {maxh = 631}, ["Pinsir"] = {maxh = 3150}, ["Pikachu"] = {maxh = 1600}, ["Pidgeot"] = {maxh = 5870}, ["Pidgey"] = {maxh = 292}, ["Pidgeotto"] = {maxh = 1280}, ["Persian"] = {maxh = 2850}, ["Parasect"] = {maxh = 4100}, ["Paras"] = {maxh = 425}, ["Onix"] = {maxh = 4100}, ["Omastar"] = {maxh = 100}, ["Omanyte"] = {maxh = 4530}, ["Oddish"] = {maxh = 460}, ["Ninetales"] = {maxh = 5800}, ["Nidorino"] = {maxh = 2100}, ["Nidorina"] = {maxh = 2300}, ["Nidoranma"] = {maxh = 985}, ["Nidoranfe"] = {maxh = 100}, ["Nidoqueen"] = {maxh = 7800}, ["Nidoking"] = {maxh = 7800}, ["Muk"] = {maxh = 3250}, ["Mr.Mime"] = {maxh = 5320}, ["Moltres"] = {maxh = 100}, ["Mewtwo"] = {maxh = 100}, ["Mew"] = {maxh = 100}, ["Metapod"] = {maxh = 1120}, ["Meowth"] = {maxh = 1040}, ["Marowak"] = {maxh = 4125}, ["Mankey"] = {maxh = 1000}, ["Magneton"] = {maxh = 4100}, ["Magnemite"] = {maxh = 614}, ["Magmar"] = {maxh = 7050}, ["Magikarp"] = {maxh = 250}, ["Machop"] = {maxh = 1640}, ["Machoke"] = {maxh = 3755}, ["Machamp"] = {maxh = 7560}, ["Lickitung"] = {maxh = 5320}, ["Lapras"] = {maxh = 7320}, ["Krabby"] = {maxh = 744}, ["Koffing"] = {maxh = 975}, ["Kingler"] = {maxh = 3115}, ["Kangaskhan"] = {maxh = 7550}, ["Kakuna"] = {maxh = 1120}, ["Kadabra"] = {maxh = 2765}, ["Kabutops"] = {maxh = 100}, ["Kabuto"] = {maxh = 100}, ["Jynx"] = {maxh = 7060}, ["Jyglipuff"] = {maxh = 100}, ["Jolteon"] = {maxh = 100}, ["Jigglypuff"] = {maxh = 1695}, ["Ivysaur"] = {maxh = 4115}, ["Hypno"] = {maxh = 4590}, ["Horsea"] = {maxh = 604}, ["Hitmonlee"] = {maxh = 7000}, ["Hitmonchan"] = {maxh = 7000}, ["Haunter"] = {maxh = 4250}, ["Gyarados"] = {maxh = 10150}, ["Growlithe"] = {maxh = 1200}, ["Goldeen"] = {maxh = 900}, ["Golduck"] = {maxh = 5115}, ["Golem"] = {maxh = 5250}, ["Graveler"] = {maxh = 3100}, ["Grimer"] = {maxh = 1050}, ["Golbat"] = {maxh = 2480}, ["Gloom"] = {maxh = 1530}, ["Geodude"] = {maxh = 1528}, ["Gengar"] = {maxh = 8400}, ["Gastly"] = {maxh = 1160}, ["Flareon"] = {maxh = 100}, ["Fearow"] = {maxh = 3495}, ["Farfetch"] = {maxh = 3870}, ["Exeggutor"] = {maxh = 4550}, ["Exeggcute"] = {maxh = 1100}, ["Ekans"] = {maxh = 882}, ["Shiny Charizard"] = {maxh = 13170}, ["Electabuzz"] = {maxh = 7050}, ["Electrode"] = {maxh = 3150}, ["Dugtrio"] = {maxh = 3280}, ["Drowzee"] = {maxh = 1950}, ["Dratini"] = {maxh = 1810}, ["Dragonite"] = {maxh = 17150}, ["Dragonair"] = {maxh = 7600}, ["Doduo"] = {maxh = 936}, ["Dodrio"] = {maxh = 3570}, ["Ditto"] = {maxh = 4115}, ["Diglett"] = {maxh = 696}, ["Dewgong"] = {maxh = 7300}, ["Cubone"] = {maxh = 1640}, ["Crystal Onix"] = {maxh = 100}, ["Cloyster"] = {maxh = 5825}, ["Clefairy"] = {maxh = 1695}, ["Clefabe"] = {maxh = 4400}, ["Charmeleon"] = {maxh = 4115}, ["Charmander"] = {maxh = 1600}, ["Charizard"] = {maxh = 11170}, ["Chansey"] = {maxh = 5000}, ["Caterpie"] = {maxh = 291}, ["Butterfree"] = {maxh = 2200}, ["Bulbasaur"] = {maxh = 1600}, ["Blastoise"] = {maxh = 11170}, ["Bellsprout"] = {maxh = 838}, ["Beedrill"] = {maxh = 2200}, ["Articuno"] = {maxh = 100}, ["Arcanine"] = {maxh = 7800}, ["Arbok"] = {maxh = 2405}, ["Alakazam"] = {maxh = 7350}, ["Aerodactyl"] = {maxh = 100}, ["Abra"] = {maxh = 870}, } function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'heal') then if #getCreatureSummons(cid) >= 1 then return selfSay('Voce precisa botar seus pokemons dentro da pokebola.', cid) end for slo = CONST_SLOT_FIRST, CONST_SLOT_LAST do local item = getPlayerSlotItem(cid, slo) if isContainer(item.uid) then for i,x in pairs(pokes) do if i == getItemsInContainerById(item.uid, pokeout) then local s = pokeout doItemSetAttribute(s, "poke", getItemAttribute(s, "poke"):sub(1, findLetter(getItemAttribute(s, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]") doTransformItem(s, pokein) end end for i,x in pairs(pokes) do if i == getItemsInContainerById(item.uid, pokein) then local item = pokein doItemSetAttribute(item, "poke", getItemAttribute(item, "poke"):sub(1, findLetter(getItemAttribute(item, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]") end end elseif item.itemid == pokeout or item.itemid == pokein then for i,x in pairs(pokes) do if i == getItemAttribute(item, "poke") then doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]") doTransformItem(item.uid, pokein) end end end end selfSay('Pronto, Seus pokemons estao com a vida maxima.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())