Health Regeneration

I’m looking for a script that will regenerate one heart every minute as long as your on the overworld. The overworld being prefixed “newworld”. While not on the overworld, the script needs to stop functioning. Also, it needs to be able to heal with AP lower than 40…this is what i screwed around with so far, and of course it’s not working.

//#CLIENTSIDE
if (timeout||created) {
  if(startswith(newworld,#L&&playerap < 100&&playerap > 0)) {
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    sleep 1;
    playerhearts+=1;
    timeout=0.05;
  }
  else
  break;
}
  

^ Lol no idea how to get this working. Help anyone?

if(playerenters || timeout) timeout = 1; if(timeout && startswith(newworld,#L)) { playerhearts++; }

Reason yours broke, it would stop completely and never start again once you left the overworld. Plus:

if(startswith(newworld,#L&&playerap < 100&&playerap > 0)) {
You stuck “&&playerap < 100&&playerap > 0” within “startswith(newworld,#L)”
And since you’re checking for AP (which isn’t needed), you have it so it doesn’t work for people with 0 or 100 AP.

Ah ok, I see… gotta like timeouts more…

AP is needed though as you dont regain the hearts with less than 40…

(and if anyone was wondering, yes i know it says sleep 1; I was just using that as a placeholder)

Sleep 1; is just fine.
But you do gain hearts regardless of AP when you simply modify the playerhearts

It’s not happening though :B… I set my AP to 0 and nothing :B…

Bitchin’. THink I recall something like this earlier.
Retarded client limitation (probably to prevent hackers).

Alrighty then.

if(playerenters || timeout) timeout = 1; if(timeout && startswith(newworld,#L)) { if(playerap<40) {this.ap=playerap;playerap = 40;} else this.ap=-1; playerhearts++; if(this.ap>=0) playerap = this.ap; }

Good maan, it works :slight_smile: Thanks.

ALTHOUGH, it does suck that when you cross levels on the gmap, it restarts the timeout… so you cant roam the overworld and regenerate, you have to stay in one level -_-

If it’s in a weapon you could probably replace it with if (created||timeout).

If you really want to, you could shorten the timeout, and make a variable that is just a counter (to 1minute or whatever interval). That way it won’t startover each level. Though you’ll be running timeouts much more often.

if (created) is broken :smiley:

I thought that was fixed?

oldcreated = true
in the server options just about fixes it. Its “false” by default, again, I don’t know why.

Yeah, got it working with ‘created’ thanks.