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

Lua doTargetCombatHealth

klepacz

New Member
Joined
Aug 12, 2015
Messages
35
Reaction score
0
Hello, can you help me to understand why this function doesn't work as i think it should ?

Here is the simple example code:
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
   
    doTargetCombatHealth(creature, attacker, primaryType, primaryDamage, primaryDamage)

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

It's like dmg reflection. I think it should reflect to the attacker the damage he dealts. (HIT 40, REFLECT 40)
But it doesn't reflect the full primaryDamage (it's like HIT 40, REFLECT 15)

Why does it happen and how it works?
 
I Think Someone Explained
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
on Otland, it was detailed Explanation, try to search for it
 
I think the problem you are seeing could be the result of any amount of damage reduction the creature may have (pvp 50%/armor/resistance/ect...)

Using pvp as an example:
>hit player for 100
>damage is cut in half to 50
>script runs and reflects 50 damage to attacker
>damage is again cut in half

Another problem (again using pvp as an example) is if both players have the reflect script active. It will cause the damage to chain reflect until it eventually reaches 0.
>Player A hits 100
/2
>Player B reflects 50
/2
>Player A reflect 25
/2
>Player B reflects 12 (I think its rounded down)
/2
>Player A reflects 6
/2
>Player B reflects 3
/2
>Player A reflects 1
/2
>Player B reflects 0
>Player A does not reflect because 0 did not change his health
 
I think the problem you are seeing could be the result of any amount of damage reduction the creature may have (pvp 50%/armor/resistance/ect...)

Using pvp as an example:
>hit player for 100
>damage is cut in half to 50
>script runs and reflects 50 damage to attacker
>damage is again cut in half

Another problem (again using pvp as an example) is if both players have the reflect script active. It will cause the damage to chain reflect until it eventually reaches 0.
>Player A hits 100
/2
>Player B reflects 50
/2
>Player A reflect 25
/2
>Player B reflects 12 (I think its rounded down)
/2
>Player A reflects 6
/2
>Player B reflects 3
/2
>Player A reflects 1
/2
>Player B reflects 0
>Player A does not reflect because 0 did not change his health
Ok, thank you
 
Back
Top