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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Bind variable from another actor to PROGRESS BAR?

All i'd like to know is how to bind a float value from ANOTHER Actor, TO MY PROGRESS BAR. any help will be highly appreciated.

i tried doing this but it didn't work. alt text

Product Version: Not Selected
Tags:
progress_bar2.jpg (255.3 kB)
more ▼

asked Sep 10 '14 at 08:30 AM in Blueprint Scripting

avatar image

gotgrassct
222 47 62 78

avatar image wmbuRn Sep 10 '14 at 10:15 AM

Can you be more specific ? What do you mean by "bind float" ?

Function you did just get damage from Zombie class and return it.

avatar image gotgrassct Sep 10 '14 at 10:21 AM

I have a zombie blueprint. That zombie blueprint has a float variable. When i hit the zombie, it decreses the float all the way down to 0. Now in the widget blueprint that contains the progress bar i wanna use, i create a binding for the progress bar so i can add a value to it. i would like to access that variable from my zombie blueprint and assign it to be the value of my progress bar. That way, when i hit the zombie, the bar will decrese and act like an Enemy Health Bar..

All i wanna know is how to access that variable in my zombie blueprint and assign it to my progress bar value.

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

1 answer: sort voted first

Your enemy health bar needs to be passed an instance of the zombie, either through a method, or by just assigning it to a member variable on the widget blueprint. Now, you have a member on the widget you can inspect to see what the zombies health is.

It looks like you're close from your screenshot, all you need to do have someone be responsible for assigning the instance of the zombie to the Blueprint member, like maybe the player controller could notify the UI when his active target changes.

Cheers, Nick

more ▼

answered Sep 10 '14 at 01:10 PM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 37 151

avatar image gotgrassct Sep 10 '14 at 09:54 PM

How do i create a member variable on my widget blueprint?

avatar image gotgrassct Sep 10 '14 at 10:10 PM

and can you give me an exact idea on how to add an instance of the zombie to my blueprint? because from what i know, i can only add instances of things that are in the level because you have to select them in order to add the instance. So i'm pretty confused when it comes to widget blueprints..

I Can cast to my player character and was able to get the float from him and make the progress bar work. My zombie blueprint is of character class, and when i use "Get Player Character" and get the variable from HIM it don't work.. but like you said, there are many ways to go about this. i just don't know how lol How do i add the instance to the variable that i made?

avatar image Nick Darnell ♦♦ STAFF Sep 11 '14 at 01:35 AM

You add member variables just like you do to any other blueprint, the big [+ Variable] button on the left in the graph view.

What is your plan for identifying which zombie to show the hp bar for? You can either scan the world for the current zombie, or pass the player controller to the UI and have them do it, then just have the UI sniff the zombie target of the player controller. Someone has to be scanning the level for active zombie actors. You could do ray casts to get the zombie under the cursor, or do it based on last zombie damaged with events, stuff like that.

avatar image gotgrassct Sep 11 '14 at 01:53 AM

My current system is just to test if the health bar actually works. I send a raycast everytime i left click on the zombie alt text

and everytime i hit the zombie, i add the widget to viewport with a "DoOnce" and it decreses the float variable by 0.10 untill it reach 0 wich than destroys actor (Or when i actually add a rigged character, he'll ragdoll) removes widget from viewport and resets the "DoOnce" back to the starting so it can be used again. alt text

progress_bar4.jpg (301.3 kB)
progress_bar3.jpg (239.5 kB)
avatar image gotgrassct Sep 11 '14 at 01:58 AM

And it's actually just me, i don't have a team lol so i would have to set up everything, but i'm fine with that.

And what IS a member variable? What would i do to make a variable a "Member" variable. I Can't find a member variable in the variables list.

avatar image gotgrassct Sep 11 '14 at 02:58 AM

Is this how i create a member variable? how do i make an instance to the zombie?

alt text

widgetblueprint.png (228.7 kB)
avatar image gotgrassct Sep 11 '14 at 05:32 AM

Hey, i got it to work! I Did like you said and have the player pick the target for the zombie and everything works fine! but now i have another problem.. it only works for THAT zombie that i pick as the target. how do i make it so that the progress bar works with all zombies of that zombie class so that every zombie i attack will affect the progress bar or something

avatar image Nick Darnell ♦♦ STAFF Sep 11 '14 at 12:00 PM

Great! You want the progress bar to sum all their healths, and then divide by the sum of all their max healths? Just call, i think the node is Get All Actors of Class? something like that, then access the respective bits of data, add it together and then divide. If instead you want a single target progress bar, but that works with all zombies, just have the player controller change the zombie variable each time you attack a zombie so that it shows the health of the last zombie attacked.

avatar image gotgrassct Sep 11 '14 at 09:30 PM

Get all actors of class is array based. i don't know exactly how to use that. Any way you can give me an example or a better explanation? cause i'm kinda confused haha

avatar image RAVaught Jul 20 '15 at 09:25 PM

What I would do, in your position, is to set an array of type ZombieClass in your level BP. When your Zombies are created or destroyed, add/remove them from the array. In your UI, get a reference to the array in your UI BP, then do a for each loop to get all their HP values.

Alternatively, if this is something that will be happening across multiple levels, you could put the array in the Game Instance BP. Up to you.

(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