I have a blueprint with a variable named enemyHealth. It is a float set default to 100. I’ve created a widget with a progress bar. When I hit the enemy with a cannonball, the variable should decrease with 25 and the widget should update. But…when I try to get the enemyHealth to update the widget I can’t get to the variable. I’m pretty new to blueprints and unreal in general so I probably go about it the wrong way. But I tried it with cast to…but what do I put in the object pin? Whenever I cast to the player I put in “get player pawn”, except this is the enemy and not the pawn. What “object” is required?
I just don’t seem to grasp what needs to be done. As said before I’m pretty new to unreal, so sorry for the dumb questions.
So I have the 2 actor blueprints. Cannonball, where I want to decrement the health float variable. This variable named enemy health is inside of the Enemy blueprint. It needs to decrement by 25 every time the cannonball overlaps the enemy. But when this enemy blueprint variable is updated, it should also update the wbp. The first two I can manage. I can update the variable. But I cannot seem to get the update variable to the WBP. Every time I want reference it I get the error. I just don’t know what to put in the event graph and GetPercent function of the widget blueprint for it to work.
Thanks again for the help, i think i need to watch some more tutorials and try again…i did try to get it to work with blueprint interfaces but the custom event from the interface is not availabe in the widget blueprint. So no luck there either.
I think I made a mistake with the way I set up the collisions and overlap detection. I’m going to rearrange this and try your answers. I’ll keep you posted…
I’ve got it to work. I’ve watched another tutorial which confirmed my lack of understanding (as a beginner) and tried the new method. I didn’t even have to add the widget blueprint because it was already in the enemy blueprint.