Check If AI Path Is Blocked on Grid Placement System
Looking for assistance on scripting a tower grid placement system for a defense type game.. What functionality I am struggling to create is a blocking system that knows an AI character could make it to the destination point. I do not want to allow the player to place a unit on the grid that would block the AI from making it to the end. I am using a standard navmesh for the AI, no EQS. This is a Mobile project as well.
How can I create a placement script that knows a path would be blocked? (the yellow area should be "off limits" but currently it's possible to place a unit). I need this to work at any point in the grid.
Any advice, tips, tricks, help is appreciated!
EDIT: Using the advice of @mighty, I use the path tester pawn to spawn in, check the path, then return if the path is partial or not. From that I can branch whether placement of a unit is valid or not. But I have an issue:
If you're using NavMesh, you could use an EQS Pawn that has the same AI Controller to query the navigability, but first you block him with an Actor class that only blocks EQS Pawns and not the real enemies, as you hover over the spot. You can have your cursor be that Actor class maybe, or have that Actor class always teleport to where the cursor is sitting.
Then before placing the obstacle, you can have it check with the EQS Pawn that starts on the enemies' end of the playfield, whether it is blocked from getting to the player's base. If it is, then it does not allow the placement of the obstacle.
I don't know if this will work because I have only watched a tutorial about EQS but never tried using it myself. Seems like it should work though. Let me know how it goes.
answered Oct 19 '18 at 09:32 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here