
 Re: How to make script to regenerate health
There are 3 main ways (that I know of) which you could use to make an actor invincible
1. Nigh Indestructible (aka structural integrity tweak) - Bullets bounce off this guy, lasers get stopped dead, and rocket launchers don't even scratch him.
To achieve this effect, 
1. Open up Cortex Command folder...
2. Open up the .ini script of the actor you want to change (eg. for Coalition soldiers, open up Coalition.rte/Actors/Soldier/Soldier.ini)
3. Find this line of code
Code:
PresetName = Soldier Light
4. About a dozen lines beneath this line of code, find this piece of code
Code:
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Kevlared Flesh
      Resolution = 4
      Depth = 0
5. Change "Kevlared Flesh" to "Mega Metal" (without quotes) or "Test" (if you want the guy to be really indestructible)
6. (optional but recommended) Find a line of code called 
Code:
   ImpulseDamageThreshold = 2500
 and another line of code called
Code:
   GibImpulseLimit = 3650
 and tweak the numbers to some ridiculous value like 999999.
Alternatively for step 5, you could just change the code into
Code:
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Kevlared Flesh
         StructuralIntegrity = 9999
      Resolution = 4
      Depth = 0
 (aka wound tweak) - Sure bullets might penetrate this guy and sure he might bleed, but you can empty a hundred gatling gun clips into him and he'll still be standing.
1. Copy this code and paste it into whatever .ini file you're working with.
Code:
AddEffect = AEmitter
   PresetName = Wound Flesh Entry No Damage
   Mass = 0.0001
   HitsMOs = 0
   GetsHitByMOs = 0
   SpriteFile = ContentFile
      FilePath = Base.rte/Effects/Wounds/FleshWoundA.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -1
      Y = -2
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Flesh
      Resolution = 2
      Depth = 5
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Flesh
      Resolution = 3
      Depth = 5
   DeepCheck = 0
   JointStrength = 10000
   JointStiffness = 1
   DrawAfterParent = 1
   AddEmission = Emission
      EmittedParticle = MOPixel
         CopyOf = Drop Blood
      Spread = 0.1
      MaxVelocity = 4
      MinVelocity = 1
   BurstSound = Sound
      CopyOf = Flesh Penetration Hit
   EmissionEnabled = 1
   EmissionCountLimit = 20
   EmissionsIgnoreThis = 1
   ParticlesPerMinute = 100
   BurstSize = 8
   BurstScale = 3
   BurstDamage = 0 //Important
   BurstTriggered = 1
   EmissionDamage = 0 //Also Important
   Flash = None
   FlashOnlyOnBurst = 0
2. Open the .ini file of whatever unit you're changing and find this line of code
Code:
   EntryWound = AEmitter
      CopyOf = Wound Flesh Entry
   ExitWound = AEmitter
      CopyOf = Wound Flesh Exit
3. Change the "Wound Flesh Entry" and "Wound Flesh Exit" to "Wound Flesh Entry No Damage" (without " ")
4. Find the line
 and change the 20 to either 999999 or -1
3. Ghost Style Fighter - You can see this guy, you can feel this guy, but you just can't shoot this guy. (side effects such as missing body and floating limbs may occur)
1. Make an ordinary text file and copy this script into the text file
Code:
Function Update(self)
      for i = 0, MovableMan:GetMOIDCount() do
         if MovableMan:GetRootMOID(i) == self.ID then
            local object = MovableMan:GetMOFromID(i);
            if not(object:IsDevice()) then
               object.Scale = 0;
            end
         end
      end
end
2. Name this script "Ghost.lua" and put it in some .rte folder (lets just say the Coalition.rte folder)
3. Open up actor file you want to mod and beneath its PresetName, add this line:
Code:
   ScriptPath = Coalition.rte/Ghost.lua
And I spent way too much time writing this 

edit: Just realized this was my 200th post
edit2: There are at least a dozen other ways to create an invincible actor, although it kinda depends on how far you can stretch your imagination. I won't bother posting the code here, but if you search up "phoenix potion", you'll be able to find a mod which allows your actor to always resurrect itself whenever it dies. A cooler version would be the 
They Hunger mod which has these eldritch abomination like creatures capable of literally reassembling themselves after you've blown them to pieces, several dozen times.