Postado Novembro 19, 2012 12 anos Boa terde, eu queria um NPC de leavce hunt, como funciona: players : Hi NPC : leave PLayers : leave NPC : pedido de confirmaçao, você tem certesa de que quer sair da hunt ? Players : yes e ele fosse transportado para essa localização X 32209 , Y 32252 , Z 15 bom mas ou menos isso XD rep + para quem ajudar.... se poder por o nome do NPC de Snake eu agradeço XD Bom eu tava pedindo ajuda, o Thiagobji tento me ajuda mas nuam funciono e eu agradeço, coim base nos dados do Thiago eu criei um pro meu ot não se se vai funciona com voces Vá em pasta do seu OT/data/npc crie um arvico Leave Hunt.xml Cole isso <?xml version="1.0" encoding="UTF-8"?> <npc name="Leave Hunt" script="data/npc/scripts/Leave Hunt.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="158" head="19" body="69" legs="107" feet="100" addons="2"/> <voices> <voice text="Passages to Leave Hunt." interval2="100" margin="1" yell="no"/> </voices> <parameters> <parameter key="message_farewell" value="Good bye. Recommend us if you were satisfied with our service." /> <parameter key="message_walkaway" value="Good bye. Recommend us if you were satisfied with our service." /> <parameter key="module_keywords" value="1" /> <parameter key="keywords" value="name;" /> <parameter key="keyword_reply1" value="My name is Leave Hunt from the Royal Tibia Line." /> <parameter key="message_greet" value="Welcome on board, |PLAYERNAME|. Where may I sail you today?"/> </parameters> </npc> Agora vá na pasta do seu OT/data/npc/scripts Crie um arquivo Leave Hunt.lua Obs : nao precisa colocar .lua ou .xml local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local Topic = {} -- OTServ event handling functions start 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 -- OTServ event handling functions end function greetCallback(cid) Topic[cid] = 1 return true end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false elseif msgcontains(msg, 'Leave') then npcHandler:say("Do you seek a passage to Yalahar for " .. (getConfigInfo("freeTravel") and "free?" or "0 gold?"), cid) Topic[cid] = 1 elseif Topic[cid] == 1 and msgcontains(msg, 'yes') then local storage = 88775 if doPlayerRemoveMoney(cid, 275) == true then if getPlayerStorageValue(cid, storage) == 1 then npcHandler:say('And, here we go!', cid) npcHandler:releaseFocus(cid) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) local yalahar = {x = 32209, y = 332252, z = 15} <------- Aqui é a position onde voce quer que os players vão parar doTeleportThing(cid, Vip city) doSendMagicEffect(Vip city, CONST_ME_TELEPORT) Topic[cid] = 0 else npcHandler:say('You have not helped Wyrdin! Come back when you have done so.', cid) Topic[cid] = 0 end else npcHandler:say('You do not have enough money.', cid) Topic[cid] = 0 end end return true end npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) CReditos 50% Thiago 50% pra min XD Editado Novembro 19, 2012 12 anos por Kozzz (veja o histórico de edições)
Postado Novembro 19, 2012 12 anos Pasta do seu OT/data/npc Leave Hunt.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Snake" script="data/npc/scripts/Leave Hunt.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="133" head="39" body="95" legs="0" feet="35" addons="1"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|. Voce quer sair dessa hunt {sairl}?"/> <parameter key="message_farewell" value="Tchau. Recomende-nos se você estivesse satisfeito com nosso serviço."/> </parameters> </npc> Pasta do seu OT/data/npc/scripts Leave Hunt.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer sair dessa hunt por 210 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 210, destination = {x=32209, y=32252, z=15} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn't go there either.'}) keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso te tirar da {hunt}, por um pequeno custo.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) NÃO TESTEI!
Postado Novembro 19, 2012 12 anos Autor Obrigado Rep + ta dando esse erro quando importo para o mapa. OBS: ja tentei com .xml e sem .xml e da o memso erro TOPICO resolvido. Editado Novembro 19, 2012 12 anos por Kozzz (veja o histórico de edições)
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.