• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [GLOBALEVENT] Custom Weather script

Frikx

Computer Science
Joined
Mar 10, 2013
Messages
128
Solutions
3
Reaction score
31
Location
Spain
GitHub
amatria
Hello OTLand!

Today I was working on a custom weather script, It Works properly but I get a Little error in console that is spammed all the time. (The script Works, but I don't want this error to be shown :c)

Console:

Code:
[Error - GlobalEvents::think] Failed to execute event: Weather

Script:

http://pastebin.com/S57FMRch

Thanks!
 
I was bored so I made it smaller :)
Code:
local c =
    {
        areas = {
            [1] = {
                shootType = CONST_ANI_FIRE,            -- shoot effect
                areaType = CONST_ME_FIREAREA,        -- area effect
                qty = 3,                            -- how many per interval
                from = { 1048, 1000, 7 },        -- top left area
                to = { 1062, 1010, 7 },            -- bot right area
                combat = "fire"                        -- fire, water, stone, poison
            }
    }
 
function range(r)
    local x = {}
    for i = 1, 3 do
        x[i] = math.random(r.from[i], r.to[i])
    end
    return unpack(x)
end

function onThink(interval)
    for i = 1, #c.areas do
        for t = 1, c.areas[i].qty do
            local e, f, g = range(c)
            local delay = math.random(1, 600)
            addEvent(doSendDistanceShoot, delay, {x = e - 7, y = f - 5, z = g}, { x = e, y = f, z = g}, c.areas[i].shootType)
            addEvent(doSendMagicEffect, delay + 250, {x = e, y = f, z = g }, c.areas[i].areaType)
            -- hacer condición dependiendo del efecto
        end
    end
end

Now its even smaller :p
Code:
local c =
    {
        a = {
            [1] = {
                s = CONST_ANI_FIRE,            -- shoot effect
                t = CONST_ME_FIREAREA,        -- area effect
                q = 3,                            -- how many per interval
                f = { 1048, 1000, 7 },        -- top left area
                o = { 1062, 1010, 7 },            -- bot right area
                combat = "fire"                        -- fire, water, stone, poison
            }
    }
   
function range(r)
    local x = {}
    for i = 1, 3 do
        x[i] = math.random(r.f[i], r.o[i])
    end
    return unpack(x)
end

function onThink(interval)
    for i = 1, #c.a do
        for l = 1, c.a[i].q do
            local e, f, g = range(c)
            local d = math.random(1, 600)
            addEvent(doSendDistanceShoot, d, {x = e - 7, y = f - 5, z = g}, { x = e, y = f, z = g}, c.a[i].s)
            addEvent(doSendMagicEffect, d + 250, {x = e, y = f, z = g }, c.a[i].t)
        end
    end
end
 
Last edited:
Back
Top