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"

Increasing Progress Bar With Event Tick?

I'm creating a game that has fights that will start once you shoot someone, touch someone, or get touched by them.

I figured to do that, I would create a trigger blueprint for it. Once those things overlap, it should turn on a boolean variable called Fight Started.

In the blueprint, once the Fight Started variable is turned on, I want it to start increasing the enemy and player's first stamina bar. Let's say 2 percent every tick.

alt text This is the image of the event tick I made before deciding one should fill before the other. It seemed to fire off but I couldn't actually see the increase on the progress bar. Not sure if I didn't properly set the percent function or what exactly.

So I am hoping someone could help me set this up the way I am attempting to do.

My goal is for the player and enemy to both start increasing their first stamina bar. I want it where you can switch between which bar is in creasing as well, And only one can increase at once.

So lets say I got the top bar to 100, then it should start filling the second. But let's say the first bar gets to 50 percent and you want to switch it to where the other stamina bar is increasing instead with a button input. Could someone walk me through the proper way to do this? Can provide more info and will even find a more direct way to chat about it if needed,

EDIT: Added a print string and it shows it stays at zero.

Product Version: UE 4.18
Tags:
more ▼

asked May 25 '18 at 05:33 AM in Blueprint Scripting

avatar image

zeltparker
13 3 2 6

avatar image Nebula Games Inc May 25 '18 at 05:55 AM
  1. You don't have any event to change the boolean variable in that screen shot so if it is elsewhere cool, if not, none of this would ever fire off

  2. There are 0 progress bars in this screen shot....

  3. You are setting some weirdly named variables I don't quite understand them and why they would be adding +1 on tick

  4. Timelines would be a much better use than tick for something you want to turn "on and off" as they have start and stop pins

  5. Where is the progress bar widget?

  6. What blueprint is this in? You have references to enemy AND top down character BPs....is this a level BP? If yes, I would not recommend having progress bars updated from the level BP...just seems to be a very weird place for them, also it is nearly impossible to access the level BP from any other BP

avatar image zeltparker May 25 '18 at 06:25 AM

For 1, I have this being set with a trigger in game called FightTriggerBP. For 2, I should have attached photos of the in game progress bars. Placing them below. alt text alt text

For 3, the variable names are rough names for what they are to be renamed to later. I am aiming for it to add one to the variable every second similar to how in Final Fantasy 7 has an increasing Limit Break bar as the fight goes on. During the fight, it just fills up over time. For 4, I have never used one except on a material I made so I am not very familiar with them currently. For 5, Refer to 2. For 6, this is the FightTriggerBP. It references them both because I thought putting the event tick to increase them both would be okay. Not sure where the best place actually is.

avatar image Nebula Games Inc May 25 '18 at 06:31 AM

Ok I see that these "melee/dodge" and such are names of progress bars, BUT you realize you aren't modifying the actual widget "progress bar" just an integer variable right? So that will not change the fill percent of anything. You need to reference the progress bar from the widget and change the percent by dividing current "melee/dodge" amount by max level. Also, for percentages you need to have the value as a float. You can convert integers to floats but it is easier to just start them off as a float honestly.

avatar image zeltparker May 25 '18 at 06:52 AM

Okay, so could you show me an example of it connected to the progressbar refs once I drag that in? And also the switching which one is filling if you have any ideas on that.

avatar image Nebula Games Inc May 25 '18 at 03:33 PM

Use a "FlipFlop" node for switching and switch based on whatever the input key is you want

avatar image Nebula Games Inc May 25 '18 at 06:48 AM

This is a tutorial I made for a generic "health bar" which is a widget with a progress bar, exactly like you are using. Although the set-up is not identical modifying the progress bar is the same regardless. If you start watching from around 2:30 you will see the steps I go through to create a function on the widget to "set percent" which is what you need to do to actually modify your progress bar fill percent. In your case the 2 float variables you would divide would be "initial melee/dodge" vs "final melee/dodge". So it should start at 0/100, and you +1 every "x" seconds to the "initial value" in whatever BP you like (you will need to reference the widget somehow in that BP though) and then call the "update" function I created. The point I am trying to make with this is, you aren't changing the progress bar at all, only the "variables" located in the player and enemy BPs. You need to link those variables to the progress bar percent fill as I do with player health in the video.

https://youtu.be/BdARbvNrvQE

Hope that helps.

avatar image zeltparker May 25 '18 at 06:57 AM

Just saw this. Will look over, thanks

avatar image Shadowriver May 25 '18 at 07:56 PM

First issue i see is daley, what you producing wont create wait if this is what you wanted, insted it delays all ticks and call next node with same frequency just with 1 sec deley

2nd you not scaling delta values (your +1s) by delta time, the way it is now it will +1 on every frame of the game, but if you tun game on 30fps it will increase value 30 points/sec and if you have 60fps it will be 60 point/sec, Or else you sync game movment with framerate (like Street Fighter V does) your value changes will heavily depends on users game performance and will be desync with the game case by case. Thats why there delta time is there (it called Delta Secounds) containing estimated time that passed between the ticks, so you multiple it with any change/delta value (in your case 1*DeltaTime) this will make you value always increase 1 point/sec without any effect from frame rate.

Problem is you using integers, which is impossible to scale by time, so you would need to convert to floats. If you really want to use integers, it's way moee efficient to just use timers instead of counting time in tick to increase the value:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/UseTimers/Blueprints

(comments are locked)
10|2000 characters needed characters left

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