HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting Damage Values?

04-04-2004, 05:53 PM#1
Lazurus
Hey everyone,
I was wondering, is there anyway I could detect the exact amount of damage dealt to a specific unit after he has been attacked (physically, not via a spell) by another unit? Perhaps there is some way to convert it into an integer or a real or something, because I cannot seem to figure it out :P Help would be greatly appreciated.

- Lazurus
04-04-2004, 06:03 PM#2
johnfn
Interestingly i have the exact code you need. I had to do this in my map. I stripped it just to the damage value. I have one unit attack the other, you might need to detect it a different way.

Code:
Actions
	Set oldhp = (Integer((Life of unit_thats_attacking)))
	  Unit - Order unit_being_attacked to Attack unit_thats_attacking
	Wait until (oldhp Greater than (Integer((Life of unit_thats_attacking)))), checking every 0.50 seconds
	Floating Text - Create floating text that reads (String(((Real(oldhp)) - (Real((Integer((Life of unit_being_attacked)))))))) at (Position of unit_being_attacked) with Z offset 0.00, using font size 14.00, color (100.00%, 0.00%, 0.00%), and 50.00% transparency
04-04-2004, 07:05 PM#3
Lazurus
Ah, thanks for the advice, john, but I don't really understand JASS, and I am not sure if it would work. From what I can understand about the coding (which is probably very little) aren't you ordering the units to attack eachother and then recording the different from the HP values?

- Lazurus
04-05-2004, 09:04 PM#4
johnfn
O_o



Thats not jass!!

You are completely correct about what I am doing, however. You will probably have to set the oldhp variable beforehand, and then check it after a hit, then reset it to the new hp.

200 posts!! finally!
04-05-2004, 11:13 PM#5
joseka
Theres a way to know how much damages a unit do but the problem is that it only work with specific unit events....

Theres a event in specific event that is A unit takes damage, and i think there an option to equal an integer ( or real i dont remenber) to the damages that takes that unit.

But as i say backwards its only to specific units , mean that it only work with unit that you put in the map ,not variables or created units .. Its a shame :(


By the way somebody knows why the difference beetween specific units events and general units events???
04-06-2004, 05:26 PM#6
Ligature
You can also apply the Specific Unit event "X unit takes damage" to ALL units, if you do a lot of legwork: you use the action "Add event to trigger" at map initialization and whenever a unit enters the playable map area.
04-11-2004, 02:17 AM#7
joseka
Quote:
Originally Posted by Ligature
You can also apply the Specific Unit event "X unit takes damage" to ALL units, if you do a lot of legwork: you use the action "Add event to trigger" at map initialization and whenever a unit enters the playable map area.

Hey I discovered a Form to Aplicate the event - Specific Unit to whichever unit you want , Use this trigger - Add Even to trigger , there you could use Specific Unit event with a unit variable Enjoy :D