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. 

Accessing boolean from First Person Character to use in Widget Blueprint

In my game, I have the current ammo and total ammo on the screen (above the green bar.)

alt text

I want the current ammo in the mag to blink red when LowAmmo? is true (when the ammo in the current clip is less than or equal to 10.) In FirstPersonCharacter, LowAmmo? is set to true when this happens. I try to access the variable in WidgetBlueprint and call a branch that plays the animation when LowAmmo? is true.

alt text

The animation does work, I tested it out before setting up the branch and I'm not sure why this wouldn't work. I've asked for help from a number of people and they can't seem to do it either, maybe the images will help...

alt text

Please forgive my cropping skills, the tool is kind of weird...

Product Version: UE 4.16
Tags:
more ▼

asked Jul 08 '17 at 09:11 PM in Blueprint Scripting

avatar image

senrgames.dev
5 2 5

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

1 answer: sort voted first

Your Event Construct will only called once. It does not care if your ammo is low at a later point in time. Logic Error on your side ;P

more ▼

answered Jul 08 '17 at 09:57 PM

avatar image

Nachtmahr
6.9k 143 26 172

avatar image senrgames.dev Jul 08 '17 at 11:45 PM

Yeah, at first I tried using Event Tick but it doesn't let me. What should I use instead?

avatar image Nachtmahr Jul 09 '17 at 12:12 AM

There are many ways to solve your Problem thats why I did not get into any specifics. Also plese learn to describe your Problems more accourate "it doesn't let me" is not very Informative.

Create a Event Dispatcher call it "OnAmmoChanged" in your Character. Call that Dispatcher right after you Set Current Ammo. You can get rid off the low ammo bool and comparisons in your Character.

In your Widget you get your Character (drag wire) and Type Assign OnAmmoChanged. Now your Widget will Listen to the Dispatcher Event. From there on you can do whatever you like.

https://gyazo.com/2805f816260ba640bd14245e2e2163da

Also Watch that Video it makes your understanding of BP Communication easier.

https://www.youtube.com/watch?v=EM_HYqQdToE

(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