I am trying to make a trigger where Unit Selection - Any Unit is Highlighted by Player Any Player displays the current health over max health as a text tag. How do i get the health of the triggering unit display? I have been looking around for a good 30 minutes. I don't know if im looking too hard that i am looking around it, or if it is advanced to display it. Any help is appreciated!
Health and max Health are properties of the unit and are real values. Make 2 real variables and store the 2 values into them.
Then you can easily create a text tag and set the text to a combination of texts which include these 2 real variables transformed to text.
@Ahli634: Go
i'm sorry but i have to disagree, if he stores them in variables they won't reflect real values anymore unless he stores them every update which is pointless
instead he should build text/string directly using properties of given unit.
Convert real to integer(optional) -> integer to text/string and build something like: "Unit's current hp" + "/" + "Unit's max hp"
Hey guys. Thanks for the replies! But i am afraid to say that i have it set up, but it just doesn't happen. When i highlight a destructible rock, it doesn't show the health. It doesn't even show up in trigger debugging...
Explain. Why it should even show on highlight? you mean event "player highlights unit?" then unit's flag "cannot be highlighted" needs to be unchecked. It's about units tho, not doodads.
@Ahli634: Go i'm sorry but i have to disagree, if he stores them in variables they won't reflect real values anymore unless he stores them every update which is pointless
instead he should build text/string directly using properties of given unit.
Convert real to integer(optional) -> integer to text/string and build something like: "Unit's current hp" + "/" + "Unit's max hp"
I would have used the variables to not have 1 line of code in a trigger/action definition which contains a lot of action in 1 line of code.
It's bad for a unexperienced mapper to learn in that way because then they can't understand their own code anymore.
It's more efficient to do it directly, but the actual gain is like 0 and only hinders new map makers.
So, it's better to advice them to use local variables instead of putting 20 function calls into each other.
Apart from that, storing these basic data types in a variable won't have a noticeable impact on the map's performance.
Explain. Why it should even show on highlight? you mean event "player highlights unit?" then unit's flag "cannot be highlighted" needs to be unchecked. It's about units tho, not doodads.
This is probably the issue here. As explained, the unit-highlighted trigger won't fire unless you go into each unit in the data editor (that you want to be highlightable) and go to unit flags, and uncheck 'cannot be highlighted'
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I am trying to make a trigger where Unit Selection - Any Unit is Highlighted by Player Any Player displays the current health over max health as a text tag. How do i get the health of the triggering unit display? I have been looking around for a good 30 minutes. I don't know if im looking too hard that i am looking around it, or if it is advanced to display it. Any help is appreciated!
Thanks in advance!
Health and max Health are properties of the unit and are real values. Make 2 real variables and store the 2 values into them.
Then you can easily create a text tag and set the text to a combination of texts which include these 2 real variables transformed to text.
@Ahli634: Go i'm sorry but i have to disagree, if he stores them in variables they won't reflect real values anymore unless he stores them every update which is pointless
instead he should build text/string directly using properties of given unit.
Convert real to integer(optional) -> integer to text/string and build something like: "Unit's current hp" + "/" + "Unit's max hp"
Hey guys. Thanks for the replies! But i am afraid to say that i have it set up, but it just doesn't happen. When i highlight a destructible rock, it doesn't show the health. It doesn't even show up in trigger debugging...
Explain. Why it should even show on highlight? you mean event "player highlights unit?" then unit's flag "cannot be highlighted" needs to be unchecked. It's about units tho, not doodads.
which event did you use
So it can't be used with rocks? Awww man! Is there any other way i can do this then? And i like your sig b0ne123 XD
well rock don't have health, unless it's an unit
I would have used the variables to not have 1 line of code in a trigger/action definition which contains a lot of action in 1 line of code.
It's bad for a unexperienced mapper to learn in that way because then they can't understand their own code anymore.
It's more efficient to do it directly, but the actual gain is like 0 and only hinders new map makers.
So, it's better to advice them to use local variables instead of putting 20 function calls into each other.
Apart from that, storing these basic data types in a variable won't have a noticeable impact on the map's performance.
@topic
What Nerfpl said. ;D
This is probably the issue here. As explained, the unit-highlighted trigger won't fire unless you go into each unit in the data editor (that you want to be highlightable) and go to unit flags, and uncheck 'cannot be highlighted'