This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 4rpl:commands:while [2021/12/23 19:29] – Karsten75 | 4rpl:commands:while [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| <code 4rpl> | <code 4rpl> | ||
| + | # CONSOLE SCRIPT | ||
| 5 ->y | 5 ->y | ||
| while < | while < | ||
| Line 19: | Line 20: | ||
| trace(< | trace(< | ||
| <-y sub(1) -> | <-y sub(1) -> | ||
| + | endwhile | ||
| + | </ | ||
| + | <code 4rpl> | ||
| + | # UNIT SCRIPT | ||
| + | |||
| + | # This script increases the max health of the unit over time. | ||
| + | # The script won't be stuck in the loop since it's limited by the unit's | ||
| + | # Health regen rate or " | ||
| + | |||
| + | while eq(GetUnitHealth(self) GetUnitMaxHealth(self)) | ||
| + | repeat | ||
| + | SetUnitMaxHealth(self GetUnitMaxHealth 0.5 add) #Add 0.5 points of max health to the unit | ||
| + | SetUnitDebugText(self Concat(" | ||
| endwhile | endwhile | ||
| </ | </ | ||
| < | < | ||