Postado Dezembro 2, 2014 11 anos Booom dia TK! Estava precisando criar um NPC que só me teleportaria se eu tivesse sem Battle (). Tai o .lua do NPC Teleportador. 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({'sala de teleports'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce deseja voltar para Sala de Teleports?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 2, cost = 100, destination = {x=4100, y=5201, z=6} }) 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 levar para a \'Sala de Teleports\' por 100 gps.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) Obrigado desde já.
Postado Dezembro 2, 2014 11 anos Não testei. 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 if(msgcontains(msg, 'destination')) then selfSay('Eu posso te levar para a Sala de Teleports por 100 gps. Voce deseja ir?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveMoney(cid, 100)) then selfSay('Prontinho.', cid) else selfSay('Voce não tem 100 GPS', cid) end elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then selfSay('Tudo bem então.', cid) return false end end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Tony Araújo
Postado Janeiro 11, 2016 9 anos desculpem reviver este tópico, mas esse script realmente funciona? estou precisando de algo parecido :D
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.