HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Telling when a unit is attacked?

01-16-2007, 02:37 PM#1
CoDRaZieL
I would like to create a system whereby when 1 hero attacks another *and deals damage*(this is because of the stop order trick) they get a small amount of XP, which will later be an increase in their ability with X weapon(like in TES: Oblivion) however i cant figure it out, has anyone managed to do it yet? its very important that the hero not just gain xp from pushing stop rapidly, i have searched the forums and cant seem to find anything, someone please help me
01-16-2007, 03:10 PM#2
DioD
use "unit takes damage" event...
01-16-2007, 03:14 PM#3
Vexorian
Quote:
1 hero attacks another *and deals damage*
...
01-16-2007, 03:21 PM#4
CoDRaZieL
Quote:
Originally Posted by DioD
use "unit takes damage" event...
as far as i know thats only for a specific unit, and besides, isnt that any sort of damage, i need to distinguish an attack from a spell/ability

Vex? ... are you pointing out that i missed something?
01-16-2007, 04:37 PM#5
Rising_Dusk
You need an attack detection system of some sort.
Chuckle wrote a tutorial showing one of the methods of doing it here.
Try to figure that out, and if all else fails come back here and we can help ya' some more.
01-16-2007, 05:04 PM#6
zergleb
http://www.wc3campaigns.net/showthread.php?t=79545 Vexorian also wrote an attack detect engine. It works very well for me.

What you do is you just add a function to the unit(in this case the hero) which does whatever you want, and from then it will run the function after any attack.
01-16-2007, 05:57 PM#7
Vexorian
must redo that thing to let it use interfaces,hmm...