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

TFS 0.X varied damage depending on the direction the target is facing the attacker

sabodden

Member
Joined
Sep 27, 2019
Messages
138
Reaction score
18
Would be possible in lua, maybe by using getCreatureLookDirection(target) to make the 'exori hur' more dynamic and skillable?
I would like to if target is backwards to the attacker: damage = damage * 2
And if target is beside to the attacker: damage = damage * 1.5
And one last if player is looking to the target direction damage = damage * 1

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, maglevel)
    min = ( (maglevel * 15) * 0.5 ) * -1
    max = ( (maglevel * 15) * 1.0 ) * -1
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 
Solution
Code:
local targetDir = getCreatureLookDirection(getCreatureTarget(cid)) 
local cidDir = getCreatureLookDirection(cid)

if targetDir == cidDir then
damage = damage * 2
elseif (targetDir =~ cidDir) and not(lookFaceToFace) then
damage = damage * 1.5 
end
I am already little bussy, so i can't check when target and cid is face to face...
It is probalby 1 and 3 or 2 and 4, but i am nit sure.
Code:
local targetDir = getCreatureLookDirection(getCreatureTarget(cid)) 
local cidDir = getCreatureLookDirection(cid)

if targetDir == cidDir then
damage = damage * 2
elseif (targetDir =~ cidDir) and not(lookFaceToFace) then
damage = damage * 1.5 
end
I am already little bussy, so i can't check when target and cid is face to face...
It is probalby 1 and 3 or 2 and 4, but i am nit sure.
 
Solution
Back
Top