HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Damage Detection

06-27-2005, 10:38 PM#1
Limb_Smasher
is there a way to detect the amount of damage they do to a unit?
06-27-2005, 11:21 PM#2
escpy
event - unit take damage
06-27-2005, 11:26 PM#3
Ceo
That's not what he's asking.


Untitled Trigger 001
Events
Advanced - Any unit takes damage
Conditions
Actions
Set RealVariable = (Damage taken)


The Generic unit - Unit Takes Damage is not a regular GUI function, so you either need to make the trigger through JASS or get WEUnlimited. To find damage done, you use Event Response - Damage Taken, which is a real number.
06-27-2005, 11:38 PM#4
Vexorian
Quote:
Advanced - Any unit takes damage
Are you people aware that that WEU event causes leaks like hell?
06-27-2005, 11:41 PM#5
Ceo
Quote:
Originally Posted by Lord Vexorian
Are you people aware that that WEU event causes leaks like hell?

Does the guy look like he's worried about leaks to you, or if he was even capable of handling them? He doesn't know how to detect damage and you want to him to completely create a trigger through JASS.
06-27-2005, 11:49 PM#6
Vexorian
Quote:
Originally Posted by Ceo
Does the guy look like he's worried about leaks to you, or if he was even capable of handling them? He doesn't know how to detect damage and you want to him to completely create a trigger through JASS.
I was actually commenting, I've seem this too much times already, somebody asking about damage detection and they always give Weu's event as the answer, but it would end causing more problems than just telling the guy to use the specific unit event and Trigger - add event
06-28-2005, 02:00 AM#7
Limb_Smasher
ok then. umm how does it create memory leaks and how do i do it without memory leaks?
06-28-2005, 02:52 AM#8
Ceo
If you want to do it without memory leaks I believe you have to make the trigger, then do Trigger - Add Events for every single unit you want the trigger to run for, because there is only a native Specific Unit - Unit Takes Damage event.
06-28-2005, 03:52 AM#9
Limb_Smasher
i think it would better if i just described my situtation. ok Im making it so when a unit picks up and item they will be labeled X (i.e. unit=udg_X). Now when that unit attacks an enemy the damage it does divided by 10 gets added to his current mana. I need to know how to get the thing in bold, thats it.
06-28-2005, 06:51 AM#10
Anitarf
Quote:
Originally Posted by Limb_Smasher
i think it would better if i just described my situtation. ok Im making it so when a unit picks up and item they will be labeled X (i.e. unit=udg_X). Now when that unit attacks an enemy the damage it does divided by 10 gets added to his current mana. I need to know how to get the thing in bold, thats it.
Make a trigger with no events (we'll add the events later with other triggers), which checks if the "damage source" is equal to X (if you want this to work for more such items, just check if "damage source has item of type" instead). If this condition is met, add mana to "damage source" equal to "(damage dealt) / 10".

Now, in another trigger, whenever a unit enters playable map area, add an event to the first trigger "specific unit event - entering unit takes damage". Additionaly, at map initialization, pick all preplaced units and add events for them as well.

This method will make every unit leave an event in the first trigger, so if you have lots of units creted in the course of one game, it maybe could turn into a performance issue (I don't know how many "lots" is, though, perhaps this is not a problem in your map at all). To avoid this, you would have to use JASS...
06-28-2005, 07:20 AM#11
Limb_Smasher
yes i would need to do jass because there are a lot of units, hundreds even. and i really need to it be a muti-instance kinda thing so mutiple people could have this item and get the same effect.