Postado Fevereiro 16, 2013 12 anos To aqui pra pedir 1 NPC! Que vender alguns itens, por fala.. EXEMPLO: Player: Hi npc: Olá eu vendo runas, quais voçê deseja? Event I, Event II, Event III, ou Castle Event? player: Event I npc: Voçê tem certeza que deseja comprar Event I, por 1000 golds? player: yes npc: Aqui esta! Isso foi só um exemplo... E aqui estao os preços e os IDs das runas, que o NPC, vai vender! Event I, ID 2270, venda por 1000 golds! Event II, ID 2296, venda por 2000 golds! Event II, ID 2290, venda por 3000 golds! Event Castle, ID 2280, venda por 4000 golds! È isso ai! Espero que consigam! Darei REP+ para quem ajudar ;]
Postado Fevereiro 16, 2013 12 anos Teste esse aqui amigo, eu tentei por em ingles para testar o meu , só que sou mt ruim, kkk 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 --------------------------------- npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|, I can sell you {runes}.") -- muda a frase só yes q não muda function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end --------------------------------- local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid --------------------------------- if(msgcontains(msg, 'runes')) then selfSay("Well... I can sell you fourth types of rune, {event I}, {event II}, {event III} and {event Castle}.", cid) talkState[talkUser] = 1 return true elseif talkState[talkUser] == 1 and msgcontains(msg, 'event I') then selfSay("Ok... You want buy the Event I for 1000 GPS?", cid) talkState[talkUser] = 3 return true elseif talkState[talkUser] == 1 and msgcontains(msg, 'event II') then selfSay("Ok... You want buy the Event II for 2000 GPS?", cid) talkState[talkUser] = 4 return true elseif talkState[talkUser] == 1 and msgcontains(msg, 'event III') then selfSay("Ok... You want buy the Event III for 3000 GPS?", cid) talkState[talkUser] = 5 return true elseif talkState[talkUser] == 1 and msgcontains(msg, 'event Castle') then selfSay("Ok... You want buy the Event Castle for 4000 GPS?", cid) talkState[talkUser] = 10 return true ----------------------------------------------------------- elseif talkState[talkUser] == 3 and msgcontains(msg, 'yes') then if(doPlayerRemoveMoney(cid, 1000) == TRUE) then doPlayerAddItem(cid, 2270, 1) talkState[talkUser] = 0 else selfSay("Você não tem dinheiro suficiente!", cid) talkState[talkUser] = 0 end end ------------------------------------------------------------- elseif talkState[talkUser] == 4 and msgcontains(msg, 'yes') then if(doPlayerRemoveMoney(cid, 1000) == TRUE) then doPlayerAddItem(cid, 2296, 1) talkState[talkUser] = 0 else selfSay("Você não tem dinheiro suficiente!", cid) talkState[talkUser] = 0 end end ------------------------------------------------------------- elseif talkState[talkUser] == 5 and msgcontains(msg, 'yes') then if(doPlayerRemoveMoney(cid, 1000) == TRUE) then doPlayerAddItem(cid, 2290, 1) talkState[talkUser] = 0 else selfSay("Você não tem dinheiro suficiente!", cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 10 and msgcontains(msg, 'yes') then if(doPlayerRemoveMoney(cid, 1000) == TRUE) then doPlayerAddItem(cid, 2280, 1) talkState[talkUser] = 0 else selfSay("Você não tem dinheiro suficiente!", cid) talkState[talkUser] = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Tony Araújo
Postado Fevereiro 16, 2013 12 anos Cria um arquivo em: data/npc com qualquer nome e cola isso dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="SmiX" script="default.lua" walkinterval="32000000" floorchange="0" speed="0"> <health now="150" max="150"/> <look type="520" head="115" body="88" legs="114" feet="0"/> <parameters> <parameter key="message_greet" value="Olá, eu vendo runas, qual você deseja? Event I, Event II, Event III ou Castle Event? "/> <parameter key="message_farewell" value="Tchau!"/> <parameter key="message_idletimeout" value="Foi muito bom falar com você!"/> <parameter key="message_walkaway" value="Adeus!"/> <parameter key="module_shop" value="1"/> <parameter key="shop_buyable" value="Event I, 2270 , 1000; Event II, 2296 , 2000; Event III, 2290 , 3000; Event Castle, 2280 , 4000"/> </parameters> </npc> É isso ai, se não funcionar avisa, se funcionar rep+ OBS: Não vi o script do parceiro ali em cima, enqnto eu editava aqui ele postou, caso o dele não funcione tente o meu (: Editado Fevereiro 16, 2013 12 anos por Athukzor (veja o histórico de edições)
Postado Fevereiro 16, 2013 12 anos Autor Orochi Elf Desculpa a TAMANHA BURRISSE, E IGNORANCIA! Mais onde boto seu script? <<<<<<<< Athukzor Vo testar ;] Nao funfo :/ Editado Fevereiro 16, 2013 12 anos por kakuzo12300 (veja o histórico de edições)
Postado Fevereiro 16, 2013 12 anos Pô, sou novo na área de scripts... eu até daria uma revisada pra você e corrigiria mas estou indo dormir agora... só vou pegar o level 12 no meu char, haha. Provavelmente o script dele vai na mesma pasta que o meu, dá uma lida nele pra ver certinho, (tem informações adicionais de palavras e tals no script) não cheguei a ler tudo, mas vê aí certinho. Abraço.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.