Piifafa
Member
- Joined
- Apr 16, 2023
- Messages
- 67
- Reaction score
- 16
I would like to know how I can increase the mana consumption of certain spells according to the player's level. I can't think of any easy alternative for this.
I would like it to be like the example, after level 200, the use of the magic increases its mana cost according to a rule or something similar, every 10 levels or a small percentage for each level gained.
I would like it to be like the example, after level 200, the use of the magic increases its mana cost according to a rule or something similar, every 10 levels or a small percentage for each level gained.
Lua:
<instant name="Ultimate Explosion" words="exevo gran mas vis" maglv="40" mana="800" aggressive="1" selftarget="1" needlearn="0" script="spells/ultimate explosion.lua">
<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />
</instant>
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
function onGetFormulaValues(player, level, maglevel)
local base = 250
local variation = 50
local formula = 3.0 * maglevel + (2 * level)
local min = (formula * (base - variation)) / 100
local max = (formula * (base + variation)) / 100
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
return combat:execute(creature, variant)
end