Tower Defense Starter Kit Tutorial: How to create custom Towers
The Tower Defense Starter Kit comes equipped with seven types of Tower classes that all derive from the parent blueprint ‘BP_Tower_Parent’. As the name suggests, this tutorial goes over the process of adding your own new customized Towers into the mix.
- First we’re going to have to create a new Tower class. To keep things simple, I’m just going to duplicate one of the existing Tower classes named ‘BP_ShockwaveTower’ & name it ‘BP_CustomShockwaveTower’.
If you want to create a tower from scratch, you can do so by creating a child class derived from the ‘BP_Tower_Parent’ class. The only extra step involved is the setting of static mesh/materials for the ‘Tower’ static mesh component as shown below:
-
Now we need to make an entry for the same in the ‘ETowerType’ enumeration. I’m just going to name it Custom Shockwave.
-
The next step in the process is to provide the default stats for our new Tower. Since the toolkit uses a data driven approach to Tower creation, all default user defined attributes for the Towers are specified within the Tower Data Array (in BP_GameInstance class). Again I’m going to duplicate the array element for Shockwave Tower, & change it’s ‘SpawnClass’ & ‘TowerType’ attributes to ‘BP_CustomShockwaveTower’ & ‘Custom Shockwave’ respectively.
The remaining attributes can all be changed based on the specific requirements for the tower & tooltips have been provided to specify the modifications that each attribute brings to the table. Here is a sample screenshot for the custom Shockwave Tower:
- Now that the default attributes are set up, we need to register the new Tower for Tower Functions which includes Upgrades, Abilities, etc. The ‘Tower Functions Array’ in the’BP_GameInstance’ class determines the functions that are available to the different towers.
To avail all the functions for our new Tower, we just add the associated enum value to the ‘Compatible Towers’ list for each function as shown below:
- All that’s left now is to make the necessary node connections that rely on the ETowerType enum. I’ve marked all of them in the screenshots below. Just connect the output nodes from the Custom Shockwave switch case to the designated input nodes as shown in the screenshots & the new tower should be good to go.
‘Widget_TargetInformation’:
‘Widget_TowerSelectionButton’:
‘Widget_LoadoutMenu’:
With that, we have covered the basic steps involved in creating a basic Tower class.