So I'm trying to add a bit of 'uniqueness' to my first level of my campaign. It's in a very rocky lava filled area with lots of cliffs, so the ideal mode of getting around is Reapers.
Here's what I want to accomplish:
1. Give the Reaper a blue-bar (Like Protoss buildings when you hover over them and they are building a unit) when the Reaper is at less than full energy.
2. Give the Reaper a short-term ability to run 'underwater'. (This will be Lava)
3. Disable his energy regeneration while he's 'underwater'.
4. Kill the reaper if he is underwater and his energy runs out.
What I've accomplished:
1. Detected when a Reaper enters "water". (Have to use Regions, can't seem to use Water nor a texture underneath the unit :( )
2. Subtracted energy from him for as long as he stays under water.
However. Here's the issue I'm running into.
I can't do a bunch of stuff per-unit. I was originally doing (triggering unit) to set his current Energy, but that doesn't work because it only fires when he enters the region. Because of this, I created another trigger that fires every 1 game second, and it removes his energy. However, now I can't do it per-unit because it's no longer using a region.
Can anyone just explain the gist of what I need to do to make this work?
Ps. A way to stop energy regeneration while he's in the region would be nice too. :)
The first one, should run whenever a unit enters a region (the water), if you have several regions for water, you should be able to add them all to the events. When they enter, add them to a Unit Group (a global variable), and reduce their Energy Regeneration to 0%. Think this can be done with the "Change Unit Property" action.
The second trigger should remove them from this unit group when they leave the region, and also return their Energy Regeneration to whatever it was before.
The third trigger, running every 1 seconds, use the "Pick every unit in Unit Group", and reduce their energy (also with "Change Unit Property". Or if you prefer that, use an If, Then, Else action to check their energy, if it's above 0, reduce it by however much you want to reduce it, or if it's at 0 already, kill them.
Also, you can do the water thingies by using height if you have water EVERYWHERE. And wow, technology must be rly advanced if we can survive under lava :D
I had them added to a Unit Group earlier. I feel dumb now having even seen the Set Unit Property thing and it's possibilities. >>
However, I see a flaw in your plan. It's safe to assume that the player is going to put every reaper into the water at the same time, and get them out as one. However, we know that people will do multiple groups going on in different sections of the map.
Because of this, won't a Global Var "CurrentEnergy" not work, since each reaper will have it's own energy level? If not, where would the local variable for the reaper go?
@Eldrazor: I thought about that but it's no good. My entire level is built below 'sealevel' and it's held back by levees of cliff.
There is no var pointing at CurrentEnergy of the reaper...? Only a unit group that keeps track of under lava/above lava. The energy level is stored in the unit itself.
Unit Group - Pick each unit in UnitsInLava and do (Actions)
Actions
Unit - Set (Picked unit) Energy to (((Picked unit) Energy (Current)) - 1.0)
Blah I'm dumb for not doing that in the first place. Been spending too much time with Actionscript and instances and so on.
That works perfectly. I'll go poke around the Nexus to see how they make the build bar on hover, and see if I can apply that to a unit. If not, I'lll find a way to force whatever Alt does onto the reaper when it's <100%.
Cheers all!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I'm trying to add a bit of 'uniqueness' to my first level of my campaign. It's in a very rocky lava filled area with lots of cliffs, so the ideal mode of getting around is Reapers.
Here's what I want to accomplish:
1. Give the Reaper a blue-bar (Like Protoss buildings when you hover over them and they are building a unit) when the Reaper is at less than full energy.
2. Give the Reaper a short-term ability to run 'underwater'. (This will be Lava)
3. Disable his energy regeneration while he's 'underwater'.
4. Kill the reaper if he is underwater and his energy runs out.
What I've accomplished:
1. Detected when a Reaper enters "water". (Have to use Regions, can't seem to use Water nor a texture underneath the unit :( )
2. Subtracted energy from him for as long as he stays under water.
However. Here's the issue I'm running into.
I can't do a bunch of stuff per-unit. I was originally doing (triggering unit) to set his current Energy, but that doesn't work because it only fires when he enters the region. Because of this, I created another trigger that fires every 1 game second, and it removes his energy. However, now I can't do it per-unit because it's no longer using a region.
Can anyone just explain the gist of what I need to do to make this work?
Ps. A way to stop energy regeneration while he's in the region would be nice too. :)
If I understood you right, this is how I'd do it.
You'd need three triggers.
The first one, should run whenever a unit enters a region (the water), if you have several regions for water, you should be able to add them all to the events. When they enter, add them to a Unit Group (a global variable), and reduce their Energy Regeneration to 0%. Think this can be done with the "Change Unit Property" action.
The second trigger should remove them from this unit group when they leave the region, and also return their Energy Regeneration to whatever it was before.
The third trigger, running every 1 seconds, use the "Pick every unit in Unit Group", and reduce their energy (also with "Change Unit Property". Or if you prefer that, use an If, Then, Else action to check their energy, if it's above 0, reduce it by however much you want to reduce it, or if it's at 0 already, kill them.
Also, you can do the water thingies by using height if you have water EVERYWHERE. And wow, technology must be rly advanced if we can survive under lava :D
I had them added to a Unit Group earlier. I feel dumb now having even seen the Set Unit Property thing and it's possibilities. >>
However, I see a flaw in your plan. It's safe to assume that the player is going to put every reaper into the water at the same time, and get them out as one. However, we know that people will do multiple groups going on in different sections of the map.
Because of this, won't a Global Var "CurrentEnergy" not work, since each reaper will have it's own energy level? If not, where would the local variable for the reaper go?
@Eldrazor: I thought about that but it's no good. My entire level is built below 'sealevel' and it's held back by levees of cliff.
There is no var pointing at CurrentEnergy of the reaper...? Only a unit group that keeps track of under lava/above lava. The energy level is stored in the unit itself.
Unit Group - Pick each unit in UnitsInLava and do (Actions)
Actions
Unit - Set (Picked unit) Energy to (((Picked unit) Energy (Current)) - 1.0)
Should do the trick every second or so.
Blah I'm dumb for not doing that in the first place. Been spending too much time with Actionscript and instances and so on.
That works perfectly. I'll go poke around the Nexus to see how they make the build bar on hover, and see if I can apply that to a unit. If not, I'lll find a way to force whatever Alt does onto the reaper when it's <100%.
Cheers all!