• 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
 
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
 
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?>
 
so every monster should get different damage?

training monk 1 - 22
training monk 2 - 73
training monk 3 - 45

?
 
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:
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>
 
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
 
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.
 
I corrected it, but the script does not work

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