• 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 [TFS 1.3] 12.7 Rain of Arrows

ghunalma

New Member
Joined
Feb 5, 2016
Messages
19
Reaction score
2
Twitch
wordoffanic
I would like to get this spell in video to my custom rpg server. anyone can help me with this?

OBS: no need to show the equiped arrow, only make an rain of arrow with a distance effect simulating an rain.

Thank you very much in advance

 
Solution
Let me know if 1.3 doesn't have RevScript

data/scripts
Lua:
local config = {
    lvlReq = 1,
    cooldown = 2000,
    combatType = COMBAT_PHYSICALDAMAGE,
    magicEffect = CONST_ME_HITAREA,
    distEffect = CONST_ANI_ARROW,
    dmg = {min = 100, max = 200},
    rounds = 10, -- Amount of rounds
    delay = 200, -- Delay between rounds
    density = 10, -- How dense the area of effect will be (1 = full area)
}

local area = {
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}
local combat = Combat()
combat:setArea(createCombatArea(area))

function onTargetTile(creature, position)
    local fromPos...
Let me know if 1.3 doesn't have RevScript

data/scripts
Lua:
local config = {
    lvlReq = 1,
    cooldown = 2000,
    combatType = COMBAT_PHYSICALDAMAGE,
    magicEffect = CONST_ME_HITAREA,
    distEffect = CONST_ANI_ARROW,
    dmg = {min = 100, max = 200},
    rounds = 10, -- Amount of rounds
    delay = 200, -- Delay between rounds
    density = 10, -- How dense the area of effect will be (1 = full area)
}

local area = {
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}
local combat = Combat()
combat:setArea(createCombatArea(area))

function onTargetTile(creature, position)
    local fromPos = Position(position.x - 7, position.y - 7, position.z)
    if math.random(config.density) == 1 then
        fromPos:sendDistanceEffect(position, config.distEffect)
        addEvent(function()
            local player = Player(creature:getId())
            if not player then
                return
            end
            doAreaCombat(player, config.combatType, position, position, -config.dmg.min, -config.dmg.max, config.magicEffect)
        end, 400)
    end
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant)
    for i = 1, config.rounds do
        addEvent(function()
            local player = Player(creature:getId())
            if not player then
                return
            end
            combat:execute(player, variant)
        end, config.delay * (i-1))
    end
    return true
end

spell:name("Rain of Arrows")
spell:words("Rain of Arrows")
spell:id(51)
spell:group("attack")
spell:cooldown(config.cooldown)
spell:groupCooldown(config.cooldown)
spell:isAggressive(true)
spell:needTarget(true)
spell:level(config.lvlReq)
spell:needLearn(true)
spell:vocation("paladin")
spell:register()
 
Last edited:
Solution
Let me know if 1.3 doesn't have RevScript

data/scripts
Lua:
local config = {
    lvlReq = 1,
    cooldown = 2000,
    combatType = COMBAT_PHYSICALDAMAGE,
    magicEffect = CONST_ME_HITAREA,
    distEffect = CONST_ANI_ARROW,
    dmg = {min = 100, max = 200},
    rounds = 10, -- Amount of rounds
    delay = 200, -- Delay between rounds
    density = 10, -- How dense the area of effect will be (1 = full area)
}

local area = {
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}
local combat = Combat()
combat:setArea(createCombatArea(area))

function onTargetTile(creature, position)
    local fromPos = Position(position.x - 7, position.y - 7, position.z)
    if math.random(config.density) == 1 then
        fromPos:sendDistanceEffect(position, config.distEffect)
        addEvent(function()
            local player = Player(creature:getId())
            if not player then
                return
            end
            doAreaCombat(player, config.combatType, position, position, -config.dmg.min, -config.dmg.max, config.magicEffect)
        end, 400)
    end
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant)
    for i = 1, config.rounds do
        addEvent(function()
            local player = Player(creature:getId())
            if not player then
                return
            end
            combat:execute(player, variant)
        end, config.delay * (i-1))
    end
    return true
end

spell:name("Rain of Arrows")
spell:words("Rain of Arrows")
spell:id(51)
spell:group("attack")
spell:cooldown(config.cooldown)
spell:groupCooldown(config.cooldown)
spell:isAggressive(true)
spell:needTarget(true)
spell:level(config.lvlReq)
spell:needLearn(true)
spell:vocation("paladin")
spell:register()
@Heroid the action is work bro, but delat no damage.
is possible to insert this dmg calc on script?
i'm trying to get health on this spell. thx for u help!

Lua:
function onGetFormulaValues(player, skill, attack, factor)
    local level = player:getLevel()
    local min = (level / 5) + (skill + attack) * 0.5
    local max = (level / 5) + (skill + attack) * 1.5

 
    local damage = -min * 1.1
    local healing_percentage = 100

    local dot_healing = damage * (healing_percentage / 100)

    doTargetCombatHealth(target, player, COMBAT_HEALING, -dot_healing, -dot_healing, 0xFE)

    return min * 1.1, max * 1.1 -- TODO: Use uma nova fórmula real em vez de um %
end

i get this errors on distro when use the spell.

Code:
[2023-17-12 21:12:04.605] [error] Lua script error: (Unknown scriptfile)
[2023-17-12 21:12:04.605] [error] ...OR\data\scripts\spells\NECROMANCER\attack\lvl1teste2.lua:32: attempt to call global 'doAreaCombat' (a nil value)
stack traceback:
        [C]: in function 'doAreaCombat'
        ...OR\data\scripts\spells\NECROMANCER\attack\lvl1teste2.lua:32: in function <...OR\data\scripts\spells\NECROMANCER\attack\lvl1teste2.lua:27>
 
Last edited:
@Heroid the action is work bro, but delat no damage.
is possible to insert this dmg calc on script?
i'm trying to get health on this spell. thx for u help!

Lua:
function onGetFormulaValues(player, skill, attack, factor)
    local level = player:getLevel()
    local min = (level / 5) + (skill + attack) * 0.5
    local max = (level / 5) + (skill + attack) * 1.5

 
    local damage = -min * 1.1
    local healing_percentage = 100

    local dot_healing = damage * (healing_percentage / 100)

    doTargetCombatHealth(target, player, COMBAT_HEALING, -dot_healing, -dot_healing, 0xFE)

    return min * 1.1, max * 1.1 -- TODO: Use uma nova fórmula real em vez de um %
end

i get this errors on distro when use the spell.

Code:
[2023-17-12 21:12:04.605] [error] Lua script error: (Unknown scriptfile)
[2023-17-12 21:12:04.605] [error] ...OR\data\scripts\spells\NECROMANCER\attack\lvl1teste2.lua:32: attempt to call global 'doAreaCombat' (a nil value)
stack traceback:
        [C]: in function 'doAreaCombat'
        ...OR\data\scripts\spells\NECROMANCER\attack\lvl1teste2.lua:32: in function <...OR\data\scripts\spells\NECROMANCER\attack\lvl1teste2.lua:27>
Try changing line 34 doAreaCombat to doAreaCombatHealth and see if it works.
 
Vn bro, ty very much! @Heroid

and this code is possible to insert on script? cus this dmg calc is almos good to config and balance.


Lua:
function onGetFormulaValues(player, skill, attack, factor)
    local level = player:getLevel()
    local min = (level / 5) + (skill + attack) * 0.5
    local max = (level / 5) + (skill + attack) * 1.5

 
    local damage = -min * 1.1
    local healing_percentage = 100

    local dot_healing = damage * (healing_percentage / 100)

    doTargetCombatHealth(target, player, COMBAT_HEALING, -dot_healing, -dot_healing, 0xFE)

    return min * 1.1, max * 1.1 -- TODO: Use uma nova fórmula real em vez de um %
end
 
Last edited:
Back
Top