• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 1.0] Area Effects Script Template

Jaed Le Raep

★Gaeming★
Joined
Sep 3, 2007
Messages
1,298
Reaction score
446
Hey guys, I've been having a desire to have certain area effects be triggered when a movement is made onto a certain tile, or even randomly ever x minute. Anyway, I was wondering if anyone could make a lua script that would act as a template that I could transform into different uses, but the end result would be certain area effects/animations would take place. Kind of like spell animations, but without the casting of a spell.
 
Code:
<globalevent name="randEff" interval="1000" script="randeff.lua"/>

Code:
local config = {
    fromPos = Position(1996, 1998), --the first is x and the second is y
    toPos = Position(2003, 2002), --the first is x and the second is y
    floor = 6,
    randomEffects = false, -- this will send out random effects from 1, 70
    effect = CONST_ME_FIREAREA --if you make random true, then dont bother to edit this
}

function onThink(interval)
    for x = config.fromPos.x, config.toPos.x do
        for y = config.fromPos.y, config.toPos.y do
            local pos = Position(math.random(x+2, x), math.random(y-2, y), config.floor)
            if config.randomEffects then
                pos:sendMagicEffect(math.random(CONST_ME_LOSEENERGY, CONST_ME_CONFETTI_VERTICAL))
            else
                pos:sendMagicEffect(config.effect)
            end
        end
    end
    return true
end

Enjoy.
 
Back
Top