The FPS Tower Defense Toolkit lets players construct mazes using Tower Bases to control the paths of AI bots. The same Tower Bases also act as platforms for placement of Towers, which help prevent the AI bots from reaching the Power Core. However, since most Tower Defense games allow players to directly place towers on the ground instead of a separate platform like Tower Bases, I've received a few queries about how to implement the aforementioned design using this toolkit. This tutorial will provide you with the steps involved in achieving the same.
DT_TowerData:
1. Delete the data table row corresponding to the Tower Base.
2. Since we're not going to use Tower Bases as platforms for the Towers, it would make sense to spawn the Towers closer to the surface. And this is controlled by the parameter OffsetFromGridCell, which as the name suggests determines the offset of the towers relative to its grid cell location. So let's go ahead and give it a value closer to 0.0 for all Towers listed in the data table.
BP_AttackTowerParent:
1. Add a Box collision component to this blueprint. Without the Tower Bases, the Towers themselves will have to control enemy navigation. This collision component will act as a "Nav Modifier Volume" that can block AI paths, thus forcing them along alternate routes.
To finish the set up, just go ahead and update the parameters of this component to match the information specified in the following screenshot.
BP_TowerManager:
1. Open up the InitializeTowerManager function and remove the "Insert" node shown below:
This will prevent Tower Bases from being automatically added to the player's Tower Loadout at the start of a mission.
2. Next head over to the BuildTowerFunction. Here we need to ensure that the nav paths are rebuilt every time a tower is
placed in the level. And this can be done by setting the Rebuild Nav Mesh? parameter of the Call Tower Spawned node to True.
3.
Similarly, we have to update the nav paths every time a Tower gets destroyed. To accomplish that, let's go to the RecycleTower function and set the Rebuild Nav Mesh? parameter of the Call Tower Destroyed node to True as well.
4. Finally within the same function, we have to make sure that the status of the associated grid cell gets reverted back to Empty (instead of Tower Base) when a Tower is destroyed. To do this, set the Grid Cell Status value of the following Update Grid Data node to Empty.
BPC_HolographicTowerDisplay:
1. Make the following node connections inside the UpdateHoloTowerDisplay function:
1. Make the following node connections inside the UpdateHoloTowerDisplay function:
This will enable holographic display for all towers when you point at an empty grid cell.
2. As a final step, we have to make sure that the Holographic Tower display system takes into the account the effect our Towers now have on the navigation mesh. To do that, just make the following changes in the SetHoloTowerConstructorModel and DisplayHoloTowerConstructor functions:
Alright, so now you should be able to use Towers without the need for Tower Bases in your projects. Just make sure to remove references to the Tower Bases & associated enums/blueprints/UI if they're not required. And finally here are couple of sample screenshots of the final result:
Comments
Post a Comment