User Tools

Site Tools


4rpl:commands:repeat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
4rpl:commands:repeat [2021/01/08 11:01] – external edit 127.0.0.14rpl:commands:repeat [2024/06/05 22:23] (current) – [Examples] LiteralNoob
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
-<=[[4rpl:start| Index]]+<= [[4rpl:start| Index]] \\ 
 +<= [[4rpl:start#Flow Control]]  
  
 ====== repeat ====== ====== repeat ======
Line 16: Line 18:
     trace(<-y)     trace(<-y)
     <-y sub(1) ->  #subtract 1 from y so we don't end in infinite loop     <-y sub(1) ->  #subtract 1 from y so we don't end in infinite loop
 +endwhile
 +</code>
 +<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 "GetUnitHealRate(self)".
 +
 +while(GetUnitHealth(self) GetUnitMaxHealth(self) eq)         #If unit's current health is equal to it's max health...
 +    repeat                                                              #...repeat this section of code.
 +    SetUnitMaxHealth(self GetUnitMaxHealth 0.5 add)                     #Add 0.5 points of max health to the unit
 +    SetUnitDebugText(self Concat("Max Health: " GetUnitMaxHealth(self)) #Visual aid for you to know.
 endwhile endwhile
 </code> </code>
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/repeat.1610121708.txt.gz · Last modified: 2021/01/08 11:01 by 127.0.0.1