Everytime I try to use an energy rune it will make the client crash. Other runes like GFB and SD work, but energy field,hmm,lmm all crash as soon you shoot something. The server stays online and you can tell monsters received damage from the spell. For testing I tried taking my SD script and replacing the contents of my HMM script with the SD script and my HMM now successfully shoots as an SD. As soon as I change the formula to use energy damage instead of physical. I get the crash effect.
Below is my crashing HMM script and my working SD script.
Below is my crashing HMM script and my working SD script.
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 0.8) + 5
local max = (level / 5) + (maglevel * 1.6) + 10
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
function onGetFormulaValues(cid, level, maglevel)
min = -(level * 3.88 + maglevel * 4.60)
max = -(level * 4.24 + maglevel * 5.34)
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var, isHotkey)
local tile = Tile(var.getPosition(var))
if tile and tile:getTopCreature() then
return combat:execute(cid, var)
end
cid:sendCancelMessage("You can only use this rune on creatures.")
cid:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end