x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I make my health regen system better

So, I am developing a health regeneration system. I have it split into 3 custom events a timer and a function.

So when I use (for example) a healing potion it calls the event Start Health Regen from the player BP which takes two inputs: Amount which is an integer, and rate which is an integer. for this example both will be set to 10.

The Start Health Regen Custom Event has 6 Variables: HealthRegenTick which is a float, HealthRegenAmount which is an integer, HealthTickRate which is an integer, HealthTickCount which is an integer, HealthPerTick which is an integer, and IsRegeneratingHealth? which is a boolean.

HealthRegenTick is set to 1 by default, HealthRegenAmount is set by the input Amount, HealthTickRate is set by the input Rate, HealthTickCount is set to 0 by default, HealthPerTick is set to HealthRegenAmount Divided by HealthTickRate, IsRegeneratingHealth? is false by default.

from the event node is a branch with IsRegeneratingHealth? plugged into a NOT gate being the input.

from the true branch the initial values of HealthRegenAmount, HealthTickRate, HealthPerTick, and HealthTickCount are set respectively then IsRegeneratingHealth? is set to true.

From the IsRegeneratingHealth? boolean pin a timer is set by event with it's time set to HealthRegenTick, The Event is the second custom event called Health Regen, and the timers handle is output to a Clear and invalidate by handle node Connected to a third Custom event called Regen Health End.

from Health Regen is a branch with a test if HealthTickCount is greater than or equal to HealthTickRate.

from the true branch is the call for the Regen Health End event.

from the false branch is the Increase Health function which takes an input amount and adds it to the players current health clamping it at the max health. The input is set to HealthPerTick.

from the function is an increment node for the HealthTickCount.

From the Clear and invalidate by handle node is a setter for IsRegeneratingHealth? to false, and setters for HealthRegenAmount, HealthTickRate, and HealthPerTick to 0.

If the IsRegeneratingHealth? Test is true (meaning another health regeneration is happening) than the initial branch is false.

when the branch is false HealthRegenAmount is set to the current value plus the incoming value, HealthTickRate is set to the current value plus the incoming value, and HealthPerTick is set to the new Amount divided by the new Rate. This regenerates the new values from the current HealthTickCount.(for this example you drank the second potion 3 seconds after the first. You healed 1 hp every second for 3 seconds, the amount then changed to 20 and the rate to 20 for HealthTickCount 4 and on til count 20 where the Regen Health End event is triggered.

This is a clean system In my opinion and will work even when you change the HealthRegenTick (which I plan for perks doing this like stats in vitality, gear effects, and that sort of thing)

I want to implement a Potency check for this where either you gain potency for over healing, or for generally drinking potions quickly, and if you get too high of a potency you get potion sickness which dynamically weakens potions based on how high your potency is over the limit.

I also want to implement health DoT and wondered if there was a way to abstract my system to do both cleanly or if I was better just making a parallel system.

I would also enjoy a way to more smoothly move between progress bar percents with this system since the actual movement seems a bit clunky while still keeping the timing modifier the same

Product Version: UE 4.13
Tags:
more ▼

asked Dec 21 '16 at 08:09 AM in Blueprint Scripting

avatar image

Golbez22
8 1 3 5

avatar image Holybreath Dec 21 '16 at 09:10 AM

for progress bar, just do the interpolation. P.S. Instead of text, i think a screen of the blueprint would be better :P

avatar image Dieinthedark93 Dec 21 '16 at 09:24 AM

Agreed on the screenshot of the blueprints, it's well described but still difficult to follow

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question