View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:37 am



Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
 How to make script to regenerate health 
Author Message

Joined: Sun Mar 04, 2012 11:25 am
Posts: 18
Reply with quote
Post How to make script to regenerate health
Title says all. How can i make script to make soldiers regenerate health ?


Mon Apr 02, 2012 4:42 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: How to make script to regenerate health
Pretty easily actually. However, it might not work like you think.
The actual code for increasing their health is like so:
Code:
function onUpdate(self)
  if self.Health < 100 then
    self.Health = self.Health + 1;
  end
end

Save that into a text file, change the file extension to .lua, and add a line to the Actor's ini: ScriptPath = (your mod's rte)/(path to lua file).lua
However, this will only increase the numerical health value above the actor's head. If they have many wounds in their body, they might have body parts begin gibbing. You can fix this in ini by increasing the GibWoundLimit on all of their body parts.


Mon Apr 02, 2012 5:41 pm
Profile

Joined: Sun Mar 04, 2012 11:25 am
Posts: 18
Reply with quote
Post Re: How to make script to regenerate health
Duh102 wrote:
Pretty easily actually. However, it might not work like you think.
The actual code for increasing their health is like so:
Code:
function onUpdate(self)
  if self.Health < 100 then
    self.Health = self.Health + 1;
  end
end

Save that into a text file, change the file extension to .lua, and add a line to the Actor's ini: ScriptPath = (your mod's rte)/(path to lua file).lua
However, this will only increase the numerical health value above the actor's head. If they have many wounds in their body, they might have body parts begin gibbing. You can fix this in ini by increasing the GibWoundLimit on all of their body parts.



Thanks and how can i make certain unit to have unlimited armor, to make him undestructable ?


Mon Apr 02, 2012 8:09 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: How to make script to regenerate health
That's not such an easy request. Your best bet is to take the .ini for your actor, find the definition for the armour and set the gibwoundlimit and gibimpulselimit to very high, or don't set it.


Mon Apr 02, 2012 8:11 pm
Profile
User avatar

Joined: Wed Jan 25, 2012 4:20 pm
Posts: 38
Reply with quote
Post Re: How to make script to regenerate health
you can make an actor invincible by making all of his limbs/attachments made of material with high enough integrity that nothing can damage it. Like "Test".


Tue Apr 03, 2012 3:54 am
Profile
User avatar

Joined: Sun Dec 25, 2011 7:23 am
Posts: 269
Reply with quote
Post 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


2. Mega Meat Shield (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
Code:
   GibWoundLimit = 20
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 :roll:

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.


Last edited by ryry1237 on Tue Apr 03, 2012 4:25 pm, edited 1 time in total.



Tue Apr 03, 2012 11:01 am
Profile

Joined: Sun Mar 04, 2012 11:25 am
Posts: 18
Reply with quote
Post Re: How to make script to regenerate health
ryry1237 wrote:
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


2. Mega Meat Shield (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
Code:
   GibWoundLimit = 20
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/Invis.lua

And I spent way too much time writing this :roll:

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.




Oh my god thank you, this is realy helpfull and this is what exactly what i was searching for.

One more question tho, where can i find list of all avaible materials ?


Tue Apr 03, 2012 2:08 pm
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: How to make script to regenerate health
Base.rte/Materials.ini

Lists them all in order of index.


Tue Apr 03, 2012 2:12 pm
Profile

Joined: Sun Mar 04, 2012 11:25 am
Posts: 18
Reply with quote
Post Re: How to make script to regenerate health
Kettenkrad wrote:
Base.rte/Materials.ini

Lists them all in order of index.



Ok, something went a bit wrong. I have browncoat and i want him to be from meta. I changed every Material copy of to Metal, but once i shoot him, he is still bleeding. What is wrong ?


Tue Apr 03, 2012 8:21 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: How to make script to regenerate health
Material only determines how strong his skin is, if it's pierced it will still use the same wounds as before. You'd have to change the wounds definitions for him if you wanted his wounds to look and bleed differently.


Tue Apr 03, 2012 10:22 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: How to make script to regenerate health
Metal is much tougher than flesh, but not indestructible tough.

You should add StructuralIntegrity = X after CopyOf = Metal, where X is the "toughness" of the material. As a reference, sand is 25, armoured flesh is 40, concrete 90, metal 110 and mega metal 190.

If you make it 220 or more aprox., most vanilla guns won't be able to damage the actor.

But note, wounds will still hurt the actor and he will still bleed, but making wounds will be much harder.

EDIT:

Bah, Ninja'd.


Tue Apr 03, 2012 10:25 pm
Profile
User avatar

Joined: Sun Dec 25, 2011 7:23 am
Posts: 269
Reply with quote
Post Re: How to make script to regenerate health
Informally speaking, metal is a lot weaker than you'd think.


Wed Apr 04, 2012 6:44 am
Profile

Joined: Sun Mar 04, 2012 11:25 am
Posts: 18
Reply with quote
Post Re: How to make script to regenerate health
Duh102 wrote:
Material only determines how strong his skin is, if it's pierced it will still use the same wounds as before. You'd have to change the wounds definitions for him if you wanted his wounds to look and bleed differently.


And how can i change the wound definition ?


Wed Apr 04, 2012 3:11 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: How to make script to regenerate health
There's two entries on an actor's part definitions, EntryWound and ExitWound, both of those refer to AEmitters which you will need to find if they're not in the same file. Those wounds have images associated with them and a burstdamage and whatnot, it should be fairly self-explanatory.
I don't have the Cortex files in front of me so I can't be too specific, sadly.


Wed Apr 04, 2012 4:09 pm
Profile
User avatar

Joined: Sat Jun 23, 2012 2:03 pm
Posts: 340
Location: At home, drinking some tears (probably mine)
Reply with quote
Post Re: How to make script to regenerate health
Hey, sorry to necro this thread, but I was wondering about how to make the health regen more Call of Duty style (which is basically you take hits and your screen is all bloody, but then you find cover, you wait 5-7 seconds and you start to regenerate your health).

It makes it more fair than just always regenerating health.
And one more question if you're willing to answer: I haven't tried out the script, but how fast does it regen, and is that adjustable?


Sat Jul 14, 2012 11:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 18 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: Google [Bot]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.177s | 14 Queries | GZIP : Off ]