Base Weapon Structure
I'm new to blueprints, and coding in general but I feel like I'm finally making progress. I've searched the forums but I can't find anything specifically answering my problem. I'm having some trouble with inheritance and setting up my weapon blueprint. What I want to do is have a base weapon class that can then have different types of weapons, rifles, knives, etc. Inside the base rifle class I would have an array of rifles. The problem is the only way I know how to call an event from a child object is through casting. I want the base weapon blueprint to not care what child it has, but still be able to fire, and have the child decide the behavior. I thought about using enums like what's in the picture, but I don't know how to accomplish something like that. I'm open to suggestions. The top part of the picture is the player event graph, the bottom is the base weapon.
Question: The idea is the base weapon should be able to fire, then the children of base weapon set the behavior. What method of communication through blueprints should I use to accomplish this.
asked Dec 02 '15 at 02:52 PM in Blueprint Scripting
You can define your custom events in the parent class, then override them (fill them with content) in the child classes. Basically, InputActionFire calls FireWeapon for all weapons, but the event will do different things for Rifles and Knives.
answered Dec 03 '15 at 10:05 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here