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

TSF 1.2 8.0 Energy Runes Crash Client

snukers

New Member
Joined
Apr 19, 2009
Messages
10
Reaction score
0
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.
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
 
Solution
The crashing of the client makes me think it's one of the sprites you're attempting to use.

Swap out CONST_ME_ENERGYAREA, and see if you still crash.
If crash, swap out CONST_ANI_ENERGY.
If crash, then swap out COMBAT_ENERGYDAMAGE.

One of the 3 is probably the culprit.
If you figure out which one, then you can try swapping in a similar/alternate effect
The crashing of the client makes me think it's one of the sprites you're attempting to use.

Swap out CONST_ME_ENERGYAREA, and see if you still crash.
If crash, swap out CONST_ANI_ENERGY.
If crash, then swap out COMBAT_ENERGYDAMAGE.

One of the 3 is probably the culprit.
If you figure out which one, then you can try swapping in a similar/alternate effect
 
Solution
The crashing of the client makes me think it's one of the sprites you're attempting to use.

Swap out CONST_ME_ENERGYAREA, and see if you still crash.
If crash, swap out CONST_ANI_ENERGY.
If crash, then swap out COMBAT_ENERGYDAMAGE.

One of the 3 is probably the culprit.
If you figure out which one, then you can try swapping in a similar/alternate effect
I did this testing and discovered its coming from this line.

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

if I set it to

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)

it causes the crash

So it seems its the effect labeled energy. From what I know the only options are energy,fire,physical,poison. Is there a place I can see which effects I have that I can possibly use? I don't wanna completely elimnate being able to use energy runes, but im not sure which variables are acceptable
Post automatically merged:

I did this testing and discovered its coming from this line.

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

if I set it to

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)

it causes the crash

So it seems its the effect labeled energy. From what I know the only options are energy,fire,physical,poison. Is there a place I can see which effects I have that I can possibly use? I don't wanna completely elimnate being able to use energy runes, but im not sure which variables are acceptable
I went into the exori vis script and saw a parameter for CONST_ME_TELEPORT. I set that and it seems to be working. Thanks for the help
 
I did this testing and discovered its coming from this line.

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

if I set it to

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)

it causes the crash

So it seems its the effect labeled energy. From what I know the only options are energy,fire,physical,poison. Is there a place I can see which effects I have that I can possibly use? I don't wanna completely elimnate being able to use energy runes, but im not sure which variables are acceptable
luascript.cpp in your source files.

or here, at master branch.

I'd recommend trying one of these. They were in earlier versions of tibia
CONST_ME_ENERGYHIT -- probably best option
CONST_ME_LOSEENERGY
CONST_ME_MAGIC_BLUE
 
I had same issue but from two lines
Lua:
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)
i had to change to
Code:
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

In your case you have to change
Code:
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
to
Code:
setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
 
Back
Top