Carlinhow789 1 Postado Fevereiro 12, 2011 Share Postado Fevereiro 12, 2011 (editado) Galera Pelo Amor De Deus Me Ajuda Eu Kero Bota 1 Npc No meu oT assim q venda uns items mas qero q os player comprem com esse iten kae 8300 Pode Dexa q os itens pra vender eu arrumo Do rep + Meu Msn :carlinhow_guss@hotmail.com Editado Fevereiro 12, 2011 por Carlinhow789 Link para o comentário Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Fevereiro 12, 2011 Share Postado Fevereiro 12, 2011 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 if(msgcontains(msg, 'buy boots of haste')) then selfSay('Eu vendo boots of haste por 2 itens 8300, você quer comprar?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if doPlayerRemoveItem(cid, 8300, 2) == TRUE then doPlayerAddItem(cid, ID_DA_BOH, 1) else selfSay('Descupe, voce não tem 2 itens 8300 para me dar!', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Certo, então.', cid) 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...
Carlinhow789 1 Postado Fevereiro 12, 2011 Autor Share Postado Fevereiro 12, 2011 (editado) Mano Eu nao to intendo 1 coisa ond q boto os items pra vender? fas so 1 script de 1 item q o resto eu copio e vo botando o id é 12603 GOD armor vllw Editado Fevereiro 12, 2011 por Carlinhow789 Link para o comentário Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Fevereiro 12, 2011 Share Postado Fevereiro 12, 2011 fiz aqui,só saber editar cara local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 SellItemVip(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if doPlayerRemoveItem(cid,parameters.item,parameters.count) then doPlayerAddItem(cid,parameters.reward,1) npcHandler:say('Thanks for buy ' .. getItemNameById(parameters.reward) .. '!', cid) else npcHandler:say('Sorry, you don\'t have ' .. parameters.count .. ' ' .. getItemNameById(parameters.item) .. '!', cid) end npcHandler:resetNpc() return true end local coin = 8300 -- id da sua coin keywordHandler:addKeyword({'items'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell {demon armor} and {demon helmet} for ' .. getItemNameById(coin) .. 's.'}) local node1 = keywordHandler:addKeyword({'demon armor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy demon armor for 30 ' .. getItemNameById(coin) .. 's ?'}) node1:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 30,reward = 2494}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node2 = keywordHandler:addKeyword({'demon helmet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy demon helmet for 50 ' .. getItemNameById(coin) .. 's ?'}) node2:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 50,reward = 2493}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) npcHandler:addModule(FocusModule:new()) vou explicar o básico,o resto vc edita local coin = 8300 -- id da sua coin count = 50 -- quanto irá custar o item reward = 2493 -- o item que o npc vai dar(vender) se o jogador tiver as coins. Link para o comentário Compartilhar em outros sites More sharing options...
Carlinhow789 1 Postado Fevereiro 12, 2011 Autor Share Postado Fevereiro 12, 2011 e no 1° arquivo do npc como q eu boto ? ond fica o nome do npc e talz Link para o comentário Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Fevereiro 12, 2011 Share Postado Fevereiro 12, 2011 (editado) ... NPC NOME DO SEU NPC.XML <?xml version="1.0"?> <npc name="NOME DO SEU NPC" script="data/npc/scripts/NOME DO SEU SCRIPT.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="Hello |PLAYERNAME|. want to buy some {items} ?" /> </parameters> </npc> Editado Fevereiro 12, 2011 por Vodkart Link para o comentário Compartilhar em outros sites More sharing options...
Carlinhow789 1 Postado Fevereiro 14, 2011 Autor Share Postado Fevereiro 14, 2011 (editado) vlw mlk kara tem itens q nao vende pq ? la ta assim local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 SellItemVip(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if doPlayerRemoveItem(cid,parameters.item,parameters.count) then doPlayerAddItem(cid,parameters.reward,1) npcHandler:say('Thanks for buy ' .. getItemNameById(parameters.reward) .. '!', cid) else npcHandler:say('Sorry, you don\'t have ' .. parameters.count .. ' ' .. getItemNameById(parameters.item) .. '!', cid) end npcHandler:resetNpc() return true end local coin = 8300 -- id da sua coin keywordHandler:addKeyword({'items'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell {medal of asgard}, {golden medal}, {bone medal}, {Medal of Slime}, {Star amulet [LVL4]}, {Star amulet [LVL3]}, {Star amulet [LVL2]} and {Star amulet} for ' .. getItemNameById(coin) .. 's.'}) local node1 = keywordHandler:addKeyword({'medal of asgard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy medal of asgard for 8 ' .. getItemNameById(coin) .. 's ?'}) node1:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 8,reward = 10137}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node2 = keywordHandler:addKeyword({'golden medal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy golden medal for 7 ' .. getItemNameById(coin) .. 's ?'}) node2:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 7,reward = 10136}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node3 = keywordHandler:addKeyword({'bone medal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy bone medal for 6 ' .. getItemNameById(coin) .. 's ?'}) node3:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 6,reward = 10140}) node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node4 = keywordHandler:addKeyword({'Medal of Slime'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Medal of Slime for 5 ' .. getItemNameById(coin) .. 's ?'}) node4:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 5,reward = 10138}) node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node5 = keywordHandler:addKeyword({'Star amulet [LVL4]'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet [LVL4] for 9 ' .. getItemNameById(coin) .. 's ?'}) node5:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 9,reward = 2131}) node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node6 = keywordHandler:addKeyword({'Star amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet for 6 ' .. getItemNameById(coin) .. 's ?'}) node6:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 6,reward = 10135}) node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node7 = keywordHandler:addKeyword({'Star amulet [LVL2]'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet [LVL2] for 7 ' .. getItemNameById(coin) .. 's ?'}) node7:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 7,reward = 10134}) node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) local node8 = keywordHandler:addKeyword({'Star amulet [LVL3]'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet [LVL3] for 8 ' .. getItemNameById(coin) .. 's ?'}) node8:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 8,reward = 10133}) node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) npcHandler:addModule(FocusModule:new()) todos os amuleton nao ta vendendo e essa medal of slime tmb nao ta vendendo pq? ajuda ae Editado Fevereiro 14, 2011 por Carlinhow789 Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados