- 0
Scripting Script que cria um monstro aleatório
Perguntado por
costickmichel
-
Quem Está Navegando 0 membros estão online
Nenhum usuário registrado visualizando esta página.
Perguntado por
costickmichel
Nenhum usuário registrado visualizando esta página.
Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:
https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/
https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/
Obs: não delete esse formulário pré-definido, preencha-o corretamente para postar o seu tópico!
Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).
Base:
Qual é a sua pergunta?
Olá amigos, estou com uma certa dificuldade em finalizar um script, criei todo script para que quando 5 player usam alavanca dão tp pra uma sala, nessa sala tem respawn aleatório de 5 boss, sendo que após o use da alavanca aleatoriamente o script crie um monstro. Porém após infinitas tentativas falhas, espero a ajuda de vocês. ( O SCRIPT FUNCIONA, PORÉM SO A PARTE DE CRIAR O BOSS RANDON NAO ESTA FUNCIONANDO E GOSTARIA DE AJUDA )
Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:
local config = {
centerRoom = Position(32207, 32048, 14),
bossPosition = Position(32207, 32048, 14),
newPosition = Position(32223, 32048, 14)
}
local bosses = {
{"Plagueroot"},
{"Malofur Mangrinder"},
{"Maxxenius"},
{"Alptramun"},
{"Izcandar The Banished"}
}
local function clearBosses()
local spectators = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
for i = 1, #spectators do
local spectator = spectators
if spectator:isPlayer() then
spectator:teleportTo(Position(32223, 32048, 14))
spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
spectator:say('Time out! You were teleported out by strange forces.', TALKTYPE_MONSTER_SAY)
elseif spectator:isMonster() then
spectator:remove()
end
end
end
local LeverBoss = Action()
function LeverBoss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 9825 then
if player:getPosition() ~= Position(32208, 32021, 13) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Pise no piso logo a frente da alavaca para ativa-la.")
item:transform(9825)
return true
end
end
if item.itemid == 9825 then
local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting white the Boss in the room.")
return true
end
end
for y = 32021, 32025 do
local playerTile = Tile(Position(32208, y, 13)):getTopCreature()
if playerTile and playerTile:isPlayer() then
if playerTile:getStorageValue(GlobalStorage.BossesDreamCourtsTimer) > os.time() then
playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
playerTile:teleportTo(config.newPosition)
playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
playerTile:setStorageValue(GlobalStorage.BossesDreamCourtsTimer, os.time() + 20 * 3600)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Boss.")
return true
end
end
end
local randomBoss = math.random(1, #bosses)
Game.createMonster(bosses, config.bossPosition, true, true)
--addEvent(clearBosses, 30 * 60 * 1000)
item:transform(9825)
elseif item.itemid == 9825 then
item:transform(9826)
end
return true
end
LeverBoss:aid(65500)
LeverBoss:register()
Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:
Compartilhar este post
Link para o post
Compartilhar em outros sites