I think my question is “How can I set a variable in the character BP with an input given to an actor with its own class BP?”
I have created a blueprint class for a ‘FreshBattery’ actor.
I want the player character in game to be able to walk up to a battery and ‘pick it up’ with input from the “Item” key I have assigned.
When the battery is ‘picked up’ I want 2 things to happen:
- set a ‘battery power’ float variable attached to the player character to 100%
- destroy the flashlight battery actor
So far, I have been able to get both of these objectives to work, but only one at a time (whichever BP wired to the input action first).
My coding to set the ‘battery power’ float is part of the Character BP. A boolean is set when the character enters and exits the trigger area. When the input key is pressed, a branch checks the boolean to see if the character is in the trigger area. If true, the ‘battery power’ float variable is set.
pic of BP: http://i.imgur.com/qBtPOwY.png
The ‘destroy actor’ command is part of the class BP. Here, begin and end collisions cast to the player character and enable/disable input. When input is enabled, the ‘destroy actor’ function can be called by the input key.
pic of BP: http://i.imgur.com/zlijqjV.png
Like I said, I have gotten these to work seperately, but not together. I believe the problem is that the Input Action I am using to destroy the battery actor is also trying set the ‘battery power’ variable at the same time. And because the ‘Destroy Actor’ event is inside a class BP and the ‘set battery power’ event is inside the Character BP, I cannot wire them in sequence.