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

Lua how to decrease spell area attack by number of players

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
how can i do to decrease damage by 5% on each more player the spell hits?

for example, the spell hit 1 player on area, with 100 damage total right.
but if have two players on area, the spell will not hit 100 damage, but 95 damage.
3 players on area, the spell will hit each player with 90 damage.

but this with a limite maximum of decrease damage 50%.


My Great Fireball spell
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, maglevel)
    local base = 50
    local variation = 15
    
    local value = math.random(-variation, variation) + base
    local formula = 3 * maglevel + (2 * level)
    
    return -(formula * value / 100)
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end
 
Back
Top