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"

Progress Bar Issue

Hello men, i have created these pics to explain the problem: there is a progress bar and it works normally for the first level. 10 points and each point the bar increment by one unit. So when i reach 10 points the bar is empty with new level. When i reach 11 points there is the great issue: Next level is composed by 20 points but the bar is at 55% at 11 points and the other 45% is composed by 19 points. Can you help me? Where is the mistake? alt text alt text alt text alt text alt text

Product Version: UE 4.20
Tags:
9.png (27.8 kB)
10.png (29.0 kB)
11.png (29.0 kB)
barbp.png (86.9 kB)
hud.png (58.9 kB)
more ▼

asked Nov 07 '18 at 06:37 PM in Blueprint Scripting

avatar image

miaminl
6 2 2

avatar image WaxOff Nov 07 '18 at 07:32 PM

Not entirely sure, but what stood out to me was the part after the branch in which you set CurrentXP to (CurrentXP - NeededXP).
It could also have something to do with your Add Grade function that I don't believe you've attached.
Debugging this on your own is pretty simple, and learning how to do so would benefit you immensely in the future; you can start off by printing your values to the screen or watching them inside the blueprint itself at runtime, and make sure they make sense.
If you think about it, it makes sense; you have 11 points out of 20, which is just a bit over 50%.
According to the logic you described - your progress bar should display the difference between your current grade's minimal and maximal points. If you walk through this logic - when you hit 10 points, you go up to the next grade, which has a minimum of 10 points and a maximum of 20 (thus, 10 points are 0%, 15 points are 50% and 20 points are 100%).
The exact mathematical approach depends on how you want to set it up exactly, but it shouldn't be too complicated (I'd probably multiply Grade by something to get the relevant numbers).

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

1 answer: sort voted first

the problem you have as mentioned by waxoff is that you are not setting the xp back to zero upon leveling. i would go with a four variable setup like you have but would structure it a bit differently, example below.

ok this may look a bit confusing but ill try to explain. first note i made this example modular so the levels will scale exponentially forever and is only limited by the level. so to start, on begin play i create the widget, add it to the viewport, then calculate the neededXp for the current level (you could just set the default value instead). then below that i have a custom event for adding score. the add score event first adds a point to the score variable via the increment int node (dark green ++), then add in however much xp you want ( again i used a increment to add 1), then we need to check to see if we leveled up via the is current xp => needed xp and a branch, if true we call the final custom event level up. the level up event increments the players level, then resets the current xp to 0, and calculates the needed xp for the new level. like i mentioned earlier i use a calculation for the xp so level 1 requires 10xp, lvl 2 20xp, lvl 3 40xp, etc.

course this is just an example and you may need to tweak it for your needs but it shows the basics of how you could get your system to work.

alt text

capture.png (310.2 kB)
more ▼

answered Nov 08 '18 at 02:39 AM

avatar image

ThompsonN13
9.4k 33 8 23

avatar image miaminl Nov 09 '18 at 05:38 PM

Thanks WaxOff for your help and of course thanks ThompsonN13... you saved me again the life. With your help i have realized this..alt text

It finally works!!!

soluzione.png (70.8 kB)
(comments are locked)
10|2000 characters needed characters left
Your answer
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