HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Damage to integer.

07-11-2004, 04:15 PM#1
Pipe Bag
How do make it so if a unit takes say 120 points of damage, i can change an intieger variable or any other variable to 120?

so for example, this isnt what it is needed for, a blademaster takes 50 damage, then, it says "Blademaster 1 has taken 50 damage".

hope you can understand this :/

~Pipe Bag
07-11-2004, 04:24 PM#2
Das Jank
You need a couple Variables for this, they should be like this:

OldLife: This variable is set to the life of the blademaster before he is attacked

NewLife: This variable is set to the blademasters life after he is attacked, do this by reading "Event: A unit is attacked, Condition: Attacked unit = to ...."

DamageDone: This variable is set to OldLife variable - NewLife variable.
07-11-2004, 04:35 PM#3
Pipe Bag
Hmm, but how do i set these integers to my units current HPs, i gues i didnt explain it, but i didnt know how to do this,i need to get the HPs from my unit once it is damaged, i was gonna take away the "damage" from the units base HP to make an arena styled thing where a unit has its HP displayed over its head.
07-11-2004, 04:41 PM#4
johnfn
You are probably stumbling over the fact that unit's HP is a real, not a integer. Get the HP of the unit through a real, subtract whatever amount, and then set the HP to the real.
07-11-2004, 04:47 PM#5
Pipe Bag
Woohoo, thanks to both of you, i would give you reputation for helping but i dont know how :'(
07-11-2004, 08:14 PM#6
Anitarf
Just click on the green word "reputation" on the left side of their posts.

There is also a specific unit event "unit takes damage", which has a real event response "damage taken", but that's a specific unit event, so it has a limited use in a game that dynamicaly generates objects.