Hi everyone, I'm currently working on a map where I want a certain hero to gain energy when player 2 units die. What is the best way to handle this? So far I've come up with this:
So in the picture above I'm trying to grab the old energy level, and add to it, then set the hero's current energy. The only thing I'm lacking, is getting the current energy level on a unit, in this case Kerrigan. How do I get the current energy level of a unit? Does anyone have any ideas?
There is a function called "Unit Property" that returns any value of a unit (life, energy, shields etc.) as a Real Value. Therefore you need to change both variables from "Integer" to "Real" type.
Thats one of the biggest obstacles in Trigger editor for newcomers, to know where and how to get which value. Dont hesitate to ask though, glad I could have helped you out.
Sorry for being a little short. I were a bit busy yesterday.
I think this would work for your purpose. Just replace the "triggering unit" with Kerrigan.
As seen in the first screenshot I posted, go to the value of the energy (2). Instead of writng a value go to functions. Select Arithmetic (Real). Here you can add two values togheter as seen in screenshort 2. Change the "Value 1" in (Value 1 + 2.0) to the function "unit property". It will then show as this:
Unit - Set (Triggering unit) Energy to (((Triggering unit) Life (Current)) + 2.0)
Change the Life into Energy, and replace "Triggering unit" with your Kerrigan unit.
This set the old energy level plus 2 energy for every time the action triggers.
If I understood you correctly then this is what your after :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi everyone, I'm currently working on a map where I want a certain hero to gain energy when player 2 units die. What is the best way to handle this? So far I've come up with this:
(in case link doesn't work: http:prntscr.com/7fupp5)
So in the picture above I'm trying to grab the old energy level, and add to it, then set the hero's current energy. The only thing I'm lacking, is getting the current energy level on a unit, in this case Kerrigan. How do I get the current energy level of a unit? Does anyone have any ideas?
There is a function called "Unit Property" that returns any value of a unit (life, energy, shields etc.) as a Real Value. Therefore you need to change both variables from "Integer" to "Real" type.
Where is this function?
This is all I see
O WOW NVM
you have to change the variable to real first, before you can see it..... SIGH
I'm sorry, but that's really stupid unless you know that functions don't show unless they are being returned properly
Thats one of the biggest obstacles in Trigger editor for newcomers, to know where and how to get which value. Dont hesitate to ask though, glad I could have helped you out.
So i'm still having one last issue I need the event to go off when player 2's unit dies. The event I wrote above works when any unit dies. Any ideas?
I got it!!! If anyone is interested this is what I came up with!
What a pain man! Its really hard to find what you want, even when its so simple.
Thanks for the help!
Couldn't this be solved more easily with arithmetic? Maybe this can help.
Sorry for being a little short. I were a bit busy yesterday.
I think this would work for your purpose. Just replace the "triggering unit" with Kerrigan.
As seen in the first screenshot I posted, go to the value of the energy (2). Instead of writng a value go to functions. Select Arithmetic (Real). Here you can add two values togheter as seen in screenshort 2. Change the "Value 1" in (Value 1 + 2.0) to the function "unit property". It will then show as this:
Unit - Set (Triggering unit) Energy to (((Triggering unit) Life (Current)) + 2.0)
Change the Life into Energy, and replace "Triggering unit" with your Kerrigan unit.
This set the old energy level plus 2 energy for every time the action triggers.
If I understood you correctly then this is what your after :)