• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    error mod globalvent

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1default error mod globalvent Dom Mayo 16, 2021 8:25 am

    ioke

    ioke
    Miembro
    Miembro
    Descripcion escribió:hola, usaba este mod y no se porque al principio funcionaba pero ahora me da error en el global event si me pueden ayudar.

    Código:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <mod name="Fire Storm Event" enabled="yes">
    <config name="fireStorm_conf"><![CDATA[
    fireStormRewards = {
                  random = false,
                  rew = {6527,1}
                  }
    fireStormShootInterval = 8 --in seconds
    fireStormNewFireShoots = 15
    fireStormBaseFireShoots = 40
    fireStormMaxPlayers = 50
    fireStormMinPlayers = 2
    fireStormAccesToIgnore = 7
    timeOnJoinToEvent = 3 --in minutes
     
    fireStormJoinType = 'booth' --movement, talkaction or booth
    enableMessage = true
     
    -- POSITIONS
    fireStormKickPosition = {x=159,y=51,z=7}
    fireStormEnterPosition = {x=206,y=367,z=7}
     
    fireStormCenterRoomPosition = {x=206,y=367,z=7}
    fireStormRangeX_RangeY = {30,30}
    -- STORAGES
    fireStormStorageStatus = 31000 -- =< 0 - off, 1 - waiting for players, 2 - is running
     
    local _f = doTeleportThing
    function doTeleportThing(cid, newpos, ignoreBlocking)
      return (ignoreBlocking or isWalkable(newpos, true, true, false) or false) and _f(cid, newpos, true, true)
    end
     
    function kickPlayerFromFireStormArea(cid)
      doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
      doTeleportThing(cid, fireStormKickPosition, true)
      doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
      return doCreatureSetStorage(cid, fireStormStorageStatus, 0) and doCreatureSetNoMove(cid, false)
    end
     
    function getFireStormEventPlayers()
      local players = {}
      for _, cid in pairs(getPlayersOnline()) do
          if getCreatureStorage(cid, fireStormStorageStatus) == 1 then
            table.insert(players, cid)
          end
      end
      return players
    end
     
    function isWalkable(pos, creature, proj, pz)
    if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
      pos.stackpos = i
      local tile = getTileThingByPos(pos)
          if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
          end
    end
    return true
    end
     
    function loseOnFireStorm(cid)
        local players, msg = getFireStormEventPlayers(), ''
        kickPlayerFromFireStormArea(cid)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are dead.')
        if(#getFireStormEventPlayers() <= 1) then
            local winner = getFireStormEventPlayers()[1] or players[1]
            if winner then
                if fireStormRewards.random then
                local i = math.random(#fireStormRewards.rew/2)
                doPlayerAddItem(winner, fireStormRewards.rew[i*2-1], fireStormRewards.rew[i*2], true)
            else
                for i = 1, #fireStormRewards.rew/2 do
                  doPlayerAddItem(winner, fireStormRewards.rew[i*2-1], fireStormRewards.rew[i*2], true)
                end
            end
            doPlayerSendTextMessage(winner, MESSAGE_INFO_DESCR, 'You won Fire Storm Event.')
                msg = getCreatureName(winner) .. ' won Fire Storm Event.'
                kickPlayerFromFireStormArea(winner)
            if getSpectators(fireStormCenterRoomPosition, fireStormRangeX_RangeY[1], fireStormRangeX_RangeY[2]) then
                for _, v in ipairs(getSpectators(fireStormCenterRoomPosition, fireStormRangeX_RangeY[1], fireStormRangeX_RangeY[2])) do
                  if isMonster(v) then
                      doRemoveThing(v)
                  elseif isPlayer(v) then
                      kickPlayerFromFireStormArea(v)
                  end
                end
            end
            else
                msg = 'Fire Storm Event finished! No one win!'
            end
          doSetStorage(fireStormStorageStatus, 0)
        end
    return (msg ~= '' and doBroadcastMessage(msg) or true)
    end
     
    function spawnNewFire(count, reserved)
    for i = 1, count do
      if getStorage(fireStormStorageStatus) <= 1 then
          return true
      end
      local pos = {x = fireStormCenterRoomPosition.x + math.random(-fireStormRangeX_RangeY[1],fireStormRangeX_RangeY[1]), y = fireStormCenterRoomPosition.y + math.random(-fireStormRangeX_RangeY[2],fireStormRangeX_RangeY[2]), z = fireStormCenterRoomPosition.z}
      if i == count then
          return addEvent(spawnNewFire, fireStormShootInterval*1000, fireStormNewFireShoots + reserved, fireStormNewFireShoots + reserved)
      end
      if isWalkable(pos, false, true, true) then
          addEvent(function()
                      if #getFireStormEventPlayers() < 1 then
                        return true
                      end
                      local xx = math.abs(pos.x - fireStormCenterRoomPosition.x) + fireStormRangeX_RangeY[1]
                      local yy = math.abs(pos.y - fireStormCenterRoomPosition.y) + fireStormRangeX_RangeY[2]
                      doSendDistanceShoot({x=pos.x-xx,y=pos.y-yy,z=pos.z}, pos, CONST_ANI_FIRE)
                      addEvent(doSendMagicEffect, math.max(xx,yy)*15, pos, CONST_ME_HITBYFIRE)
                      local player = getThingFromPos({x=pos.x,y=pos.y,z=pos.z,stackpos=STACKPOS_TOP_CREATURE}).uid
                      if isPlayer(player) and getPlayerAccess(player) < fireStormAccesToIgnore then
                        addEvent(loseOnFireStorm, 500, player)
                      end return true end,
                      math.random(500, fireStormShootInterval*1000),
                      pos)
      else
          return spawnNewFire(count-(i-1), math.max(reserved, count))
      end
    end
    return true
    end
     
    function addPlayerToFireStormArea(cid, block)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, fireStormEnterPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    return doCreatureSetStorage(cid, fireStormStorageStatus, 1) and doCreatureSetNoMove(cid, block)
    end
     
    function startFireStormEvent()
    if getStorage(fireStormStorageStatus) > 0 then
      return false
    end
    doSetStorage(fireStormStorageStatus, 1)
    return enableMessage and doBroadcastMessage('Fire Storm Event is active. We are waiting for ' .. fireStormMaxPlayers - #getFireStormEventPlayers() .. ' players or, if not found, '..timeOnJoinToEvent..' minutes to start. If you want joined to event just use command "!fire join", but if you would leave fire storm arena just say "!fire leave". Have fun!') or true
    end
    ]]></config>
     
    <talkaction words='!fire' event='script'><![CDATA[
    domodlib('fireStorm_conf')
    function onSay(cid, words, param, channel)
    if fireStormJoinType == 'movement' then
      return false end
    local msg = ''
    if isInArray({'join','add','go','joined'}, param:lower()) then
      if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= fireStormAccesToIgnore then
          return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have a PZ! You have to get rid of it. Somehow.')
      end
      if getPlayerAccess(cid) >= fireStormAccesToIgnore then
          startFireStormEvent()
          return doTeleportThing(cid, fireStormEnterPosition, true)
      elseif #getFireStormEventPlayers() < fireStormMaxPlayers and getStorage(fireStormStorageStatus) == 1 then
          addPlayerToFireStormArea(cid, true)
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getFireStormEventPlayers()..', which join to event.')
          if #getFireStormEventPlayers() == fireStormMaxPlayers then
            doSetStorage(fireStormStorageStatus, 2)
            addEvent(spawnNewFire, fireStormShootInterval * 1000, fireStormBaseFireShoots, fireStormBaseFireShoots)
            for _, v in pairs(getFireStormEventPlayers()) do
                addPlayerToFireStormArea(v, false)
            end
            msg = 'Fire Storm Event is started. We have ' .. fireStormMaxPlayers .. ' players, which joined to event. Have fun!'
          else
            msg = getCreatureName(cid) .. ' has entered a Fire Storm Arena. We still need ' .. fireStormMaxPlayers - #getFireStormEventPlayers() .. ' players.'
          end
          return (msg ~= '' and doBroadcastMessage(msg) or true)
      else
          return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.')
      end
    elseif isInArray({'leave','abort','delete'}, param:lower()) then
      if getStorage(fireStormStorageStatus) < 2 then
          doCreatureSetNoMove(cid, false)
          doCreatureSetStorage(cid, fireStormStorageStatus, 0)
          return doTeleportThing(cid, getCreatureLastPosition(cid), true)
      end
      return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can\'t leave from arena if event is already running.')
    end
    return true
    end
    ]]></talkaction>
     
    <globalevent name="fireStormTime" time="03:49" event="script"><![CDATA[
    domodlib("fireStorm_conf")
    function onTime(time)
      addEvent(function()
                      if getStorage(fireStormStorageStatus) == 2 then return true end
                      if getStorage(fireStormStorageStatus) == 1 and #getFireStormEventPlayers() >= fireStormMinPlayers then
                        doSetStorage(fireStormStorageStatus, 2)
                        addEvent(spawnNewFire, fireStormShootInterval * 1000, fireStormBaseFireShoots, fireStormBaseFireShoots)
                        for _, v in ipairs(getFireStormEventPlayers()) do
                            addPlayerToFireStormArea(v, false)
                        end
                        return enableMessage and doBroadcastMessage('Fire Storm Event is started. We have '..#getFireStormEventPlayers()..' players on area') or true
                      end
                      for _, v in ipairs(getFireStormEventPlayers()) do
                        kickPlayerFromFireStormArea(v)
                      end
                      return enableMessage and doBroadcastMessage('Fire Storm Event is stopped. We could not find enough players.') or true
                      end,
                      timeOnJoinToEvent * 1000 * 60)
      return startFireStormEvent()
    end
    ]]></globalevent>
    </mod>


    este es el fallo.en la.consola

    Código:
    [Error - GlobalEvents::timer] Couldn't execute event: fireStormTime
    Captura del Error escribió:Imagen del error: error mod globalvent Empty
    El error radica en: GlobalEvents

    4 participantes
    http://baiakciteron.sytes.net

    2default Re: error mod globalvent Lun Mayo 17, 2021 3:34 am

    lsenturion

    lsenturion
    Miembro
    Miembro
    Tienes una lib que interrumpe el mod

    4 participantes
    http://krudaserver.com

    3default Re: error mod globalvent Lun Mayo 17, 2021 9:33 am

    ioke

    ioke
    Miembro
    Miembro
    Pero hace mucho lo toco lib y antes funcionaba

    4 participantes
    http://baiakciteron.sytes.net

    4default Re: error mod globalvent Lun Mayo 17, 2021 2:21 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:Pero hace mucho lo toco lib y antes funcionaba

    en ves de time

    ponle timer

    Código:
    <globalevent name="fireStormTime" timer="03:49" event="script">



    error mod globalvent YNU5B25
    4 participantes
    https://www.tibiaface.com

    5default Re: error mod globalvent Lun Mayo 17, 2021 3:59 pm

    ioke

    ioke
    Miembro
    Miembro
    [21:56:24.450] > Loading FireStorm.xml...[Error - GlobalEventEvent] No interval for globalevent with name fireStormTime
    [21:56:24.466] [Warning - BaseEventsFromXml] Cannot configure an event

    en los otros mods de evento uso time igual mira

    Código:
    <globalevent name="StartPaintBall    " time="20:00" event="script"><![CDATA[
          domodlib('config')
          function onTime()
             if t.main.event_config.start_automatically then
                doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                if t.main.event_config.use_waiting_room then
                   addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                   doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                else
                   if t.main.tfs_version == "0.3" then
                      doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                   else
                      doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                   end
                   if(t.main.event_config.event_duration > 0) then
                      addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                   end
                end
             end
          return true
          end
          
          function endPaintball()
             local score = {}
             if not t.main.event_config.use_waiting_room then
                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
             end
             for _, pid in ipairs(getPlayersOnline()) do
                if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                   table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                   doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                   doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                   doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                   doTeleportThing(pid, t.main.positions.event_ending_pos)
                end
             end
             table.sort(score, function(a, b) return a[2] > b[2] end)
             if table.getn(score) > 0 then
                if t.main.event_config.winner_gets_item then
                   for _, pid in ipairs(getPlayersOnline()) do
                      if getCreatureName(pid) == score[1][1] then
                         doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                         break
                      end
                   end
                end
                doBroadcastMessage("Paintball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
             end
          end
          local t_l = t.main.positions.paintball_spawn_area.top_left
          local b_r = t.main.positions.paintball_spawn_area.bottom_right
          function moveToEvent()
             for _, pid in ipairs(getPlayersOnline()) do
                if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                   doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                   doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                   doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                   doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                   doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                end
             end
             doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
             addEvent(endPaintball, t.main.event_config.event_duration*1000*60)



    y este no me da error funciona bien

    4 participantes
    http://baiakciteron.sytes.net

    6default Re: error mod globalvent Lun Mayo 17, 2021 4:12 pm

    lsenturion

    lsenturion
    Miembro
    Miembro
    Código:
    local cf = {
       teleportPosition = {x = 992, y = 996, z = 7, stackpos = 1}, -- Where the teleport will be created
       teleportToPosition = {x = 7510, y = 7510, z = 7}, -- Where the teleport will take you
       from = {x=7492,y=7492,z=7}, -- left top corner of event room
       to = {x=7526,y=7530,z=7} -- right bottom corner of event room
    }

    function onTime ()
       doItemSetAttribute(doCreateTeleport(1387, cf.teleportToPosition, cf.teleportPosition), "aid", 1747)
       doBroadcastMessage("FireStorm event starting in 3 minutes, come {Eventzone}, The teleport will be closed when the event start!", 21)
       setGlobalStorageValue(17, 0)
       addEvent(startEventF, 3 * 60 * 1000)
       return true
    end

    function startEventF ()
       doRemoveItem(getTileItemById(cf.teleportPosition, 1387).uid, 1)
       if getGlobalStorageValue(17) > 0 then
          addEvent(doRepeatCheckFireStorm, 1 * 60 * 1000)
          doBroadcastMessage("Good luck in the FireStorm event people! The teleport has closed!", 21)
       else
          doBroadcastMessage('FireStorm Event hasn\'t started beacuse there were not enough players.')
       end
    end

    y, x = 1, 1

    function doRepeatCheckFireStorm ()
       if getGlobalStorageValue(17) > 0 then
          local xTable, yTable, playerTable = {}, {}, {}
          
          for x = cf.from.x, cf.to.x do
             for y = cf.from.y, cf.to.y do
                table.insert(xTable, x)
                table.insert(yTable, y)
                
                local n, i = getTileInfo({x=x, y=y, z=cf.to.z}).creatures, 1
                if n ~= 0 then
                   local v = getThingfromPos({x=x, y=y, z=cf.to.z, stackpos=i}).uid
                   while v ~= 0 do
                      if isPlayer(v) then
                         table.insert(playerTable, v)
                         if n == #playerTable then
                            break
                         end
                      end
                      i = i + 1
                      v = getThingfromPos({x=x, y=y, z=cf.to.z, stackpos=i}).uid
                   end
                end
             end
          end
          
          if #playerTable == 1 then
             doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
             doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
             doTeleportThing(playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
             doItemSetAttribute(doPlayerAddItem(playerTable[1], 7371), "name", "trophy " .. getCreatureName(playerTable[1]) .. "! Congratulations! Winner a fire event")
             doPlayerAddItem(playerTable[1],9971,5)
             doPlayerAddItem(playerTable[1],10559,30)
             doBroadcastMessage('FireStorm Event has finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.')
             setGlobalStorageValue(17, 0)
             
             x, y = 1, 1
          elseif #playerTable > 1 then
             for a = 1, y do
                local pos = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}
                for _, player in ipairs(playerTable) do
                   local pPos = getThingPos(player)
                   if pPos.x == pos.x and pPos.y == pos.y and pPos.z == pos.z then
                      doCreatureAddHealth(player, - getCreatureMaxHealth(player))
                   end
                end
                doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
                addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
                addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
                math.random(100,1000)
             end
             if x == 5 * y then
                y = y + 1
             end
             
             x = x + 1
          else
             doBroadcastMessage('No one have won in Fire Storm Event.')
             setGlobalStorageValue(17, 0)
             x, y = 1, 1
          end
          
          addEvent(doRepeatCheckFireStorm, 1000)
       end
    end

    y esto en globalevents.xml

    Código:
    <globalevent name="firestormevent" time="2:00" event="script" value="events/FireStorm.lua"/>

    4 participantes
    http://krudaserver.com

    7default Re: error mod globalvent Lun Mayo 17, 2021 10:09 pm

    maneliiyoh

    maneliiyoh
    Miembro
    Miembro
    este es el que tengo yo en mi servidor y me funciona bien

    ot/data/globalevents/scripts/events

    hay dentro creas un archivo llamado FireStorm.lua y dentro añades esto:

    Código:
    local cf = {
    teleportPosition = {x = 172, y = 48, z = 7, stackpos = 1}, -- Where the teleport will be created
    teleportToPosition = {x = 2194, y = 2049, z = 7}, -- Where the teleport will take you
    from = {x=2172,y=2042,z=7}, -- left top corner of event room
    to = {x=2217,y=2062,z=7} -- right bottom corner of event room
    }

    function onTime ()
    doItemSetAttribute(doCreateTeleport(1387, cf.teleportToPosition, cf.teleportPosition), "aid", 1747)
    doBroadcastMessage("FireStorm event starting in 3 minutes! The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
    setGlobalStorageValue(17, 0)
    addEvent(startEventF, 3 * 60 * 1000)
    return true
    end

    function startEventF ()
    doRemoveItem(getTileItemById(cf.teleportPosition, 1387).uid, 1)
    if getGlobalStorageValue(17) > 0 then
    addEvent(doRepeatCheckFireStorm, 5 * 1000)
    doBroadcastMessage("Good luck in the FireStorm event people! The teleport has closed!", MESSAGE_STATUS_WARNING)
    else
    doBroadcastMessage('FireStorm Event hasn\'t started beacuse there were not enough players.')
    end
    end

    y, x = 1, 1

    function doRepeatCheckFireStorm ()
    if getGlobalStorageValue(17) > 0 then
    local xTable, yTable, playerTable = {}, {}, {}

    for x = cf.from.x, cf.to.x do
    for y = cf.from.y, cf.to.y do
    table.insert(xTable, x)
    table.insert(yTable, y)

    local n, i = getTileInfo({x=x, y=y, z=cf.to.z}).creatures, 1
    if n ~= 0 then
    local v = getThingfromPos({x=x, y=y, z=cf.to.z, stackpos=i}).uid
    while v ~= 0 do
    if isPlayer(v) then
    table.insert(playerTable, v)
    if n == #playerTable then
    break
    end
    end
    i = i + 1
    v = getThingfromPos({x=x, y=y, z=cf.to.z, stackpos=i}).uid
    end
    end
    end
    end

    if #playerTable == 1 then
    doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
    doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
    doTeleportThing(playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
    doItemSetAttribute(doPlayerAddItem(playerTable[1], 7371), "name", "trophy " .. getCreatureName(playerTable[1]) .. "! Congratulations! Winner a fire event")
    doPlayerAddItem(playerTable[1],9971,50)
    doPlayerAddItem(playerTable[1],6527,400)
    doBroadcastMessage('FireStorm Event has finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.')
    setGlobalStorageValue(17, 0)

    x, y = 1, 1
    elseif #playerTable > 1 then
    for a = 1, y do
    local pos = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}
    for _, player in ipairs(playerTable) do
    local pPos = getThingPos(player)
    if pPos.x == pos.x and pPos.y == pos.y and pPos.z == pos.z then
    doCreatureAddHealth(player, - getCreatureMaxHealth(player))
    end
    end
    doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
    addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
    addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
    math.random(100,1000)
    end
    if x == 5 * y then
    y = y + 1
    end

    x = x + 1
    else
    doBroadcastMessage('No one have won in Fire Storm Event.')
    setGlobalStorageValue(17, 0)
    x, y = 1, 1
    end

    addEvent(doRepeatCheckFireStorm, 1000)
    end
    end







    luego en ot/data/globalevents/globalevents.xml

    dentro pegas esto:
    Código:

    <globalevent name="firestorm" time="15:00" event="script" value="events/FireStorm.lua"/>
        <globalevent name="firestorm2" time="10:00" event="script" value="events/FireStorm.lua"/>


    ESPERO QUE TE SIRVA A TI Y AH LOS DEMAS USUARIOS !

    4 participantes

    8default Re: error mod globalvent Mar Mayo 18, 2021 2:29 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:Pero hace mucho lo toco lib y antes funcionaba

    intenta usar este

    Código:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <mod name="Fire Storm Event" enabled="yes">
    <config name="fireStorm_conf"><![CDATA[
    fireStormRewards = {
                   random = false,
                   rew = {2157,5,6119,1}
                   }
    fireStormShootInterval = 8 --in seconds
    fireStormNewFireShoots = 15
    fireStormBaseFireShoots = 40
    fireStormMaxPlayers = 2
    fireStormMinPlayers = 1
    fireStormAccesToIgnore = 5
    timeOnJoinToEvent = 10 --in minutes

    fireStormJoinType = 'booth' --movement, talkaction or booth
    enableMessage = true

    -- POSITIONS
    fireStormKickPosition = {x=1000,y=1000,z=7}
    fireStormEnterPosition = {x=522,y=1253,z=7}

    fireStormCenterRoomPosition = {x=522,y=1253,z=7}
    fireStormRangeX_RangeY = {16,16}
    -- STORAGES
    fireStormStorageStatus = 31000 -- =< 0 - off, 1 - waiting for players, 2 - is running

    local _f = doTeleportThing
    function doTeleportThing(cid, newpos, ignoreBlocking)
       return (ignoreBlocking or isWalkable(newpos, true, true, false) or false) and _f(cid, newpos, true, true)
    end

    function kickPlayerFromFireStormArea(cid)
       doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
       doTeleportThing(cid, fireStormKickPosition, true)
       doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
       return doCreatureSetStorage(cid, fireStormStorageStatus, 0) and doCreatureSetNoMove(cid, false)
    end
     
    function getFireStormEventPlayers()
       local players = {}
       for _, cid in pairs(getPlayersOnline()) do
          if getCreatureStorage(cid, fireStormStorageStatus) == 1 then
             table.insert(players, cid)
          end
       end
       return players
    end

    function isWalkable(pos, creature, proj, pz)
    if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
       pos.stackpos = i
       local tile = getTileThingByPos(pos)
          if tile.itemid ~= 0 and not isCreature(tile.uid) then
             if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
             end
          end
    end
    return true
    end

    function loseOnFireStorm(cid)
        local players, msg = getFireStormEventPlayers(), ''
        kickPlayerFromFireStormArea(cid)
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are dead.')
        if(#getFireStormEventPlayers() <= 1) then
            local winner = getFireStormEventPlayers()[1] or players[1]
            if winner then
                if fireStormRewards.random then
                local i = math.random(#fireStormRewards.rew/2)
                doPlayerAddItem(winner, fireStormRewards.rew[i*2-1], fireStormRewards.rew[i*2], true)
             else
                for i = 1, #fireStormRewards.rew/2 do
                   doPlayerAddItem(winner, fireStormRewards.rew[i*2-1], fireStormRewards.rew[i*2], true)
                end
             end
             doPlayerSendTextMessage(winner, MESSAGE_INFO_DESCR, 'You won Fire Storm Event.')
                msg = getCreatureName(winner) .. ' won Fire Storm Event.'
                kickPlayerFromFireStormArea(winner)
             if getSpectators(fireStormCenterRoomPosition, fireStormRangeX_RangeY[1], fireStormRangeX_RangeY[2]) then
                for _, v in ipairs(getSpectators(fireStormCenterRoomPosition, fireStormRangeX_RangeY[1], fireStormRangeX_RangeY[2])) do
                   if isMonster(v) then
                      doRemoveThing(v)
                   elseif isPlayer(v) then
                      kickPlayerFromFireStormArea(v)
                   end
                end
             end
            else
                msg = 'Fire Storm Event finished! No one win!'
            end
          doSetStorage(fireStormStorageStatus, 0)
        end
    return (msg ~= '' and doBroadcastMessage(msg) or true)
    end

    function spawnNewFire(count, reserved)
    for i = 1, count do
       if getStorage(fireStormStorageStatus) <= 1 then
          return true
       end
       local pos = {x = fireStormCenterRoomPosition.x + math.random(-fireStormRangeX_RangeY[1],fireStormRangeX_RangeY[1]), y = fireStormCenterRoomPosition.y + math.random(-fireStormRangeX_RangeY[2],fireStormRangeX_RangeY[2]), z = fireStormCenterRoomPosition.z}
       if i == count then
          return addEvent(spawnNewFire, fireStormShootInterval*1000, fireStormNewFireShoots + reserved, fireStormNewFireShoots + reserved)
       end
       if isWalkable(pos, false, true, true) then
          addEvent(function()
                      if #getFireStormEventPlayers() < 1 then
                         return true
                      end
                      local xx = math.abs(pos.x - fireStormCenterRoomPosition.x) + fireStormRangeX_RangeY[1]
                      local yy = math.abs(pos.y - fireStormCenterRoomPosition.y) + fireStormRangeX_RangeY[2]
                      doSendDistanceShoot({x=pos.x-xx,y=pos.y-yy,z=pos.z}, pos, CONST_ANI_FIRE)
                      addEvent(doSendMagicEffect, math.max(xx,yy)*15, pos, CONST_ME_HITBYFIRE)
                      local player = getThingFromPos({x=pos.x,y=pos.y,z=pos.z,stackpos=STACKPOS_TOP_CREATURE}).uid
                      if isPlayer(player) and getPlayerAccess(player) < fireStormAccesToIgnore then
                         addEvent(loseOnFireStorm, 500, player)
                      end return true end,
                      math.random(500, fireStormShootInterval*1000),
                      pos)
       else
          return spawnNewFire(count-(i-1), math.max(reserved, count))
       end
    end
    return true
    end

    function addPlayerToFireStormArea(cid, block)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, fireStormEnterPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    return doCreatureSetStorage(cid, fireStormStorageStatus, 1) and doCreatureSetNoMove(cid, block)
    end

    function startFireStormEvent()
    if getStorage(fireStormStorageStatus) > 0 then
       return false
    end
    doSetStorage(fireStormStorageStatus, 1)
    return enableMessage and doBroadcastMessage('Fire Storm Event is active. We are waiting for ' .. fireStormMaxPlayers - #getFireStormEventPlayers() .. ' players or, if not found, '..timeOnJoinToEvent..' minutes to start. If you want joined to event just use command "!fire join", but if you would leave fire storm arena just say "!fire leave". Have fun!') or true
    end
    ]]></config>

    <talkaction words='!fire' event='script'><![CDATA[
    domodlib('fireStorm_conf')
    function onSay(cid, words, param, channel)
    if fireStormJoinType == 'movement' then
       return false end
    local msg = ''
    if isInArray({'join','add','go','joined'}, param:lower()) then
       if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= fireStormAccesToIgnore then
          return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have a PZ! You have to get rid of it. Somehow.')
       end
       if getPlayerAccess(cid) >= fireStormAccesToIgnore then
          startFireStormEvent()
          return doTeleportThing(cid, fireStormEnterPosition, true)
       elseif #getFireStormEventPlayers() < fireStormMaxPlayers and getStorage(fireStormStorageStatus) == 1 then
          addPlayerToFireStormArea(cid, true)
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getFireStormEventPlayers()..', which join to event.')
          if #getFireStormEventPlayers() == fireStormMaxPlayers then
             doSetStorage(fireStormStorageStatus, 2)
             addEvent(spawnNewFire, fireStormShootInterval * 1000, fireStormBaseFireShoots, fireStormBaseFireShoots)
             for _, v in pairs(getFireStormEventPlayers()) do
                addPlayerToFireStormArea(v, false)
             end
             msg = 'Fire Storm Event is started. We have ' .. fireStormMaxPlayers .. ' players, which joined to event. Have fun!'
          else
             msg = getCreatureName(cid) .. ' has entered a Fire Storm Arena. We still need ' .. fireStormMaxPlayers - #getFireStormEventPlayers() .. ' players.'
          end
          return (msg ~= '' and doBroadcastMessage(msg) or true)
       else
          return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.')
       end
    elseif isInArray({'leave','abort','delete'}, param:lower()) then
       if getStorage(fireStormStorageStatus) < 3 then
          doCreatureSetNoMove(cid, false)
          doCreatureSetStorage(cid, fireStormStorageStatus, 0)
          return doTeleportThing(cid, getCreatureLastPosition(cid), true)
       end
       return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can\'t leave from arena if event is already running.')
    end
    return true
    end
    ]]></talkaction>

    <globalevent name="fireStormTime" time="22:27" event="script"><![CDATA[
    domodlib("fireStorm_conf")
    function onTime(time)
       addEvent(function()
                      if getStorage(fireStormStorageStatus) == 2 then return true end
                      if getStorage(fireStormStorageStatus) == 1 and #getFireStormEventPlayers() >= fireStormMinPlayers then
                         doSetStorage(fireStormStorageStatus, 2)
                         addEvent(spawnNewFire, fireStormShootInterval * 1000, fireStormBaseFireShoots, fireStormBaseFireShoots)
                         for _, v in ipairs(getFireStormEventPlayers()) do
                            addPlayerToFireStormArea(v, false)
                         end
                         return enableMessage and doBroadcastMessage('Fire Storm Event is started. We have '..#getFireStormEventPlayers()..' players on area') or true
                      end
                      for _, v in ipairs(getFireStormEventPlayers()) do
                         kickPlayerFromFireStormArea(v)
                      end
                      return enableMessage and doBroadcastMessage('Fire Storm Event is stopped. We could not find enough players.') or true
                      end,
                      timeOnJoinToEvent * 1000 * 60)
       return startFireStormEvent()
    end
    ]]></globalevent>
    </mod>



    error mod globalvent YNU5B25
    4 participantes
    https://www.tibiaface.com

    9default Re: error mod globalvent Miér Mayo 19, 2021 2:19 pm

    ioke

    ioke
    Miembro
    Miembro
    Ya solucioné el.problema fue cambiar el storage y listo le puse 1
    Código:
    fireStormStorageStatus = 1

    4 participantes
    http://baiakciteron.sytes.net

    Contenido patrocinado


    4 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).