This is page about Barabas' regeneration, for Paradox and his project.
1) Only AI2 powered characters can regenerate in a way similar to Barabas. For the player, there are hypos. ^_^
2) Only the 05 - Barabbas shoot | 06 - Barabbas advance | 07 - Barabbas melee CMBT behaviors offer the ability of regeneration.
4) When an AI2 character is made unkillable (either by script or via flags in CHAR), the total amount of hit points which can be healed is limited to the value of the character's basic health. That means if the character has 100 hit points, he/she can heal a maximum of 100 hit points altogether, then regeneration is disabled. Read section 6 about the mechanics of regeneration to fully understand.
5) The Regeneration mechanic can be called an unlimited number of times, unless it is disabled by the unkillable/maximum-healed-hit points limitation (read section 6).
6) Mechanics of regeneration:
- When an AI2 character has 40% of its basic health or less, the regeneration mechanic starts.
- An AI2 character can be healed only up to 80% of its basic health, then the engine ends regeneration. If the AI2 is forced to end regeneration earlier (e.g. because an enemy comes nearby), and its actual health is over 40% of basic health, it won't regenerate further. It will perform other actions until its health drops under 40% of base health again.
- For an AI to start regenerating, a distance from the enemy of about 40 world units is required. Due to this, the AI2 attempts for about 300 game time units to get at least this distance from its enemy. If this is unsuccessful and the enemy is still too close, the regeneration behavior is halted for some time (the AI starts fighting again) but after some more time (^_^') the regeneration behavior resumes.
- When it reaches the required distance, the AI goes into animation: type 219, state from 07 to 68, variant 00|00|00|02 (fight variant). For a successful transition into state 68, at least one of the combat idle animations (for example STRCOMidle1) must have a shortcut to state 68 (see TRAM for info about animation shortcuts). This is required for the actual regeneration process to take place. If an AI succeeds in getting into state 68, it loops an animation: type 219, state from 68 to 68, variant 00|00|00|02 (fight variant). Along with that, the engine calls something similar to the elderrune cheat for this AI2 character. That is what actually heals it.
- When terminated, the AI character goes back to its job (fighting, usually ^_^'). The total hit points healed during all regeneration sessions are added together. This sum of all regained hit points has its own meaning when an AI2 character is unkillable (read section 4).
Mystery solved. Now we can give regeneration to other TRACs as well.
It looks like the required 150 hit points is a bit too much health for ordinary non-boss opponents, but keep in mind that in fact the engine can heal AI2 characters to only 80% of their maximum hit points, which is about 120 (it usually heals one or two hit points over 80%, which is nothing much). 120 is the basic health of red Elites. So we can take the Elite_hard ONCC, give it additional health via CHAR so his basic health is 150, and then (via chr_set_health) reduce his hit points to 80% of his basic health when he is spawned. This way, we can get "harder hard elites" ^_^