Let me explain my blueprint setup a bit first.
I have a character blueprint that contains all of my keyboard and mouse inputs, named Root_Playable. It also contains logic for handling many other aspects of gameplay such as health, stamina, dealing damage, etc.
I have a character blueprint class that is a child of my primary character blueprint. There will be several of these, one for each playable dinosaur in the game I’m creating. For now I have two, named Playable_Velociraptor and another named Playable_Utahraptor that inherit Root_Playable. Its purpose is to contain specific stats (health, damage, etc) and set the values of these stats on the construction script as well as contain the viewport for setting up the camera, capsule, mesh, and hitbox dimensions and locations. It also sets the anim instance blueprint to be the correct one such that I am sending events to the correct anim blueprint from Root_Playable.
I have placed several character actors into my map for testing purposes by dragging the specific dinosaur blueprints off my content browser and into my map.
An issue I am having is that whenever I wish to print out information from Root_Playble, it prints out the information for each character actor in my map that inherits from Root_Playable. For example, I’ve been working on setting up various resources such as health and stamina. I set a timer up so that I will heal every 5 seconds for a small amount, passively regenerating over time and I placed this in Root_Playable such that all dinosaurs that inherit from this blueprint will heal passively over time, specifying specifically how much as a set value in the construction script of the child blueprints, Playable_Velociraptor and Playable_Utahraptor.
I have that all working great.
Here is where I’m having an issue. When I tell my Root_Playable blueprint to print out my current health at the end of each health tick, every single instance of Root_Playable.Playable_Velociraptor or Root_Playable.Playable_Utahraptor will print its current health to the screen regardless of whether I am in possession of that character. Furthermore, I don’t wish to have all of these unpossessed characters constantly monitoring food and water values because they’ll eventually starve and die on their own so I wish to only execute portions of my Root_Playable blueprint when the player has possession.
Does anyone have any recommendations on how to better set this up so I don’t have these issues?
Is there a way to check or determine which character I am in possession of such that the others won’t keep printing to the screen? I’d ideally like some way to quickly check in Root_Playable if there is a player controlling it or if it is idle.
I don’t have anything set up in my Player Controller or Game Instance blueprints as I didn’t quite understand their purpose as of yet.
I also feel like later on I’m going to run into performance issues, as I had intention of creating further AI children Root_Playable.Playable_Velociraptor.AI_Velociraptor or something like that and I don’t really like each one constantly monitoring all of these values.
I’m a bit new to classes, object-oriented programming, and UE4 in general and want to set this up as neatly and cleanly as I can for later on, and would appreciate any advice or help with the print to screen and possession issues I’m having.