Being a template for Tower Defense games, the default behavior of the enemy AI bots is to destroy the Power Core as long as they don’t get interrupted by external factors like for example, the player character. However, you could replace the logic in the ‘MoveToCore’ function (within BP_EnemyAI_Parent class) to have the bot move to random locations in navigable space, instead of towards the Power Core itself.
The ‘MoveToCore’ function gets called only under three circumstances:
- At the Event Begin Play, when an enemy AI unit is spawned.
- The Power Core has come into the vision range, & has been set as the active target.
- The AI has lost track of its active target (usually the player character) & hence decided to return to focus on the default objective.
If you’re not using the Power Core in your simulation, then you probably won’t have to deal with the second case. So essentially it will boil down to the bot heading off to check out random locations whenever it doesn’t have an active target.
By nav paths, are you referring to the blue line that goes from the enemy spawn points to the Power Core? If so, it is generated automatically based on the underlying navmesh. It’s basically a spline component attached to the ‘BP_EnemySpawnPoint’ actors. The ‘CreateNavPath’ event handles the creation of spline meshes to lay down a visible path towards the Core.
As for Laser projectiles, there are a few steps involved (Thanks for pointing it out, I will add this to the tutorial section):
- First, add a new entry to the enum ‘EProjectileType’ for your Laser projectile.
- Now, create a new child class based on the ‘BP_Projectile_Base’ blueprint, set it’s ‘ProjectileMesh’ to a cylindrical static mesh, & use a red emissive material on the mesh. Change it’s ‘ProjectileType’ enum variable to the new value created in the previous step.
- Open up the ‘CreateProjectileOfType’ function within ‘BP_ProjectileManager’, & add a new function to spawn the Laser Projectiles based on the enum switch case. You can check out the existing ‘CreateSeekerProjectile’ function for reference.
- Finally, set the ‘FireProjectileType’ variable of ‘BP_EnemyAI_Ranged’ to the new Laser value.
With that, you should have your own custom projectile type. Let me know if you have further queries regarding any of the solutions.