Por
tataboy67
Opa boa noite rapaziada, tudo bom?
Eu estou treinando um pouco scripts e acabei que tendo a ideia de fazer algo relacionado com as Guilds.
Então resolvi trazer 1 sistema de Guild Dungeon Lever para mim treinar
Estou em fase de treinamento, então por favor, deem dicas e criticas ao sistema ! Obrigado ...
Como o sistema funciona?
Terá uma alavanca com local para os jogadores de sua Guild ficarem... O jogador que estiver na posição principal e próxima a alavanca irá clicar na alavanca que fará com que todos entrem na Dungeon. Os jogadores terão um tempo "x" para terminar, porém se o tempo acabar, o jogador será teleportado de volta para a posição principal da alavanca (Aonde o jogador clicou).
Como configurar o script?
local config = {
time = 10, -- 1 Second. (1*60 To Minutes)
level = 100, -- Level Necessary.
dungeonPos = Position(1454, 909, 7), -- Dungeon Pos.
needPos = {
[1] = Position(1447, 915, 7), -- Position (where the player will click on the lever) and back position.
[2] = Position(1449, 914, 7)
},
fromPos = {x = 1449, y = 904, z = 7}, -- Position /\ < from the dungeon
toPos = {x = 1456, y = 911, z = 7}, -- Position \/ > from the dungeon
Storagetime = 39320, -- Storage Time.
StorageDay = 39321, -- Storage Day.
Timer = 24*60*60 -- To re-enter in the dungeon. (24hours)
}
time ------------------ Tempo que os jogadores ficarão dentro da Dungeon.
level ----------------- Nível que todos precisam ser para entrar.
dungeonPos ------ Posição que todos os jogadores serão teleportados.
needPos ------------ Posição que os jogadores devem estar para serem teleportados.
fromPos ------------- Posição SUPERIOR ESQUERDO da sala.
toPos ----------------- Posição INFERIOR DIREITO da sala.
Storagetime -------- Não mexer se não souber.
StorageDay ----------- Não mexer se não souber.
Timer ------------------ Tempo que o jogador terá que esperar para entrar novamente na Dungeon.
Sem mais delongas, vamos ao script:
Adicione a linha em:
(data/actions/actions.xml)
<!-- Script GUILD -->
<action actionid="29305" script="Dungeon_Guild.lua" />
Adicione a linha em:
(data/actions/scripts/Dungeon_Guild.lua)
local config = {
time = 5, -- 1 Second. (1*60 To Minutes) inside the dungeon.
level = 100, -- Level Necessary.
dungeonPos = Position(1454, 909, 7), -- Dungeon Pos.
needPos = {
[1] = Position(1447, 915, 7), -- Position (where the player will click on the lever) and back position.
[2] = Position(1449, 914, 7)
},
fromPos = {x = 1449, y = 904, z = 7}, -- Position /\ < from the dungeon
toPos = {x = 1456, y = 911, z = 7}, -- Position \/ > from the dungeon
Storagetime = 39320, -- Storage Time.
StorageDay = 39321, -- Storage Day.
Timer = 24*60*60 -- To re-enter in the dungeon. (24hrs)
}
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
local guild = player:getGuild()
for i = 1, #config.needPos do
local playerTile = Tile(config.needPos[i]):getTopCreature()
if not playerTile or not playerTile:isPlayer() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You need 2 players and stay on the orange floor.")
return true
end
if not playerTile:getGuild() and not player:getGuild() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return player:sendTextMessage(MESSAGE_STATUS_SMALL, "One of the members does not have guild.")
end
if playerTile:getLevel() < config.level then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level "..config.level.." or higher.")
end
if player:getGuild():getId() ~= playerTile:getGuild():getId() then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Only players in your guild can join you.")
end
if player:getStorageValue(config.Storagetime) - os.time() > 0 and playerTile:getStorageValue(config.Storagetime) - os.time() > 0 then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
if player:getStorageValue(config.StorageDay) - os.time() > 0 and playerTile:getStorageValue(config.StorageDay) - os.time() > 0 then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You're in cooldown to enter in a dungeon again. Cooldown: %s.", string.diff(player:getStorageValue(config.StorageDay)-os.time())))
return false
end
local players = {}
for x = config.fromPos.x, config.toPos.x do
for y = config.fromPos.y, config.toPos.y do
for z = config.fromPos.z, config.toPos.z do
local tile = Tile(x, y, z)
local creature = tile:getTopCreature()
if creature and creature:isPlayer() then
players[#players+1] = creature
end
end
end
end
if #players > 0 then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Already has a guild inside.")
end
player:teleportTo(config.dungeonPos)
playerTile:teleportTo(config.dungeonPos)
playerTile:getPosition():sendMagicEffect(50)
addEvent(function()
player:teleportTo(config.needPos[i])
playerTile:teleportTo(config.needPos[i])
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
playerTile:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:setStorageValue(config.StorageDay, os.time() + config.Timer)
playerTile:setStorageValue(config.StorageDay, os.time() + config.Timer)
end, config.time*1000)
return false
end
return true
end
Créditos:
@KotZletY
E eu
Espero que gostem ? ...
Edit* Adicionado Tempo para que você possa entrar novamente na Dungeon:
Rep+
Posts Recomendados
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.