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

GFB - DMG

UnLucky

New Member
Joined
Jul 15, 2021
Messages
36
Reaction score
1
GitHub
UnLucky
Hello, when i throw Gfb on a group of monsters they all get the same Dmg.

Has anyone Ideas for a solution to make each monster receive random damage from Min, Max?

Gyazo : Gyazo (https://gyazo.com/bd4f5912535be20779f58ce736e36b15)

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local area = createCombatArea(AREA_CIRCLE3X3)
combat:setArea( area)

function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 4) + (maglevel * 1.7) + 11)
    max = -((level / 4) + (maglevel * 2.55) + 26)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,097
Solutions
34
Reaction score
182
Hello, when i throw Gfb on a group of monsters they all get the same Dmg.

Has anyone Ideas for a solution to make each monster receive random damage from Min, Max?

Gyazo : Gyazo (https://gyazo.com/bd4f5912535be20779f58ce736e36b15)

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local area = createCombatArea(AREA_CIRCLE3X3)
combat:setArea( area)

function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 4) + (maglevel * 1.7) + 11)
    max = -((level / 4) + (maglevel * 2.55) + 26)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
TRY
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 4) + (magicLevel * 1.7) + 11
    local max = (level / 4) + (magicLevel * 2.55) + 26
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end
 
OP
OP
U

UnLucky

New Member
Joined
Jul 15, 2021
Messages
36
Reaction score
1
GitHub
UnLucky
TRY
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 4) + (magicLevel * 1.7) + 11
    local max = (level / 4) + (magicLevel * 2.55) + 26
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end
does not work, others idea?>
 

jacqen

Well-Known Member
Joined
Jul 10, 2017
Messages
61
Solutions
15
Reaction score
61
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local area = createCombatArea(AREA_CIRCLE3X3)
combat:setArea(area)

function onCastSpell(creature, var)
    local level, magLevel = creature:getLevel(), creature:getMagicLevel()
    local min = -((level / 4) + (maglevel * 1.7) + 11)
    local max = -((level / 4) + (maglevel * 2.55) + 26)
    local targets = combat:getTargets(creature, var)
    for _,target in pairs(targets) do
        doTargetCombatHealth(creature:getId(), target, COMBAT_FIREDAMAGE, min, max)
    end

    return true
end

This should work, thou I have not tested it
 
OP
OP
U

UnLucky

New Member
Joined
Jul 15, 2021
Messages
36
Reaction score
1
GitHub
UnLucky
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local area = createCombatArea(AREA_CIRCLE3X3)
combat:setArea(area)

function onCastSpell(creature, var)
    local level, magLevel = creature:getLevel(), creature:getMagicLevel()
    local min = -((level / 4) + (maglevel * 1.7) + 11)
    local max = -((level / 4) + (maglevel * 2.55) + 26)
    local targets = combat:getTargets(creature, var)
    for _,target in pairs(targets) do
        doTargetCombatHealth(creature:getId(), target, COMBAT_FIREDAMAGE, min, max)
    end

    return true
end

This should work, thou I have not tested it
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/great fireball.lua:eek:nCastSpell
data/spells/scripts/attack/great fireball.lua:12: attempt to perform arithmetic on global 'maglevel' (a nil value)
stack traceback:
[C]: in function '__mul'
data/spells/scripts/attack/great fireball.lua:12: in function <data/spells/scripts/attack/great fireball.lua:10>
 

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,112
Solutions
218
Reaction score
4,027
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/great fireball.lua:eek:nCastSpell
data/spells/scripts/attack/great fireball.lua:12: attempt to perform arithmetic on global 'maglevel' (a nil value)
stack traceback:
[C]: in function '__mul'
data/spells/scripts/attack/great fireball.lua:12: in function <data/spells/scripts/attack/great fireball.lua:10>

magLevel to maglevel
 

pink_panther

Premium User
Premium User
Joined
Sep 10, 2016
Messages
769
Solutions
9
Reaction score
331
Location
Kazordoon
Hello, when i throw Gfb on a group of monsters they all get the same Dmg.

Has anyone Ideas for a solution to make each monster receive random damage from Min, Max?

Gyazo : Gyazo (https://gyazo.com/bd4f5912535be20779f58ce736e36b15)

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local area = createCombatArea(AREA_CIRCLE3X3)
combat:setArea( area)

function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 4) + (maglevel * 1.7) + 11)
    max = -((level / 4) + (maglevel * 2.55) + 26)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end

Hey cool, This is how spells worked in 7.x, so Im gonna try break the feauter you want to achive the outcome you currently have.
 

pink_panther

Premium User
Premium User
Joined
Sep 10, 2016
Messages
769
Solutions
9
Reaction score
331
Location
Kazordoon
I corrected it, but the script does not work

He's talking about the script in post #6
 
Top