galaverna 24 Postado Outubro 10, 2010 Share Postado Outubro 10, 2010 Queria um NPC que vendesse pokeball com pokemon e meu sistem usa ACTION ID para cada poke ai keria que o kara vendesse os item com o ACTION ID porfavor ;D AGRADEÇO DE JA VLW ;D Link para o comentário Compartilhar em outros sites More sharing options...
drakylucas 159 Postado Outubro 11, 2010 Share Postado Outubro 11, 2010 edita isso: é só vc modificar as msgs e as action ids e a id da ball =d xml: <?xml version="1.0" encoding="UTF-8"?> <npc name="Elric" script="data/npc/scripts/alchemy.lua" walkinterval="3000"> <health now="100" max="100"/> <look type="333"/> </npc> script: local focus = 0 local talk_start = 0 function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') focus = 0 talk_start = 0 end end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Hello ' .. getCreatureName(cid) .. '! I sell all things related to "alchemy".') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'alchemy') then selfSay('Ahh, yes I have "recipes", "recipe book", and "alchemic kits" , for sale which do you want to know more about?') talk_state = 1 elseif talk_state == 1 then if msgcontains(msg, 'recipe book') then price = 1000 selfSay('I have this recipe book that you can use to see the recipes you have learned, do you want to buy it for '.. price ..' gold?') talk_state = 4 item = 1965 rtrn = 1 elseif msgcontains(msg, 'recipes') then if getPlayerStorageValue(cid, 50500) == -1 then selfSay('You don\'t seem to know much about alchemy go study first.') talk_state = 1 else selfSay('Yes, I have a list of recipes for "beginner" and "advanced" Alchemists, which would you like to see?.') talk_state = 2 end elseif msgcontains(msg, 'alchemic kit') then price = 10000 selfSay('This is a special kit used just for alchemy, would you like to buy it for '.. price ..' gold?.') talk_state = 4 item = 6104 rtrn = 1 elseif msgcontains(msg, 'bye') then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end elseif talk_state == 2 then if msgcontains(msg, 'beginner') then selfSay('At the beginner level I sell recipes for: "antidote", "platinum coin", "mind stone", "soul orb", "blood orb", "love potion", "ectoplasm", "weak mana rune", "crystal coin", "sparkling mummy doll". which one do you want?') talk_state = 3 elseif msgcontains(msg, 'advanced') then selfSay('At the Advanced level I sell recipes for: "berserk potion", "mastermind potion", "bullseye potion", "mead horn", "gold bar", "mana rune", "clover amulet", "sword", "magic", "arrow". which one do you want?') talk_state = 3 else selfSay('That\'s too bad, maybe next time.') talk_state = 1 end elseif talk_state == 3 then item = 1954 rtrn = 2 if msgcontains(msg, 'antidote') then price = 1000 selfSay('Do you want to buy an Antidote recipe for ' ..price.. ' gold?') action = 50001 desc = 'This contains the recipe to make an Antidote.' talk_state = 4 elseif msgcontains(msg, 'platinum coin') then price = 2000 selfSay('For ' .. price ..' gold i can sell you the secert to minting platinum coins?') action = 50002 desc = 'This contains the formula for minting Platinum Coins.' talk_state = 4 elseif msgcontains(msg, 'mind stone') then price = 2000 selfSay('Do you want to buy a Mind Stone recipe for ' ..price.. ' gold?') action = 50003 desc = 'This contains the recipe to make a Mind Stones.' talk_state = 4 elseif msgcontains(msg, 'soul orb') then price = 2000 selfSay('Do you want to buy a Soul Orb recipe for ' ..price.. ' gold?') action = 50004 desc = 'This contains the recipe to make a Soul Orbs.' talk_state = 4 elseif msgcontains(msg, 'blood orb') then price = 5000 selfSay('Do you want to buy a Blood Orb recipe for ' ..price.. ' gold?') action = 50005 desc = 'This contains the recipe to make a Blood Orbs.' talk_state = 4 elseif msgcontains(msg, 'love potion') then price = 30000 selfSay('Do you want to buy a Love Potion recipe for ' ..price.. ' gold?') action = 50006 desc = 'This contains the recipe to make a Love Potions.' talk_state = 4 elseif msgcontains(msg, 'ectoplasm') then price = 20000 selfSay('Do you want to buy a Ectoplasm recipe for ' ..price.. ' gold?') action = 50007 desc = 'This contains the recipe to make some Ectoplasm.' talk_state = 4 elseif msgcontains(msg, 'intense mana rune') then price = 60000 selfSay('Do you want to buy a Intense Mana Rune recipe for ' ..price.. ' gold?') action = 50008 desc = 'This contains the recipe to make a Intense Mana Runes.' talk_state = 4 elseif msgcontains(msg, 'crystal coin') then price = 100000 selfSay('For ' .. price ..' gold i can sell you the secert to minting crystal coins?') action = 50009 desc = 'This contains the formula for minting Crystal coins.' talk_state = 4 elseif msgcontains(msg, 'sparkling mummy doll') then price = 100000 selfSay('Do you want to buy a Sparkling Mummy Doll Recipe for ' ..price.. ' gold?') action = 50010 desc = 'This contains the recipe to make a Sparkling Mummy Doll.' talk_state = 4 elseif msgcontains(msg, 'berserk potion') then price = 100000 selfSay('Do you want to buy a Berserk Potion recipe for ' ..price.. ' gold?') action = 50018 desc = 'This contains the recipe to make a Beserk Potion.' talk_state = 4 elseif msgcontains(msg, 'mastermind potion') then price = 100000 selfSay('Do you want to buy a Mastermind Potion recipe for ' ..price.. ' gold?') action = 50019 desc = 'This contains the recipe to make a Mastermind Potion.' talk_state = 4 elseif msgcontains(msg, 'bullseye potion') then price = 100000 selfSay('Do you want to buy a Bullseye Potion Recipe for ' ..price.. ' gold?') action = 50020 desc = 'This contains the recipe to make a Bullseye Potion.' talk_state = 4 elseif msgcontains(msg, 'mead horn') then price = 200000 selfSay('Do you want to buy a Mead Horn Recipe for ' ..price.. ' gold?') action = 50021 desc = 'This contains the recipe to make a Mean Horn.' talk_state = 4 elseif msgcontains(msg, 'gold bar') then price = 10000000 selfSay('For ' .. price ..' gold i can sell you the secret to minting gold bars?') action = 50022 desc = 'This contains the formula for minting Gold Bars.' talk_state = 4 elseif msgcontains(msg, 'ultimate mana rune') then price = 500000 selfSay('Do you want to buy a Potion of Ultimate Mana Recipe for ' ..price.. ' gold?') action = 50023 desc = 'This contains the recipe to make a Ultimate Mana rune.' talk_state = 4 elseif msgcontains(msg, 'clover amulet') then price = 1000000 selfSay('Do you want to buy a Clover Amulet Recipe for ' ..price.. ' gold?') action = 50024 desc = 'This contains the recipe to make a Clover Amulet.' talk_state = 4 elseif msgcontains(msg, 'sword') then price = 2000000 selfSay('Do you want to buy a sword Recipe for ' ..price.. ' gold?') action = 50025 desc = 'This contains the recipe to make a sword.' talk_state = 4 elseif msgcontains(msg, 'magic') then price = 2000000 selfSay('Do you want to buy magic Recipe for ' ..price.. ' gold?') action = 50026 desc = 'This contains the recipe to make magic.' talk_state = 4 elseif msgcontains(msg, 'arrow') then price = 2000000 selfSay('Do you want to buy an arrow Recipe for ' ..price.. ' gold?') action = 50027 desc = 'This contains the recipe to make arrow.' talk_state = 4 elseif msgcontains(msg, 'bye') then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end elseif talk_state == 4 then if msgcontains(msg, 'yes') then if getPlayerMoney(cid) >= price then selfSay('Here you go!') doPlayerRemoveMoney(cid, price) doPlayerAddItem(cid, item, 1) if action then doItemSetAttribute(getPlayerItemById(cid, true, 1954).uid, "aid", action) end if desc then doItemSetAttribute(getPlayerItemById(cid, true, 1954).uid, "description", desc) end if rtrn == 1 then talk_state = 2 else talk_state = 3 end else selfSay('You don\'t seem to have enough money.') if rtrn == 1 then talk_state = 2 else talk_state = 3 end end else selfSay('That\'s too bad, maybe next time.') if rtrn == 1 then talk_state = 2 else talk_state = 3 end end elseif msgcontains(msg, 'bye') then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end elseif msgcontains(msg, 'bye') and focus == cid then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye then.') focus = 0 end end end créditos: a todos os kra que contribuiram nesse sistema da otland. http://otland.net/f81/mod-alchemy-system-new-update-85584/ =d Link para o comentário Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Outubro 11, 2010 Share Postado Outubro 11, 2010 Vendedor Pokemon.xml <?xml version="1.0"?> <npc name="Vendedor Pokemon" script="data/npc/scripts/pokesell.lua" walkinterval="5000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Como vai |PLAYERNAME|! Eu vendo Pokemons, Diga {lista} para saber quais eu vendo e o price deles." /> <parameter key="module_keywords" value="1" /> <parameter key="keywords" value="lista" /> <parameter key="keyword_reply1" value="Eu vendo {charmander} por 1000 gps, {squirtle} por 2000 gps, {bulbassauro} por 3000 gps, {tauros} por 4000 gps e {snorlax} por 5000 gps ." /> </parameters> </npc> NPC/SCRIPT pokesell.lua 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local poke = { ["charmander"] = {id_pokeball = 7840,price = 10000, action_id = 2046}, ["squirtle"] = {id_pokeball = 7840,price = 20000, action_id = 2047}, ["bulbassauro"] = {id_pokeball = 7840,price = 30000, action_id = 2048}, ["tauros"] = {id_pokeball = 7840,price = 40000, action_id = 2049}, ["snorlax"] = {id_pokeball = 7840,price = 50000, action_id = 2050} } local e = poke[msg] if (not e) then selfSay("Eu não vendo este pokemon ", cid) return FALSE end if doPlayerRemoveMoney(cid, e.price) == TRUE then a = doPlayerAddItem(cid,e.id_pokeball,1) doItemSetAttribute(a, "aid", e.action_id) selfSay("Obrigado,ai está seu pokemon !", cid) talkState[talkUser] = 0 else selfSay(" Você não tem ".. e.price.." gps para comprar ", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário Compartilhar em outros sites More sharing options...
galaverna 24 Postado Outubro 11, 2010 Autor Share Postado Outubro 11, 2010 vod como sempre muito foda... mais ele não colocou o action id ;x Link para o comentário Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Outubro 11, 2010 Share Postado Outubro 11, 2010 funciona 100% entrei com contato com o dono do pedido e o npc "voltou" a funcionar. sanado Link para o comentário Compartilhar em outros sites More sharing options...
galaverna 24 Postado Outubro 11, 2010 Autor Share Postado Outubro 11, 2010 vod REP + ;D Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados