User Tools

Site Tools


4rpl:commands:repeat

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:repeat [2021/12/23 14:28] Karsten754rpl:commands:repeat [2024/06/05 22:23] (current) – [Examples] LiteralNoob
Line 18: 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.1640287721.txt.gz · Last modified: 2021/12/23 14:28 by Karsten75