Ra02 Posted April 12, 2012 So as the title says, is it possible to make a script that will regenerate health over time? Like in FPS games, once damaged after 3-5 seconds health will gain 1%/sec ? Thanks in advance 0 Share this post Link to post
Krispy Posted April 12, 2012 I don't know, but I'm sure if you posted this on the skulltag forum, you'd have 3 answers within 5 minutes. 0 Share this post Link to post
Chubzdoomer Posted April 13, 2012 Yes sir. What you can do is set up a loop to constantly monitor the player's health and if it ever drops below 100 (but is above 0, meaning he's still alive), you force a delay for just a few seconds then refill his health until either he's hit again (causing yet another delay) or his health tops off at 100. I whipped up a quick example and it seems to work really well. Here's the code itself, followed by an example WAD:#include "zcommon.acs" int health = 100; //INITIALIZATION script 999 ENTER { //Assign yourself an ID Thing_ChangeTID(0,1337); } //REGENERATING HEALTH script 1 ENTER { While(True) { //Constantly work while health is under 100 While(GetActorProperty(1337,APROP_Health)<100 && GetActorProperty(1337,APROP_Health)>0) { //After each hit you take, wait for regeneration If(GetActorProperty(1337,APROP_Health)<health) { health = GetActorProperty(1337,APROP_Health); Delay(105);//Determines how long you must wait until regeneration begins Restart; } //Perform the regeneration one hit point at a time health = GetActorProperty(0, APROP_Health); SetActorProperty(1337, APROP_Health, health + 1); Delay(2);//Determines how quickly health is restored during regeneration } Delay(1); } }http://www.mediafire.com/?4mczgipfe4y0zm9 0 Share this post Link to post
Ra02 Posted April 13, 2012 thanks a lot for the script, I'll have a look on it and will use it in my wad, hopefully I will post my WIP in a few weeks, since I'm doing it alone and I want lots of stuff in it it will take a while, but I'm making some progress 0 Share this post Link to post