• 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!

RevScripts enviroment spell

Niloahs

Well-Known Member
Joined
Feb 10, 2020
Messages
90
Solutions
1
Reaction score
64
hi guys, can someone help me changing this script?

i have the script but dont work the way i want, basicaly i want the enviroment spell cast the full area instead of only the line.
and if possible make the area damage + effect random
1613257621756.png


Lua:
local effects = {
    {fromPosition = Position(1040, 1073, 7), toPosition = Position(1046, 1076, 7), effect = CONST_ME_HOLYDAMAGE},
}

local spawnDamage = GlobalEvent("spawn damage")
function spawnDamage.onThink(interval)
    local jolf
    for i = 1, #effects do
        local settings = effects[i]
        fromPosition = settings.fromPosition
        toPosition = settings.toPosition
        local spectators = Game.getSpectators(settings.fromPosition, false, true, 7, 7, 5, 5)
        if #spectators > 0 then
            if settings.effect then
                for y = fromPosition.y, toPosition.y do
                    local newPosition = Position(fromPosition.x, y, fromPosition.z)
                    newPosition:sendMagicEffect(settings.effect)

                    jolf = Tile(newPosition):getTopCreature()
                    if jolf and jolf:isPlayer() then
                        doTargetCombatHealth(0, jolf, COMBAT_PHYSICALDAMAGE, -500, -1000, settings.effect)
                    end
                end
                for x = fromPosition.x, toPosition.x do
                    local newPosition2 = Position(x, fromPosition.y, fromPosition.z)
                    newPosition2:sendMagicEffect(settings.effect)
                    jolf = Tile(newPosition2):getTopCreature()
                    if jolf and jolf:isPlayer() then
                        doTargetCombatHealth(0, jolf, COMBAT_PHYSICALDAMAGE, -10, -500, settings.effect)
                    end
                end
            end
        end
    end
    return true
end

spawnDamage:interval(2000)
spawnDamage:register()

thanks very much
 

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,244
Solutions
71
Reaction score
553
Location
Hell
Skärmavbild 2021-02-14 kl. 01.40.14.png
Lua:
local config = {
    minDamage = 10,
    maxDamage = 1000,
    magicEffectStart = 1,
    magicEffectEnd = 50
}

local effects = {
    {
        fromPosition = Position(116, 423, 7),
        toPosition   = Position(123, 428, 7),
        effect       = CONST_ME_HOLYDAMAGE
    },
}

local spawnDamage = GlobalEvent("spawn damage")
function spawnDamage.onThink(interval)
    local jolf
    for i = 1, #effects do
        local settings = effects[i]

        local spectators = Game.getSpectators(settings.fromPosition, false, true, 7, 7, 5, 5)
        if #spectators > 0 then
            for y = settings.fromPosition.y, settings.toPosition.y do
                for x = settings.fromPosition.x, settings.toPosition.x do
                    newPosition = Position(x, y, settings.fromPosition.z)
                    newPosition:sendMagicEffect(math.random(config.magicEffectStart, config.magicEffectEnd))
                    jolf = Tile(newPosition):getTopCreature()
                    if jolf and jolf:isPlayer() then
                        doTargetCombatHealth(0, jolf, COMBAT_PHYSICALDAMAGE, -config.minDamage, -config.maxDamage, settings.effect)
                    end
                end
            end
        end
    end
    return true
end

spawnDamage:interval(1000)
spawnDamage:register()
 
Top