Ir para conteúdo
  • 0

AJUDA - RainSystem


fawkz12

Pergunta

Meu erro é o seguinte !
[18/03/2016 17:15:36] [Warning - Spells::registerEvent] Duplicate registered instant spell with words: spell022
[18/03/2016 17:15:36] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/rainitems_command.lua:5: unexpected symbol near '['
[18/03/2016 17:15:36] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/rainitems_command.lua)
[18/03/2016 17:15:36] data/talkactions/scripts/rainitems_command.lua:5: unexpected symbol near '['
Script >>\/
local config = {
   items = {{2391,1}, {2392,2}, {2160,10}, {11638,1}, {11639,1}, {11640,1}, {14185,1}, {14188,1}, {14186, 1}},
   interval = 1000, -- time between checks
   areas = 
     [1] = {
       waves = 2,
       interval = 10000,
       chancePerTile = 10, -- %
       maxItemsPerWave = 7,
       from = {x = 1047, y = 1055, z = 7},
       to = {x = 1071, y = 1060, z = 7}
     },
}


function Position.isPathable(pos)
   local tile = Tile(pos)
   if tile == nil then
     return false
   end


   return not tile:hasFlag(TILESTATE_BLOCKSOLID)
end


function rainWave(arena)
   local from = config.areas[arena].from
   local to = config.areas[arena].to
   local items_spawned = 0
   for x = from.x, to.x do
   for y = from.y, to.y do
   for z = from.z, to.z do
     if math.random(1, 100) < config.areas[arena].chancePerTile and items_spawned < config.areas[arena].maxItemsPerWave then
       local pos = {x = x, y = y, z = z}
       if Position(pos):isPathable() then
         local item = math.random(1, #config.items)
         doCreateItem(config.items[item][1], math.random(1, config.items[item][2]), pos)
         Position(pos):sendMagicEffect(CONST_ME_MAGIC_RED)
         items_spawned = items_spawned + 1
       end
     end
   end
   end
   end
end


function startRain(arena)
   broadcastMessage("Uma Chuva de ITENS vem AE!")
   for i = 1, config.areas[arena].waves do
     if i == 1 then
       rainWave(arena)
     else
       addEvent(rainWave, config.areas[arena].interval * (i - 1), arena)
     end
   end
   addEvent(broadcastMessage, config.areas[arena].interval * (config.areas[arena].waves - 1), "Chuva PAROU.")
end


function onSay(player, words, param)
   if not player:getGroup():getAccess() then return false end
   
   if tonumber(param) then
     startRain(tonumber(param))
   else
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, words .. " eventid")
   end
   return false
end

 

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

×
×
  • Criar Novo...