- Joined
- Sep 11, 2013
- Messages
- 387
Greetings!
In my problem I have 2 units (buildings) one in top of another preplaced in the map and I wish to make an optimized trigger that can manages to make the life of one unit dependent on the life of the other unit.
Example:
Unit 1 = 1000 hp
Unit 2 = 1000 hp
Unit 1 is attacked by a random unit and now has 900 hp -> Unit 2 must have also 900 hp
Unit 2 is attacked by a random unit and now has 800 hp -> Unit 1 must have also 800 hp
I've made this trigger and works well, but I think is not optimized.
In my problem I have 2 units (buildings) one in top of another preplaced in the map and I wish to make an optimized trigger that can manages to make the life of one unit dependent on the life of the other unit.
Example:
Unit 1 = 1000 hp
Unit 2 = 1000 hp
Unit 1 is attacked by a random unit and now has 900 hp -> Unit 2 must have also 900 hp
Unit 2 is attacked by a random unit and now has 800 hp -> Unit 1 must have also 800 hp
I've made this trigger and works well, but I think is not optimized.
-
Events
- Unit - A unit Takes damage
-
Conditions
- (Damage Target) Equal to Unit 1
-
Actions
- Wait 0.01 seconds
- Unit - Set life of Unit 2 <gen> to (Life of (Damage Target))
-
Events
- Unit - A unit Takes damage
-
Conditions
- (Damage Target) Equal to Unit 2 <gen>
-
Actions
- Wait 0.01 seconds
- Unit - Set life of Unit 1 <gen> to (Life of (Damage Target))