Ir para conteúdo

Posts Recomendados

Ae galerinha blz? Bom eu tava querendo um npc que vende promotion VIP. Tipow assim: ele vende so as vocaçoes novas, que sao: Vip Hells Sorcerer, Vip Hells Druid, Vip Hells Paladin e Vip Hells Knight e so se o cara for premmy. Eu ja adicionei as novas vocaçoes em vocations.xml eu so quero o npc. Se alguem tiver ou der conta de fazer um ae ficarei agradecido.

Link para o comentário
https://xtibia.com/forum/topic/115641-npc-que-venda-vip-promotion/
Compartilhar em outros sites

aee:

 

local sorcId = 9 -- id da vocation sorc vip

local druidId = 10 -- id da vocation druid vip

local pallyId = 11 -- id da vocation pally vip

local kinaId = 12 -- id da vocation kina vip

local cost = 20000

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

 

---------------------------------------Vip Hells Druid------------------------------

if msgcontains(msg, 'vip hells druid') then

selfSay("Do you want buy a vip promotion for "..cost.." golds?", cid)

talkState[cid] = 1

end

 

if talkState[cid] == 1

if msgcontains(msg, 'yes') then

if getPlayerMoney(cid) >= cost

doPlayerRemoveMoney(cid,cost)

doPlayerSetVocation(cid, druidId)

selfSay("Ok, as your wish.", cid)

talkState[cid] = 0

else

selfSay("Sorry, you don´t have enough gold.", cid)

talkState[cid] = 0

end

end

end

 

-----------------------------------------Vip Hells Sorcerer------------------------------

if msgcontains(msg, 'vip hells sorcerer') then

selfSay("Do you want buy a vip promotion for "..cost.." golds?", cid)

talkState[cid] = 2

end

 

if talkState[cid] == 2

if msgcontains(msg, 'yes') then

if getPlayerMoney(cid) >= cost

doPlayerRemoveMoney(cid,cost)

doPlayerSetVocation(cid, sorcId)

selfSay("Ok, as your wish.", cid)

talkState[cid] = 0

else

selfSay("Sorry, you don´t have enough gold.", cid)

talkState[cid] = 0

end

end

end

 

---------------------------------------Vip Hells Paladin------------------------------

if msgcontains(msg, 'vip hells paladin') then

selfSay("Do you want buy a vip promotion for "..cost.." golds?", cid)

talkState[cid] = 3

end

 

if talkState[cid] == 3

if msgcontains(msg, 'yes') then

if getPlayerMoney(cid) >= cost

doPlayerRemoveMoney(cid,cost)

doPlayerSetVocation(cid, pallyId)

selfSay("Ok, as your wish.", cid)

talkState[cid] = 0

else

selfSay("Sorry, you don´t have enough gold.", cid)

talkState[cid] = 0

end

end

end

 

---------------------------------------Vip Hells Knight------------------------------

if msgcontains(msg, 'vip hells knight') then

selfSay("Do you want buy a vip promotion for "..cost.." golds?", cid)

talkState[cid] = 4

end

 

if talkState[cid] == 4

if msgcontains(msg, 'yes') then

if getPlayerMoney(cid) >= cost

doPlayerRemoveMoney(cid,cost)

doPlayerSetVocation(cid, kinaId)

selfSay("Ok, as your wish.", cid)

talkState[cid] = 0

else

selfSay("Sorry, you don´t have enough gold.", cid)

talkState[cid] = 0

end

end

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

vc só prescisa editar as partes em negrito e qualquer problema me manda por msg :smile_positivo:

Link para o comentário
https://xtibia.com/forum/topic/115641-npc-que-venda-vip-promotion/#findComment-761356
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...