So, I think I've solved the problem for myself. I had to change alittle bit of the map which will affect game play a bit, but I think I can make it a positive change rather than a negative one. I'm posting how I did it to help anyone that might have the same problem, as well as, to make sure it will work and not leak.
I used three triggers. And I will have about 30 regions to do this with so, it will add up to quite a bit, but most of it will be quick to make (copy, change #).
This trigger create a variable for the power giving unit.
This uses the unit variable to give the power to the hero by checking ownership.
This one get rid of the unit variable when the power giving structure is destroyed, which will also make the second trigger not work.
I used three triggers. And I will have about 30 regions to do this with so, it will add up to quite a bit, but most of it will be quick to make (copy, change #).
This trigger create a variable for the power giving unit.
Trigger:
- Power Creation 01
- Events
- Unit - A unit Finishes construction
- Conditions
- (power up 01 <gen> contains (Triggering unit)) Equal to True
- (Unit-type of (Triggering unit)) Equal to Science Facility
- Actions
- If ((Number of living Science Facility units owned by (Owner of (Triggering unit))) Less than or equal to 3) then do (Set Powerup01 = (Triggering unit)) else do (Unit - Kill (Triggering unit))
- Events
This uses the unit variable to give the power to the hero by checking ownership.
Trigger:
- power01
- Events
- Unit - A unit enters power up 01 <gen>
- Conditions
- ((Triggering unit) is A Hero) Equal to True
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Owner of (Triggering unit)) Equal to (Owner of Powerup01)
- ((Triggering unit) has an item of type Reanimation Device) Equal to False
- Then - Actions
- Hero - Create Reanimation Device and give it to (Triggering unit)
- Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Owner of (Triggering unit)))) the text: Hero ready
- Else - Actions
- Do nothing
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
This one get rid of the unit variable when the power giving structure is destroyed, which will also make the second trigger not work.
Trigger:
- Power Destruction 01
- Events
- Unit - A unit Dies
- Conditions
- (power up 01 <gen> contains (Triggering unit)) Equal to True
- (Unit-type of (Triggering unit)) Equal to Science Facility
- Actions
- Set Powerup01 = No unit
- Events