| Author | Message | 
        
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Regenerating HealthWhat is the easiest way to give an actor regenerating health? 
 
 | 
		
			| Wed Dec 22, 2010 8:26 pm | 
					
					   | 
	
	
		|  | 
	
			| alphagamer774 
					Joined: Wed Feb 10, 2010 4:06 am
 Posts: 1294
 Location: Comox, BC, Canada
   |   Re: Regenerating HealthBy 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 | 
					
					     | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthSo what are the variables that I would need to make negative? 
 
 | 
		
			| Wed Dec 22, 2010 8:45 pm | 
					
					   | 
	
	
		|  | 
	
			| Shook 
					Joined: Fri Feb 16, 2007 8:43 pm
 Posts: 1695
 Location: AH SHIT FUCK AUGH
   |   Re: Regenerating HealthEmissionDamage. BurstDamage should remain positive if you want the clone to take damage initially. 
 
 | 
		
			| Wed Dec 22, 2010 9:52 pm | 
					
					     | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthThanks shook! 
 
 | 
		
			| Wed Dec 22, 2010 11:00 pm | 
					
					   | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthSorry 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 | 
					
					   | 
	
	
		|  | 
	
			| Roast Veg Data Realms Elite 
					Joined: Tue May 25, 2010 8:27 pm
 Posts: 4522
 Location: Constant motion
   |   Re: Regenerating HealthThat 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 | 
					
					   | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthOkay, 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 | 
					
					   | 
	
	
		|  | 
	
			| alphagamer774 
					Joined: Wed Feb 10, 2010 4:06 am
 Posts: 1294
 Location: Comox, BC, Canada
   |   Re: Regenerating HealthKnowing 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 | 
					
					     | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthYes, 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 | 
					
					   | 
	
	
		|  | 
	
			| Roast Veg Data Realms Elite 
					Joined: Tue May 25, 2010 8:27 pm
 Posts: 4522
 Location: Constant motion
   |   Re: Regenerating HealthTry 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 | 
					
					   | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthPerfect!
 ...except that now his max health is 101. Everything else works though.
 
 
 | 
		
			| Thu Dec 23, 2010 6:53 pm | 
					
					   | 
	
	
		|  | 
	
			| Roast Veg Data Realms Elite 
					Joined: Tue May 25, 2010 8:27 pm
 Posts: 4522
 Location: Constant motion
   |   Re: Regenerating HealthHuh, funny that. Replace this: Code: if self.ToDelete ~= true and self.Health <= self.maxHealth thenwith this: Code: if self.ToDelete ~= true and self.Health <= self.maxHealth - 1 then
 
 | 
		
			| Thu Dec 23, 2010 9:04 pm | 
					
					   | 
	
	
		|  | 
	
			| GA7 
					Joined: Wed Dec 15, 2010 4:25 am
 Posts: 9
   |   Re: Regenerating HealthThat did it. Thanks! 
 
 | 
		
			| Thu Dec 23, 2010 10:56 pm | 
					
					   | 
	
	
		|  | 
	
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   Re: Regenerating Healthwhy not just do self.Health < self.MaxHealth, RoastVeg? Eliminates an unnecessary extra bit of code. 
 
 | 
		
			| Fri Dec 24, 2010 7:31 am | 
					
					   | 
	
	
		|  | 
	
	
		|  |