Postado Setembro 2, 2022 2 anos Diretor NPC DE TELETRANSPORTE Nada mais diz, é um NPC que faz para teletransportar jogadores para lugares aleatórios e deixando o jogo mais interessante. INSTALANDO: 1 - vá em data/npc/scripts copie um arquivo .lua, renomeia a gosto, apague o que esta dentro e adicione o código abaixo: 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 local l3k0tpos = { {x = 1002, y = 1000, z = 7}, --trocar posisão 1 {x = 1003, y = 1000, z = 7}, --trocar posisão 2 {x = 1004, y = 1000, z = 7}, --trocar posisão 3 {x = 1004, y = 1000, z = 7} --trocar posisão 4 } 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, 'teleporte')) and talkState[talkUser] ~= 2 then selfSay('Gostaria de ir para um lugar aletorio? {yes} ou {no}.', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes')) and talkState[talkUser] == 1 then local l3k0t = l3k0tpos[math.random(#l3k0tpos)] doTeleportThing(cid, l3k0t) doSendMagicEffect(l3k0t, CONST_ME_TELEPORT) selfSay('Pronto! Boa jornada.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'no')) and talkState[talkUser] ~= 1 then talkState[talkUser] = 0 selfSay('Ok, até logo!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) 2 - agora em data/npc/ copie um arquivo .xml, renomeia a gosto e coloque o colodigo abaixo: <npc name="Teleporte" script="data/npc/scripts/npctelerandom.lua" floorchange="0" walkinterval="2000" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="128" head="79" body="95" legs="57" feet="106" addons="2"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME| posso te levar para um ilugar especial, deseja ir? é só dizer {teleporte}" /> </parameters> </npc> Créditos: @L3K0T agora é só por o npc no mapa e usar
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.