Data Realms Fan Forums http://45.55.195.193/ |
|
Regenerating Health http://45.55.195.193/viewtopic.php?f=75&t=20823 |
Page 1 of 2 |
Author: | GA7 [ Wed Dec 22, 2010 8:26 pm ] |
Post subject: | Regenerating Health |
What is the easiest way to give an actor regenerating health? |
Author: | alphagamer774 [ Wed Dec 22, 2010 8:30 pm ] |
Post subject: | 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. |
Author: | GA7 [ Wed Dec 22, 2010 8:45 pm ] |
Post subject: | Re: Regenerating Health |
So what are the variables that I would need to make negative? |
Author: | Shook [ Wed Dec 22, 2010 9:52 pm ] |
Post subject: | Re: Regenerating Health |
EmissionDamage. BurstDamage should remain positive if you want the clone to take damage initially. |
Author: | GA7 [ Wed Dec 22, 2010 11:00 pm ] |
Post subject: | Re: Regenerating Health |
Thanks shook! |
Author: | GA7 [ Thu Dec 23, 2010 12:59 am ] |
Post subject: | Re: Regenerating Health |
Sorry for the double post, but I forgot something.... How do I keep the actor's health from going over 100? |
Author: | Roast Veg [ Thu Dec 23, 2010 1:26 am ] |
Post subject: | 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** |
Author: | GA7 [ Thu Dec 23, 2010 4:28 am ] |
Post subject: | 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? |
Author: | alphagamer774 [ Thu Dec 23, 2010 6:13 am ] |
Post subject: | 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. |
Author: | GA7 [ Thu Dec 23, 2010 6:24 am ] |
Post subject: | 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? : ( |
Author: | Roast Veg [ Thu Dec 23, 2010 12:22 pm ] |
Post subject: | 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. |
Author: | GA7 [ Thu Dec 23, 2010 6:53 pm ] |
Post subject: | Re: Regenerating Health |
Perfect! ...except that now his max health is 101. Everything else works though. |
Author: | Roast Veg [ Thu Dec 23, 2010 9:04 pm ] |
Post subject: | 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 |
Author: | GA7 [ Thu Dec 23, 2010 10:56 pm ] |
Post subject: | Re: Regenerating Health |
That did it. Thanks! |
Author: | Grif [ Fri Dec 24, 2010 7:31 am ] |
Post subject: | Re: Regenerating Health |
why not just do self.Health < self.MaxHealth, RoastVeg? Eliminates an unnecessary extra bit of code. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |