Where to modify Brewery in StrategyGame example?

For the StrategyGame example in UE4, how do I modify the Brewery building? Should I edit the C++ code directly since there is no blueprint for it?

Also, in general, how do I know which C++ classes in an example I can modify and which are autogenerated by blueprints that I should not modify directly?

Thanks in advance.

Hi ,

How are you wanting to modify the Brewery building? There is actually a Blueprint for the building. You can find it in the Content Browser at Game/Buildings/Brewery. There isn’t any functionality in that Blueprint, though. All of its functionality is in the class the Blueprint is derived from: StrategyBuilding_Brewery

Thanks for the pointer.

I would like to know how to spawn and create additional units (e.g., an ogre). From looking at the code, it looks like I should modify AStrategyBuilding_Brewery::ShowActionMenu() by adding a line like

CenterAction->Data.TriggerDelegate.BindUObject(this, &AStrategyBuilding_Brewery::SpawnOgre);

and then create a SpawnOgre function. But how do I control how the newly spawned Ogre works? I don’t see how the dwarf model or properties of the dwarf or other things are associated with SpawnDwarf function. It calls RequestSpawn but that doesn’t seem to do much.

Also, how do I associate an icon with the SpawnOgre function?

Thanks in advance for your help and sorry for being such a newbie. If you have general tips on how to get up and running to create a real-time strategy game or tower defense game that would be much appreciated too.

Thanks,
-X

The enemy units are spawned in the level blueprint via some macros (SpawnHeavyMacro, SpawnNormalMacro etc).
This sets the weapon and armor class as well as setting some other modifiers. (This is done via nodes that call SetDefaultWeaponClass, SetDefaultArmourClass and SetBuffModifier for the AI brewery so that when any further units are spawned they are given the adjusted attributes.
The player units are done in a similar manner. The player brewery spawns units if there are any to spawn. If you upgrade the brewery using the menus when the brewery upgrade completes a OnConstructedEvent is triggered - this is also handled in a blueprint and sets a modifier on the players brewery so that all newly spawned units will have the upgraded attributes.
When you click on the ‘build unit’ icon it simply tells the player brewery there is one more unit to spawn and the spawned unit is created with whatever the current attributes are set on his brewery.

If you wanted to be able to spawn different units via different menu icons you are going to need to make several changes to how the brewery spawn code works to provide a means to pass attributes per unit rather a persistent modifier for spawned units.