I have a system set up so I can equip different child bps onto my main player. I’m having an issue with one of them as I want the child actor to fire projectiles when space is pressed however it doesn’t do anything.
Here’s the code on the child BP, but it doesn’t run when I hit space bar on the player with the child actor attached
Is the input enabled in this actor - it is disabled is by default, and for a good reason. In a more traditional input setup, you’d have the player process a key press and tell the CAC’s actor to do the thing.
Would that work for you? Keep the input in as few places as possible.
Oh so I could do a check to see if the Child actor is on the player and then tell it to do that line of code in the player bp while casting to the child actor?
Yeah, the basic premise is, I have a ship, you can attach a ram, sail and canon onto it. The ram and sail increase stats passively so they’re easy to set up but where I’m adding the canons and want them to receive an input it’s not doing it.,
I would personally recommend to store inputs at some single class. In this class you can create Event Dispatchers for all inputs which you bind to call at player Input outputs. In your case then when you spawn a Child actor, this child actor can bind its events to this class Event Dispatchers without requiring any input on self.
Hmm, I think I’ve set it up like that but it’s not working, I’m not sure if I’ve missed anything, I’m really new to Event Dispatchers. I really appreciate the help.
But then ALL space events will fire. It could work in some scenarios but will create a little debugging nightmare if things go wrong, as they often do.
Hmm, I think I’ve set it up like that but it’s not working, I’m not sure if I’ve missed anything, I’m really new to Event Dispatchers. I really appreciate the help.
Looks OK at a glance providing it’s the possessed player. Silly question, you said Ship but this is a Character class. Is this intentional?
Yeah it is printing that. Not intentional I guess, it’s the only thing you’ll be controlling in the game so I just thought I’d make it a player. The thing is, I have the code set up to fire the basic set of canons that are default on the ship. So space does work like that.
A character is great if you have arms, legs and bi-pedal movement. A human form.
Does this Begin Play trigger:
Perhaps it’s important for us to know how the new cannons are added? Do you Set Class on CAC or use some other way?
Btw, there’s also a way to get what you need without using CACs which are, generally, horrible to work with. Not sure how far you’ve got with the progress.
Yeah that’s a good shout honestly, I can’t get rid of the default capsule anyway so it’s an odd shaped collision for the boat.
I have a few child actors added to the blueprint itself named various thing “Sails, Ram or Canons” then on a UI piece, when a button is pressed it will set that child actor to use the corresponding BP