Referencing Blueprints in C++


Author: Matthew Pacheco

As I worked on implementing two more turrets and a barricade, I began running into issues that couldn't be easily solved due to variables and functions being strictly in blueprint. One of the main issues I had to work around was being able to tell if the enemies were dead or alive for turrets to switch targets. I originally planned to use an IsValid() check, but since the enemy bodies stay behind, they do not become invalid. They did turn on a bool in blueprint that says they're dead, but since it wasn't tied into a C++ class that I could reference in my class with a case, I was unable to check it without making blueprints myself.  This was basically the same issue with health components, as it was made in Blueprint as well and attached to the turret blueprints.  

My fix for these issues was to create blueprints in Native events and implement whatever I needed in Blueprint. This required a lot more time than normal, but it worked as expected. Since I would like to keep my work in C++, I replaced this with less effective workarounds in C++. It did act as a proof of concept for when I am able to access these values in the base classes. As some of the defenses might apply effects, the issues will only become harder to work around, the longer term solution will be to work on migrating everything to C++ or at least creating a placeholder so I can properly shape my code around it. Then it can be ironed out once the C++ classes are fully implemented.

Posted on 11/03/2023

Get Cyber Siege

Leave a comment

Log in with itch.io to leave a comment.