- Joined
- May 10, 2024
- Messages
- 39
Hi. In the code bellow I issue build order to peasant. Near the farm I have Town Hall with 100% health and Guard Tower with 50% health.
I Have two problems with the code:
1. When builder finishes his order percentage life of the farm is still less than 100% while text message shows that it is 100%. See screenshot. What is it?
2. While farm is under construction it is "damaged structure" since it has less than 100% of hp. How to check that it is not under construction in one clean IF statement.
I Have two problems with the code:
1. When builder finishes his order percentage life of the farm is still less than 100% while text message shows that it is 100%. See screenshot. What is it?
2. While farm is under construction it is "damaged structure" since it has less than 100% of hp. How to check that it is not under construction in one clean IF statement.
-
Find Damaged Structures
-
Events
- Time - Every 3.00 seconds of game time
- Conditions
-
Actions
- Unit - Order Peasant 0000 <gen> to build a Farm at (Position of Peasant 0000 <gen>)
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is A structure) Equal to True
- ((Picked unit) is alive) Equal to True
- (Percentage life of (Picked unit)) Less than 100.00
-
Then - Actions
- Game - Display to (All players) the text: (Damaged structure: + (Name of (Picked unit)))
- Game - Display to (All players) the text: (Life percent: + (String((Percentage life of (Picked unit)))))
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Game - Display to (All players) the text: =============
-
Events