Postado Fevereiro 6, 2015 10 anos Solução Só criar um arquivo de NPC, e por dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="The Oracle" floorchange="0" walkinterval="0"> <health now="150" max="150"/> <look typeex="1448"/> <interaction range="3" idletime="30"> <interact keywords="hi" focus="1"> <!--These are the keywords will trigger this interaction--> <keywords>hello</keywords> <keywords>greet</keywords> <response> <action name="script"> <!-- if(getPlayerVocation(cid) ~= 0) then selfSay("SORRY, YOU HAVE ALREADY MADE YOUR CHOICE IN LIFE!") _state.isidle = true return end --> if(getPlayerLevel(cid)) >= 8 then selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?") _state.b1 = (isPremium(cid) == true) _state.topic = 1 else selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!") _state.isidle = true end </action> </response> </interact> <interact keywords="yes" topic="1"> selfSay(getCreatureName(cid) .. ", WHAT KIND OF PROFESSIONAL DO YOU WANNA BE?") _stage.topic = 2 </interact> <interact keywords="sorcerer" topic="2"> <response text="A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 1 _state.topic = 3 </action> </response> </interact> <interact keywords="druid" topic="2"> <response text="A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 2 _state.topic = 3 </action> </response> </interact> <interact keywords="paladin" topic="2"> <response text="A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 3 _state.topic = 3 </action> </response> </interact> <interact keywords="knight" topic="2"> <response text="A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 4 _state.topic = 3 </action> </response> </interact> <!--If the player does not say any profession, repeat our question--> <interact keywords="|*|" topic="2"> <response text="KNIGHT, PALADIN, SORCERER, OR DRUID?"/> </interact> <interact keywords="yes" topic="3"> <response> <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore--> <!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid--> <action name="script"> selfSay("SO BE IT!") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doPlayerSetVocation(cid, _state.n2) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) </action> <action name="idle" value="1"/> </response> </interact> <interact keywords="bye" focus="0"> <keywords>farewell</keywords> <response text="Good bye. Recommend us, if you were satisfied with our service."/> </interact> <!-- If the event onBusy exists, the npc will make a queue like Tibia, if the event is removed the npc will be able to talk to all customers at the same time without problems. --> <interact event="onBusy"> <response text="WAIT UNTIL IT IS YOUR TURN!"> <action name="addqueue" value="|PLAYER|"/> </response> </interact> <!--This event triggers if the player goes to far away from the npc/logout/idle timeout--> <interact event="onPlayerLeave" focus="0"> <response text="COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!"/> </interact> </interaction> </npc> Se der erro me avisa, usei como base o The Oracle. Se ajudar rep+ =D Editado Fevereiro 6, 2015 10 anos por xBlackWolf (veja o histórico de edições) xBlackWolf THX @Storm Night Best Avatar Ever
Postado Fevereiro 7, 2015 10 anos Autor Só criar um arquivo de NPC, e por dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="The Oracle" floorchange="0" walkinterval="0"> <health now="150" max="150"/> <look typeex="1448"/> <interaction range="3" idletime="30"> <interact keywords="hi" focus="1"> <!--These are the keywords will trigger this interaction--> <keywords>hello</keywords> <keywords>greet</keywords> <response> <action name="script"> <!-- if(getPlayerVocation(cid) ~= 0) then selfSay("SORRY, YOU HAVE ALREADY MADE YOUR CHOICE IN LIFE!") _state.isidle = true return end --> if(getPlayerLevel(cid)) >= 8 then selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?") _state.b1 = (isPremium(cid) == true) _state.topic = 1 else selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!") _state.isidle = true end </action> </response> </interact> <interact keywords="yes" topic="1"> selfSay(getCreatureName(cid) .. ", WHAT KIND OF PROFESSIONAL DO YOU WANNA BE?") _stage.topic = 2 </interact> <interact keywords="sorcerer" topic="2"> <response text="A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 1 _state.topic = 3 </action> </response> </interact> <interact keywords="druid" topic="2"> <response text="A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 2 _state.topic = 3 </action> </response> </interact> <interact keywords="paladin" topic="2"> <response text="A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 3 _state.topic = 3 </action> </response> </interact> <interact keywords="knight" topic="2"> <response text="A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!"> <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight--> <action name="script"> _state.n2 = 4 _state.topic = 3 </action> </response> </interact> <!--If the player does not say any profession, repeat our question--> <interact keywords="|*|" topic="2"> <response text="KNIGHT, PALADIN, SORCERER, OR DRUID?"/> </interact> <interact keywords="yes" topic="3"> <response> <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore--> <!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid--> <action name="script"> selfSay("SO BE IT!") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doPlayerSetVocation(cid, _state.n2) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) </action> <action name="idle" value="1"/> </response> </interact> <interact keywords="bye" focus="0"> <keywords>farewell</keywords> <response text="Good bye. Recommend us, if you were satisfied with our service."/> </interact> <!-- If the event onBusy exists, the npc will make a queue like Tibia, if the event is removed the npc will be able to talk to all customers at the same time without problems. --> <interact event="onBusy"> <response text="WAIT UNTIL IT IS YOUR TURN!"> <action name="addqueue" value="|PLAYER|"/> </response> </interact> <!--This event triggers if the player goes to far away from the npc/logout/idle timeout--> <interact event="onPlayerLeave" focus="0"> <response text="COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!"/> </interact> </interaction> </npc> Se der erro me avisa, usei como base o The Oracle. Se ajudar rep+ =D Amigo como meu servidor tem vocações diferentes da normal pode me ensinar a configurar este npc? Quando vou sumonar o NPC pelo /n da este erro : [07/02/2015 10:16:40] [Error - LuaScriptInterface::loadFile] data/npc/scripts/vocation.lua:1: unexpected symbol near '<' [07/02/2015 10:16:40] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/vocation.lua [07/02/2015 10:16:40] data/npc/scripts/vocation.lua:1: unexpected symbol near '<' Pokémon Dust Evolution É aonde começa sua nova aventura!! Facebook Verifique Atualizações
Postado Fevereiro 7, 2015 10 anos Essa é a variavel que armazena o número da vocação, é só trocar os nomes por exemplo sorcerer, paladin etc.. e o numero da vocação: _state.n2 = 3 Não é para adicionar na pasta /scripts, esse é apenas o .xml do NPC. Oracle é um NPC diferente, não tem script. o Script todo está no .xml na pasta NPC. É só criar lá o NPC com esse código ai lá dentro. Editado Fevereiro 7, 2015 10 anos por xBlackWolf (veja o histórico de edições) xBlackWolf THX @Storm Night Best Avatar Ever
Postado Fevereiro 7, 2015 10 anos Autor aaa entendi agora vou la testar eu coloquei agora deu certo só que quando eu falo hi > yes ele fala que asim seja e eu praticamente me teleporto para nenhum lugar e ainda da este erro : [Warning - Vocations::getVocation] Vocation 4294967295 not found. é melhor vc explicar quais partes eu devo editar e como editar pf Consertei aqui e funcionou tudo direitinho!!! vlw Pokémon Dust Evolution É aonde começa sua nova aventura!! Facebook Verifique Atualizações
Postado Fevereiro 7, 2015 10 anos 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 local stg = 57894 if getPlayerStorageValue(cid, stg) < 1 then if msgcontains(msg:lower(), 'sorcerer') then npcHandler:say('A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!', cid) talkState[talkUser] = 1 elseif msgcontains(msg:lower(), 'druid') then npcHandler:say('A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!', cid) talkState[talkUser] = 2 elseif msgcontains(msg:lower(), 'paladin') then npcHandler:say('A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!', cid) talkState[talkUser] = 3 elseif msgcontains(msg:lower(), 'knight') then npcHandler:say('A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!', cid) talkState[talkUser] = 4 elseif msgcontains(msg:lower(), 'yes') then if talkState[talkUser] == 1 then doPlayerSetVocation(cid, 1) npcHandler:say('SO BE IT!', cid) setPlayerStorageValue(cid, stg, 1) talkState[talkUser] = 0 elseif talkState[talkUser] == 2 then doPlayerSetVocation(cid, 2) npcHandler:say('SO BE IT!', cid) setPlayerStorageValue(cid, stg, 1) talkState[talkUser] = 0 elseif talkState[talkUser] == 3 then doPlayerSetVocation(cid, 3) npcHandler:say('SO BE IT!', cid) setPlayerStorageValue(cid, stg, 1) talkState[talkUser] = 0 elseif talkState[talkUser] == 4 then doPlayerSetVocation(cid, 4) setPlayerStorageValue(cid, stg, 1) npcHandler:say('SO BE IT!', cid) talkState[talkUser] = 0 end elseif msgcontains(msg:lower(), 'no') then npcHandler:say(getCreatureName(cid) .. ', WHAT KIND OF PROFESSIONAL DO YOU WANNA BE? KNIGHT, PALADIN, SORCERER, OR DRUID?', cid) talkState[talkUser] = 0 elseif msgcontains(msg:lower(), 'bye') then npcHandler:say('Good bye.', cid) talkState[talkUser] = 0 end else npcHandler:say('YOU ALREADY HAVE VOCATION!', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) <?xml version="1.0" encoding="UTF-8"?> <npc name="Mendigo" script="data/npc/scripts/mendigo.lua" walkinterval="25" floorchange="0" access="5" lookdir="1" > <health now="150" max="150"/> <look type="133" head="95" body="86" legs="86" feet="38" addons="3"/> <parameters> <parameter key="message_greet" value="|PLAYERNAME|, WHAT KIND OF PROFESSIONAL DO YOU WANNA BE? KNIGHT, PALADIN, SORCERER, OR DRUID?"/> </parameters> </npc>
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.