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

Lua Area of Spell does not follow player

.Smile

Member
Joined
Jan 27, 2019
Messages
29
Reaction score
11
I tried in several ways to make the area follow the player but it stays in the same place where the player used.

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 5)
combat:setArea(createCombatArea(AREA_CIRCLE2X2))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 0.8) + 5
    local max = (level / 5) + (magicLevel * 2) + 12
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    local position = creature:getPosition()
        Position({x = position.x + 3, y = position.y + 3, z = position.z}):sendMagicEffect(110)
        combat:execute(creature, variant)
    addEvent(function() 
        Position({x = position.x + 3, y = position.y + 3, z = position.z}):sendMagicEffect(110)
        combat:execute(creature, variant)
    end, 500)
    addEvent(function() 
        Position({x = position.x + 3, y = position.y + 3, z = position.z}):sendMagicEffect(110)
        combat:execute(creature, variant)
    end, 1000)
    addEvent(function() 
        Position({x = position.x + 3, y = position.y + 3, z = position.z}):sendMagicEffect(110)
        combat:execute(creature, variant)
    end, 1500)
    addEvent(function() 
        Position({x = position.x + 3, y = position.y + 3, z = position.z}):sendMagicEffect(110)
        combat:execute(creature, variant)
    end, 2000)
    return true
end
 
Last edited:
Back
Top