• 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 [TFS 1.2]Help to force blockhit or anyway to avoid damage

Sacarus

Member
Joined
Mar 15, 2016
Messages
52
Reaction score
7
Hi, i´m trying to avoid damage using onTargetCombat. It looks very simple but i just cant. Return false don´t stop the hit, but if I force some error at the same line, it stops (offcourse i won´t let an error in my code) . I tried monster:removeTarget() but it was unsuccessful, it removes but hits before.
I tried in creature.lua

function Creature:eek:nTargetCombat(target)
print("test")
return false
end

The event is enabled. If i can set the armor of the monster, defense, it all would work, i just want to avoid the damage, that´s the point. I don´t wanna edit source, just in last case. I would appreciate any help.
 
Creature:eek:nTargetCombat(target) is for executing lua code when that event is fired
afaik if you want to stop attacks with that you will have to source edit

in lua you can do it though with onManaChange/onHealthChange in creaturescripts
although onManaChange doesn't have damage types so you cant factor in damage types in damage reduction
 
Thank you bro. I edited the source. onHealthChange would gimme too much work i think. I created a new event that goes on in creature .cpp onAttacking . Solved!
 
Back
Top