Jump to content
  • 0

[Npc Que Vende Novas Vocação]


angelanascimento

Question

Recommended Posts

  • 0

Cria uma porta que só pode passar uma vocação, tipo a porta gate Experience e ponha cada npc desse script (apresentado abaixo) em uma.

 

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, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga {ELEMENTARIE CONCENTRATE}.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'elementarie concentrate') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid,9)

selfSay('Agora você é um mestre elemental.', cid)

else

selfSay('Você não tem Dinheiro Suficiente.', cid)

end

talkState[talkUser] = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Mensagem do player

Mensagem do npc

Id da vocação

item a ser removido

player sem item

Edited by Newtonnotwen
Link to comment
Share on other sites

  • 0

tipo as vocacao tem que ta no arquivo xml n tem?

isu que to com duvida arumei mais n sei fazer o npc para por ;/ vo te mandar aq como ta

id="9" name="Supreme Sorcerer"

id="10" name="Majestic Druid"

id="11" name="Lord Paladin"

id="12" name="Monster Knight"

Link to comment
Share on other sites

  • 0

Sim.

 

----------------Editado

 

Supreme Sorcerer:

 

Renomeie o arquivo.lua para supreme sorcerer em npc/scripts.

 

 

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, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga {Supreme Sorcerer}.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'supreme sorcerer') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid,9)

selfSay('Agora você é um Supreme Sorcerer.', cid)

else

selfSay('Você não tem Dinheiro Suficiente.', cid)

end

talkState[talkUser] = 0

end

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

agora em npc.xml renomeie um arquivo para Supreme Sorcerer.

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Supreme Sorcerer" script="data/npc/scripts/Supreme Sorcerer.lua" walkinterval="0" floorchange="0">

<health now="100" max="100"/>

<look type="302" head="114" body="114" legs="200" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Deseja virar um Supreme Sorcerer? "/>

</parameters>

</npc>

 

Obs: Me ajuda a botar em Spoiler pra eu botar o resto!

Edited by Newtonnotwen
Link to comment
Share on other sites

  • 0

Ok, vou editar os outros 3 e já ti mando.

 

-----------------------------------------------------Editado

 

Majestic Druid:

 

Arquivo xml (renomeie para Majestic Druid):

 

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Majestic Druid" script="data/npc/scripts/Majestic Druid.lua" walkinterval="0" floorchange="0">

<health now="100" max="100"/>

<look type="302" head="114" body="114" legs="200" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Deseja virar um Majestic Druid? "/>

</parameters>

</npc>

 

 

Script (renomeie para Majestic Druid):

 

 

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, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga {Majestic Druid}.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'Majestic Druid') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid,10)

selfSay('Agora você é um Majestic Druid.', cid)

else

selfSay('Você não tem Dinheiro Suficiente.', cid)

end

talkState[talkUser] = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Lord Paladin.xml (renomeie para Lord Paladin):

 

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Lord Paladin" script="data/npc/scripts/Lord Paladin.lua" walkinterval="0" floorchange="0">

<health now="100" max="100"/>

<look type="302" head="114" body="114" legs="200" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Deseja virar um Lord Paladin? "/>

</parameters>

</npc>

 

 

Lord Paladin script.lua (renomeie para Lord Paladin):

 

 

 

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, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga {Lord Paladin}.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'Lord Paladin') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid,11)

selfSay('Agora você é um Lord Paladin.', cid)

else

selfSay('Você não tem Dinheiro Suficiente.', cid)

end

talkState[talkUser] = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Monster Knight.xml (renomeie para Monster Knight):

 

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Monster Knight" script="data/npc/scripts/Monster Knight.lua" walkinterval="0" floorchange="0">

<health now="100" max="100"/>

<look type="302" head="114" body="114" legs="200" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Deseja virar um Monster Knight? "/>

</parameters>

</npc>

 

 

Monster Knight script.lua (renomeie para Monster Knight):

 

 

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, 'yes') or msgcontains(msg, 'sim')) then

selfSay('Diga {Monster Knight}.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'Monster Knight') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 2160) >= 100) then

doPlayerRemoveItem(cid, 2160, 100)

doPlayerSetVocation(cid,12)

selfSay('Agora você é um Monster Knight.', cid)

else

selfSay('Você não tem Dinheiro Suficiente.', cid)

end

talkState[talkUser] = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Edited by Newtonnotwen
Link to comment
Share on other sites

  • 0

Da tópico concluído nesse.

 

"Pedido Atendido!"

 

E faz outro sobre outra duvida.

 

 

----------------------------------------------Editado

 

Vlws pelo REP+ , agradecido.

Edited by Newtonnotwen
Link to comment
Share on other sites

×
×
  • Create New...