#include "zcommon.acs"

int health = 100;

//INITIALIZATION
script 999 ENTER
{
    //Assign yourself an ID
    Thing_ChangeTID(0,1337);
}

//REGENERATING HEALTH
script 1 ENTER
{
    While(True)
    {
        //Constantly work while health is under 100
        While(GetActorProperty(1337,APROP_Health)<100 && GetActorProperty(1337,APROP_Health)>0)
        {
            //After each hit you take, wait for regeneration
            If(GetActorProperty(1337,APROP_Health)<health)
            {
                health = GetActorProperty(1337,APROP_Health);
                Delay(105);//Determines how long you must wait until regeneration begins
                Restart;
            }
            
            //Perform the regeneration one hit point at a time
            health = GetActorProperty(0, APROP_Health);
            SetActorProperty(1337, APROP_Health, health + 1);
            Delay(2);//Determines how quickly health is restored during regeneration
        }
        
    Delay(1);
    }
}