I’m sorry if this has been asked before, I can’t seem to find anything about it. All the examples I see for creating an enemy blueprint involve a single model/mesh. Is there a way using Blueprint to create an enemy class that has a collection of different enemies?
For example, imagine a navy. It has all kinds of different ships. Can I have a single Blueprint class called EnemyNavyShips that contains every kind of enemy ship that I can choose directly to spawn or that I can have any type randomly spawn?
Hey there @Krotus! Are you describing a myriad of ships that move as a unit like soldier groups in Company of Heroes? Or were you trying to have them all act separately? Because you can have an enemy manager BP that handles the entire group, for some games it isn’t the best way to handle them unless you’re working from more of a data oriented approach.
@Krotus I believe you’re looking for inheritance which blueprints support well enough, and some form of a manager class:
You create a base class ship with functionality and variables that all ships share:
they float and can be ordered to do generic ship stuff
have a mesh
can be damaged and repaired
house crew
Your then derive child classed to make specialised ships:
tugs move other ships
aircraft carriers carry aircrafts
submarines are sneaky
This makes communicating with multiple classes more convenient.
Can I have a single Blueprint class called EnemyNavyShips that contains every kind of enemy ship that I can choose directly to spawn or that I can have any type randomly spawn?
People normally create a manager actor for something like this. The various classes can be stored in an array. You could display its content for the player via UI elements and let the ShipManager spawn a ship actor from the selected class. You can make it random or even include some logic that decides what to spawn and where.