Jump to content

Regeneration like in Kotor 2?

Recommended Posts

For my Sword Art Academy mod, I made a few regen scripts for the player, which I think also works for NPCs.


If I recall correctly, this regenerates 5 HP every 10 seconds (10000 milliseconds). To change the delay, alter the wait timer near the top. This isn't the best - I got a bit lazy, so it all just works in increments of 5, rather than using proper maths to do it properly. If you have 4 HP, you'll regen to 5 HP, rather than 9 HP. This could be fixed, but it took me a long time to get that done in the first place 😄

After compiling this with BehavED, naming it regen.ibi, put it in scripts.
To activate it, run the command:

/runscript player regen

If you spawn an NPC, make sure it has a NPC name for the script to target.

/npc spawn reborn_new bob
/runscript bob regen

Of course, if this is in a custom map, you can have a target_scriptrunner activate this.

Link to comment

I wonder if SET_HEALTH can be incremental - I know some variables in Behaved are, in that you can do, for example, SET (variable, +1) and it is incremented by 1 every time it's done. If it works the same with health, then it could be simplified that if health < 100, then set health +1. May be worth a try.

Droidy365 likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...