Informações
- Apresento-lhes um mod simples, mas muito útil para servidores com mapas próprios. Ele faz com que o jogador passe por certos locais, sem poder se mexer nem entrar em combate, recebendo caixas de diálogo com informações sobre cada local
- Basta adicionar o código na pasta mods do seu servidor como tourMod.xml
- O comando é ativado in-game usando /tour ou !tour
- Só pode ser ativado em PZ
- A duração de cada posição é configurável
- Caso haja algum erro, GMs podem usar o comando /tour debug para finalizar o tour de todos os jogadores online
Código
<?xml version="1.0" encoding="UTF-8"?> <mod name="Tour System" version="1.0" author="Leoric(Omega)" enabled="yes"> <config name="tourLib"><![CDATA[ tourLocations = { [1] = {pos={x=160, y=50, z=7},duration=15}, [2] = {pos={x=154, y=39, z=7},duration=20}, [3] = {pos={x=125, y=80, z=7},duration=10}, [4] = {pos={x=122, y=57, z=7}, duration=15}, } tourDesc = { [1] = "Teste1.", [2] = "Teste2", [3] = "Teste3", [4] = "Teste4\nTeste5.", } tourStorage = 13050 function startTour(cid) setPlayerStorageValue(cid,tourStorage,1) mayNotMove(cid, true) local totalTime = 0 for _,tempo in ipairs(tourLocations) do totalTime = totalTime + tempo.duration end doPlayerPopupFYI(cid, "Enquanto voce esta fazendo um tour pelo mapa, voce nao podera dar logout nem se mexer.\nO Tour tem duracao de "..totalTime.." segundos\nO Tour comecara em 10 segundos.") addEvent(doTour,10000,cid) end function doTour(cid) local lastPos = getCreaturePosition(cid) doTeleportThing(cid,tourLocations[1].pos) doPlayerPopupFYI(cid,tourDesc[1]) local time = tourLocations[1].duration for i=2,#tourLocations do addEvent(doTeleportThing,time*1000,cid,tourLocations[i].pos) addEvent(doPlayerPopupFYI,time*1000,cid,tourDesc[i]) addEvent(doSendMagicEffect,time*1000,tourLocations[i].pos,10) time = time + tourLocations[i].duration end addEvent(setPlayerStorageValue,time*1000,cid,tourStorage,-1) addEvent(doTeleportThing,time*1000,cid,lastPos) addEvent(doPlayerSendTextMessage,time*1000,cid,21,"O Tour terminou, esperamos que tenha gostado!") addEvent(mayNotMove,time*1000,cid,false) end ]]></config> <event type="login" name="tourLogin" event="script"><![CDATA[ domodlib('tourLib') function onLogin(cid) registerCreatureEvent(cid, "tourChange") registerCreatureEvent(cid, "tourCombat") if getPlayerStorageValue(cid,tourStorage) ~= -1 then setPlayerStorageValue(cid,tourStorage, -1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end return true end ]]></event> <event type="combat" name="tourCombat" event="script"><![CDATA[ domodlib('tourLib') function onCombat(cid, target) if getPlayerStorageValue(cid, tourStorage) ~= -1 then return false end end ]]></event> <event type="statschange" name="tourChange" event="script"><![CDATA[ domodlib('tourLib') function onStatsChange(cid, attacker, type) if getPlayerStorageValue(cid, tourStorage) ~= -1 and type == 1 then return false end return true end ]]></event> <event type="logout" name="tourLogout" event="script"><![CDATA[ domodlib('tourLib') function onLogout(cid) if getPlayerStorageValue(cid,tourStorage) ~= -1 then doPlayerSendTextMessage(cid,21,'Voce nao pode logar enquanto estiver no Tour.') return false end return true end ]]></event> <talkaction words="/tour;!tour" event="buffer"><![CDATA[ domodlib('tourLib') if param == 'debug' and getPlayerGroupId(cid) > 3 then for _,pid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(pid,tourStorage) ~= -1 then setPlayerStorageValue(pid,tourStorage,-1) mayNotMove(pid,false) doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid))) doRemoveCreature(pid) end end return true end if getPlayerStorageValue(cid,tourStorage) == -1 then if getTilePzInfo(getCreaturePosition(cid)) == true then startTour(cid) else doPlayerSendTextMessage(cid,27,'Voce so pode comecar um tour se estiver em uma area PZ.') end else doPlayerSendTextMessage(cid,27,'Voce ja esta em um Tour!') end return true ]]></talkaction> </mod>
Configuração
- As posições para as quais o jogador será levado e o tempo pelo qual ele ficará em cada posição são configuráveis em tourLocations, seguindo o padrão
- Depois de cada duração, você deve configurar a mensagem que o jogador irá receber em tourDesc, usando a mesma numeração