I would like to clarify that this is not my code, I borrowed it from this thread: viewtopic.php?f=3&t=53312&hilit=regenerating+armor
Code: Select all
script 4 ENTER
{
//Change this to control the cap.
int ARMORCAP = 100;
//Health and Armor when script (re)starts.
int OldHealth = GetActorProperty(0, APROP_Health);
int Armor = CheckInventory("shields");
//Prevents armor giving if you're dead.
if (OldHealth > 0)
{
//Waits 5 seconds.
delay(35*5);
//Health 5 seconds later.
int NewHealth = GetActorProperty(0, APROP_Health);
//Checks if you are taking damage and, if not, regenerates until you do.
while (NewHealth == OldHealth && Armor < ARMORCAP)
{
GiveInventory("ArmorRegenBonus", 1);
delay(14);
NewHealth = GetActorProperty(0, APROP_Health); //damage checker
}
}
delay(5);
restart;
}