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 not changing?

Having an issue where I've linked my progress bar to a float value (health): alt text

but there is no visual change in the progress bar it's always shown as empty in the game: alt text

the value of the health is set to 100, and this method has worked inside previous projects. Anyone know what would cause it to not be going, though? or if there is a way to check that the progress bar is receiving the correct value?

thanks, Percy

Product Version: UE 4.13
Tags:
screenshot (4).png (212.5 kB)
screenshot (3).png (965.4 kB)
more ▼

asked Sep 06 '16 at 10:24 PM in Blueprint Scripting

avatar image

MadkingPercy
18 3 6 9

avatar image mcmatze Sep 06 '16 at 11:42 PM

Did you checked that the cast to Cube is not failing? Is the return node getting called and what does it give you back when you set a breakpoint?

avatar image MadkingPercy Sep 07 '16 at 12:02 AM

Thanks for pointing out breakpoints tt me didn't know about them until now. I'm getting a lot of "variable not in scope" I'm not sure if that means anything you might need to break this down for me a bit.

avatar image MadkingPercy Sep 07 '16 at 12:36 AM

Update: looking into it some more, Yes your right it's not casting to cube! where do I go from here ?

thanks -P

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

2 answers: sort voted first

Just to give you a correct answer (you already found out in the comments): you are trying to cast a PlayerController to Cube that inherits from Character or Pawn. They are incompatible, so the cast is always failing.

If Cube would be inheriting from PlayerController instead and defining a variable Health, then this would be fine. But this is not the case and you should not change it to that.

The solution would be that you retrieve the pawn the PlayerController is controlling. You can do that with the GetControlledPawn function. After that you can cast it to Cube and do stuff.

Alternative: you are using GetPlayerCharacter. This retrieves the Character directly.

Here an example blueprint:

Solution

ue.png (205.4 kB)
more ▼

answered Sep 07 '16 at 02:04 PM

avatar image

mcmatze
82 13 14 17

avatar image MadkingPercy Sep 07 '16 at 04:04 PM

Thank you for explaining! this helped a lot

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

you can right click on the cast node and convert it to pure to avoid this problem

more ▼

answered Sep 07 '16 at 08:42 AM

avatar image

saeedc
2.4k 72 41 105

avatar image MadkingPercy Sep 07 '16 at 10:30 AM

Thanks, gave that a go but getting the same issue though, it looks like this? alt text

screenshot (7).png (235.8 kB)
avatar image saeedc Sep 07 '16 at 12:14 PM

mannnn ..... you are casting player controller to cube.

if your pawn is a cube, then you must cast the player pawn to cube

avatar image saeedc Sep 07 '16 at 12:15 PM

get player pawn. then cast to cube

avatar image MadkingPercy Sep 07 '16 at 01:15 PM

that's done it thank you so much! Can you explain why that's the case because in a previous project it was fine with player controller ?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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