Spellmonny Posted June 19, 2017 Share Posted June 19, 2017 i want to have a health slowly regen in game what should i do? Link to comment Share on other sites More sharing options...
alainmcd Posted June 28, 2017 Share Posted June 28, 2017 Hi @Spellmonny, welcome to the forums! If you're creating a new character, simply place this line in the fn function of your character lua file: inst.components.health:StartRegen(AMOUNT, PERIOD) AMOUNT being the health you want to recover and PERIOD how often in seconds. If you want any character you play as to recover health, place it in your modmain.lua, like this: AddPlayerPostInit(function(inst) if inst.components.health then inst.components.health:StartRegen(AMOUNT, PERIOD) end end) PS: you posted in the tutorials section. If you're looking for help with your mod, I suggest you post directly in the DS Modding section, or the DST Modding section if it's for DST. Link to comment Share on other sites More sharing options...
orlyx Posted January 13, 2018 Share Posted January 13, 2018 On 28.06.2017 at 12:39 PM, alainmcd said: AddPlayerPostInit(function(inst) if inst.components.health then inst.components.health:StartRegen(AMOUNT, PERIOD) end end) Can i use this code for lossing hp? @alainmcd Link to comment Share on other sites More sharing options...
alainmcd Posted January 13, 2018 Share Posted January 13, 2018 @orlyx, I think so. Link to comment Share on other sites More sharing options...
Koro sensei Posted September 29, 2018 Share Posted September 29, 2018 Where is the fn function? is it under stats? Link to comment Share on other sites More sharing options...
BraveChicken Posted September 29, 2018 Share Posted September 29, 2018 12 hours ago, Koro sensei said: Where is the fn function? is it under stats? It's the "local fn = function(inst)" in your character's prefab file, in which your character's stats are. So if you'll place the line:inst.components.health:StartRegen(amount, period) below your character's stats, then that should work. 1 Link to comment Share on other sites More sharing options...
Koro sensei Posted October 1, 2018 Share Posted October 1, 2018 ahhh i see, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now