Postado Junho 10, 2014 10 anos Olá, eu gostaria que o npc vendesse a promotion, por itens, por exemplo, no lugar do gold, que o item fosse 5944, o script que eu uso segue abaixo, o "cost" é o preço, mas não consigo alterar para itens, alguém me ajuda? 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 local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso promove-lo por 20 crystal coins. Gostaria de ser promovido?'}) node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Parabens. Agora voce foi promovido'}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Volte quando estiver pronto.', reset = true}) --[[ local node2 = keywordHandler:addKeyword({'second'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso promove-lo por 20 crystal coins. Gostaria de ser promovido?'}) node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 10, promotion = 2, text = 'Parabens. Agora voce foi promovido'}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Volte quando estiver pronto..', reset = true}) ]]--
Postado Junho 10, 2014 10 anos data/npc/NpcName.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="NpcName" script="data/npc/scripts/NpcName.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="96" head="0" body="0" legs="0" feet="0" addons="0"/> </npc> data/npc/NpcName.lua 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 npcPromotion(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (isPremium(cid)) then if (getPlayerLevel(cid) >= 100) then if (getPlayerVocation(cid) >= 5 and getPlayerVocation(cid) <=8) then if doRemoveItem(cid, 9971, 1) then doPlayerSetVocation(cid, getPlayerVocation(cid)+4) doPlayerSendTextMessage(cid, 20, "Voce é um ".. getPlayerVocationName(cid) .."!") else doPlayerSendTextMessage(cid, 20, "Voce nao possui o item desejado!") end else doPlayerSendTextMessage(cid, 20, "Voce não possui a promotion anterior ou já esta promovido.") end else doPlayerSendTextMessage(cid, 20, "Voce nao possui level para ser promovido.") end else doPlayerSendTextMessage(cid, 20, "Voce nao possui premmium account.") end end local node1 = keywordHandler:addKeyword({'high promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promotion you if you give me a '.. getItemName(9971) ..'. Do you want me to promote you?'}) node1:addChildKeyword({'yes'}, npcPromotion, {}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then.', reset = true}) npcHandler:addModule(FocusModule:new()) em troca de um item (ID = 9971). mais qual quer coisa so editar no scrit o id do iten Editado Junho 10, 2014 10 anos por macalo (veja o histórico de edições)
Postado Junho 10, 2014 10 anos Autor Esse no caso seria para a 2 voc, tipo elder druid, e tal, né? para fazer para a 3 voc, seria só alterar if (getPlayerVocation(cid) >= 5 and getPlayerVocation(cid) <=8) then if doRemoveItem(cid, 9971, 1) then doPlayerSetVocation(cid, getPlayerVocation(cid)+4) Ex: if (getPlayerVocation(cid) >= 9 and getPlayerVocation(cid) <=12) then if doRemoveItem(cid, 9971, 1) then doPlayerSetVocation(cid, getPlayerVocation(cid)+8) Editado Junho 10, 2014 10 anos por snajiw (veja o histórico de edições)
Postado Junho 10, 2014 10 anos sim so altera if (getPlayerVocation(cid) >= 9 and getPlayerVocation(cid) <=12) then essa aki abaixo pra altera o item if doRemoveItem(cid, 9971, 1) then
Postado Junho 10, 2014 10 anos Autor Testei antes e depois de alterar, e ambos não funcionaram, o que pode ser?
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.