• 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 How to use onAttack(?)

Joined
Apr 11, 2015
Messages
102
Reaction score
6
0.4

Hello guys, Im trying to understand how to use onAttack or onCombat for the following request:
I want to check when a player hits a mob with his base attack, like using a sword. So, if i use onAttack, how do I make the game acknowledge the hit?

The mindset behind this is something like this: When a player hits someone, it will happen something.
Do i need to use onAttack or onCombat?

Thank you.
 
onAttack(cid, target) cid is the ID of the attacking creature and target is a table of type thing, this table has some internal variables like for example target.uid
If you return false in the function the attack action will be canceled

You must register the script with a name in creaturescripts.xml and then log this event to the player or monster in question

The same: onCombat(cid, target), only this event is triggered when a creature takes damage, while the previous onAttack(cid, target) triggers when someone tries to attack you but you are not really their target yet
 
Back
Top