Ir para conteúdo
  • 0

Npc Que Vende Promotin, Em Troca De Itens


Raspas

Pergunta

Quero transformar o meu npc que vende promotion. Quero que ele venda promotion em troca de items, se alguem poder me ajudar ganha um REP+

 

Aqui está o npc

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 node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 5000000 gold coins. Do you want me to epicize you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 5000000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

 

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

aonde ta escrito item e o id do item que e pra vc botar o item que querer

 

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
doRemoveItem(cid,item)
function onThink() npcHandler:onThink()
end

local node1 = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Posso promove-lo para Primeira Promotion por 20k. Voce quer?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, item = 1357 , level = 20, promotion = 1, text = 'Agora voce tem a primeira promotion.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tudo bem, volte quando estiver pronto.', reset = true})


local node2 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Posso promove-lo para Promotion VIP por 500k. Voce quer?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler level =  item = 1357 , 200, promotion = 2, text = 'Agora voce tem a VIP promotion.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tudo bem, volte quando estiver pronto.', reset = true})
npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

Tente isso mano:

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 (getPlayerVocation(cid) >= 5 and getPlayerVocation(cid) <=8) then
    if doRemoveItem(cid, ID DO ITEM, 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 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())

 

Onde está escrito ID DO ITEM é o ID do item que você vai usar.

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...