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

Question Concerning Damage reflection to monster only after targeting monster.

Menoaw

New Member
Joined
Jul 16, 2022
Messages
8
Reaction score
0
Using TFS 1.5, with Nekiro 8.0 downgrade.
Bought a script from somebody for item upgrading/attributes and such and there was an issue concerning the damage reflection, and unsure -why- it is behaving as it is.
in essence script should roll a chance of casting, which if passed, would then get attacker, do a specific type of damage (example being energy) to attacking creature. (also shows a small projectile launch to monster)

Almost all of this works fine....except that when mobs attack me, the projectile is launched, visibly hitting whichever mob drew blood on me... but no damage will be done what so ever UNLESS i target said mob first. dont need to draw blood on the monster, just target. (drawing blood works also, e.g. with GFB)
if i target the mob on another character, same thing, it will "accept" the reflected damage then, but not until the mob has been interacted with in some way.
assuming it has something to do with the doTargetCombatHealth not being setup right maybe?
(if i swap target with attacker, or attacker:getId() it will damage myself just fine, but maybe thats due to fact im being targetted?)

suggestions?

script for the reflection,
LUA:
  [36] = {
    name = "Energy Reflection",
    combatType = US_TYPES.TRIGGER,
    triggerType = US_TRIGGERS.HIT,
    VALUES_PER_LEVEL = 50,
    execute = function(attacker, target, damage)
      if math.random(100) < 100 then --set to 100 for testing purposes
        attacker:getPosition():sendDistanceEffect(target:getPosition(), CONST_ANI_ENERGY)
        doTargetCombatHealth(attacker:getId(), target, COMBAT_ENERGYDAMAGE, 1, damage, CONST_ME_ENERGYAREA, ORIGIN_CONDITION)
      end
    end,
    format = function(value)
        return "10%% to cast Energy Reflection dealing 1-" .. math.ceil(value) .. " damage"
    end,
  }

compat.lua code for the doTargetCombatHealth section...
LUA:
function doTargetCombatHealth(...) return doTargetCombat(...) end
function doAreaCombatHealth(...) return doAreaCombat(...) end
doCombatAreaHealth = doAreaCombatHealth
function doTargetCombatMana(cid, target, min, max, effect) return doTargetCombat(cid, target, COMBAT_MANADRAIN, min, max, effect) end
doCombatAreaMana = doTargetCombatMana
function doAreaCombatMana(cid, pos, area, min, max, effect) return doAreaCombat(cid, COMBAT_MANADRAIN, pos, area, min, max, effect) end
 

Similar threads

Back
Top