Lua Edit Zombie Event

Godz4t4n1c

Member
Joined
Sep 9, 2015
Messages
47
Reaction score
1
Good morning, I have a zombie mod event that is activated for days.

I would like you to help me put it in globalevents so that it activates in 2 or 3 hours, and when it is activated create a tp with a countdown and a countdown when it is missing so that the tp reappears.

[Lua] <?xml version="1.0" encoding="UTF-8"?> <mod name="Zombie_Event" version="3.0" a - Pastebin.com

Could you link it with this script?

Lua:
local tp = {
    itemID = 1387, -- Id del objeto que aparecerá haciendo de teleport.
    createPos = {x = 1200, y = 1135, z = 7}, -- Coordenada del lugar donde será creado el cual.
    takePlayer = {x = 232, y = 1526, z = 7}, -- Coordenada del lugar donde llevará a los jugadores.
    belero = { -- Efecto Mágico que aparecerá en el portal al...
      CONST_ME_TELEPORT, -- ...abrirse.
      CONST_ME_LOSEENERGY, -- ...cerrarse.
    },
    timePortal = { -- Tiempo que el portal permanecerá...
      opens = 10, -- ...abierto. (contado en Minutos)
      close = 18, -- ...cerrado. (contado en Horas)
    },
    countColor = COLOR_RED, -- Color de la cuenta atrás que transcurrirá hasta abrirse.
    msgabierto = "El Portal del Evento Run esta abierto!!!!, Corre que tienes 1 minuto para entrar!!",
    msgcerrado = "El evento run se acaba de cerrar!, se volvera abrir dentro de 3 horas.",
  }
function AnimatedTime(timeDiff, pos, color)
    if isNumber(timeDiff) then
      local dateFormat = {
        {"h", timeDiff / 60 / 60 % 24},
        {"m", timeDiff / 60 % 60},
        {"s", timeDiff % 60}
      }
      local out = {}
        for k, t in ipairs(dateFormat) do
          local v = math.floor(t[2])
            if(v > 0) then
                table.insert(out, v .. t[1])
            end
        end
      local ret = table.concat(out)
      return doSendAnimatedText(pos, ret, color)
    end
end
function CloseTP()
  local t = getTileItemById(tp.createPos, tp.itemID).uid
    if t > 0 then
        doRemoveItem(t)
        doSendMagicEffect (tp.createPos, tp.belero[2])
        doBroadcastMessage(tp.msgcerrado, MESSAGE_EVENT_ADVANCE)
    end
    for i = 0, tp.timePortal.close * 10 * 60 do
      local c = tp.timePortal.close * 10 * 60 - i
        addEvent(AnimatedTime, i * 1000, tostring(c), tp.createPos, tp.countColor)
    end
end
function OpenTP()
    doSendMagicEffect (tp.createPos, tp.belero[1])
    doCreateTeleport (tp.itemID, tp.takePlayer, tp.createPos)
    doBroadcastMessage(tp.msgabierto, MESSAGE_EVENT_ADVANCE)
    for i = 0, tp.timePortal.opens * 10 do
      local c = tp.timePortal.opens * 10 - i
        addEvent(AnimatedTime, i * 1000, tostring(c), tp.createPos, tp.countColor)
    end
    addEvent (CloseTP, tp.timePortal.opens * 10 * 1000)
    addEvent (OpenTP, (tp.timePortal.close * 10 * 60 * 1000) + (tp.timePortal.opens * 10 * 1000))
  return true
end
function onStartup()
    for i = 0, tp.timePortal.close * 10 * 60 do
      local c = tp.timePortal.close * 10 * 60 - i
        addEvent(AnimatedTime, i * 1000, tostring(c), tp.createPos, tp.countColor)
    end
    addEvent(OpenTP, tp.timePortal.close * 10 * 60 * 1000)
end
Thanks for your help..
 
Last edited:
Top