View unanswered posts | View active topics It is currently Sat Dec 28, 2024 5:05 am



Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
 Regenerating Health 
Author Message

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Regenerating Health
What is the easiest way to give an actor regenerating health?


Wed Dec 22, 2010 8:26 pm
Profile
User avatar

Joined: Wed Feb 10, 2010 4:06 am
Posts: 1294
Location: Comox, BC, Canada
Reply with quote
Post Re: Regenerating Health
By making the wounds he has do negative damage. That way, he takes damage from the weapon, but where he would bleed out, he actually heals back up.


Wed Dec 22, 2010 8:30 pm
Profile WWW

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
So what are the variables that I would need to make negative?


Wed Dec 22, 2010 8:45 pm
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Regenerating Health
EmissionDamage. BurstDamage should remain positive if you want the clone to take damage initially.


Wed Dec 22, 2010 9:52 pm
Profile WWW

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
Thanks shook!


Wed Dec 22, 2010 11:00 pm
Profile

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
Sorry for the double post, but I forgot something.... How do I keep the actor's health from going over 100?


Last edited by GA7 on Thu Dec 23, 2010 1:27 am, edited 1 time in total.



Thu Dec 23, 2010 12:59 am
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: Regenerating Health
That would require some Lua sparkle magic, as follows:
Code:
function Update(self)
    if self.Health >= 100 then
        self.Health = 100;
    end
end


And can be attached in an .ini file by adding this line:
Code:
ScriptPath = **insert filepath here, e.g. RTE.rte/Script.lua**


Thu Dec 23, 2010 1:26 am
Profile

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
Okay, I tried the negative emissiondamage thing, and it works, but not the way I was hoping it would. I'm trying to get a regenerating effect more like what the Darkstorm actors have. I know that darlos used a script to do that, and I would just use his script, but it is chock full of other stuff that I don't need... so could someone help me out and post a script that will regenerate health at a steady rate?


Thu Dec 23, 2010 4:28 am
Profile
User avatar

Joined: Wed Feb 10, 2010 4:06 am
Posts: 1294
Location: Comox, BC, Canada
Reply with quote
Post Re: Regenerating Health
Knowing shit-all about lua, couldn't you just go

If actor health < 100
then Actor health = Health + 1

Obviously in pseudocode, just put it into the above .lua file. Or combine them, for maximum effect.


Thu Dec 23, 2010 6:13 am
Profile WWW

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
Yes, but that would regenerate way too fast. I need some way to put a timer in there. Here's what I have so far:
Code:
function Create(self)
   InitializeKeys();

   self.healTimer = Timer();
   self.healTime = 2000;
   self.maxHealth = 100;
end

function Update(self)
   if not(self:IsDead()) then
      --healz!
      if self.healTimer:IsPastSimMS(self.healTime) then
         self.Health = self.Health + 1;
         if self.Health > self.maxHealth then
            self.Health = self.maxHealth;
         end
         self.healTimer = Timer();
      end
   end
end


It doesn't do anything though. I know nothing about lua, so I don't know what I'm doing wrong.

Help? : (


Thu Dec 23, 2010 6:24 am
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: Regenerating Health
Try this instead:
Code:
function Create(self)
   self.healTimer = Timer();
   self.healTime = 2000;
   self.maxHealth = 100;
end

function Update(self)
   if self.ToDelete ~= true and self.Health <= self.maxHealth then
      --healz!
      if self.healTimer:IsPastSimMS(self.healTime) == true then
         self.Health = self.Health + 1;
         self.healTimer:Reset();
      end
   end
end


I might have my resetting code wrong, but the rest should be ok.


Thu Dec 23, 2010 12:22 pm
Profile

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
Perfect!

...except that now his max health is 101. Everything else works though.


Thu Dec 23, 2010 6:53 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: Regenerating Health
Huh, funny that. Replace this:
Code:
if self.ToDelete ~= true and self.Health <= self.maxHealth then

with this:
Code:
if self.ToDelete ~= true and self.Health <= self.maxHealth - 1 then


Thu Dec 23, 2010 9:04 pm
Profile

Joined: Wed Dec 15, 2010 4:25 am
Posts: 9
Reply with quote
Post Re: Regenerating Health
That did it. Thanks!


Thu Dec 23, 2010 10:56 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Regenerating Health
why not just do self.Health < self.MaxHealth, RoastVeg? Eliminates an unnecessary extra bit of code.


Fri Dec 24, 2010 7:31 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


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.041s | 15 Queries | GZIP : Off ]