Hello All. Implementing Team Bots/NPC in FPS. It’s desired that Bot/NPC Players can register in the Lobby, join any Team, and Score in all game modes, just like Human Players. Recently discovered that C++ modifications are required to enable PlayerStates for Bots/NPCs. Seeking any Blueprints based workarounds/alternative without C++ modifications.
The Controller Class provides a PlayerState Reference, but this is only available for Players, not NPCs. Additionally, I’m unable to construct any derivative of PlayerState and assign to PlayerState Reference.
So, my current plan is to create my own BP Class call NPCState and duplicate many vars and functions of the APlayerState Class and store an Array of NPCStates in the GameState. This approach requires me to duplicate many of the GameMode Match Functions that take a Playerstate argument or reference.
This is already turning into a pain-in-the-****, and there is no guarantees this approach will work at this point. I’m open to any suggestions for a BP workaround. If all fails, I’m willing to use a C++ Plugin to enable aicontroller playerstate:
My current plan for a Blueprints workaround for Team Bot Playerstate is to spawn a NPCState (playerstate child actor of PlayerState) on the server-side storing into a PlayerState Reference (NPCState), and in an Array on the GameState called NPCArray (similar to PlayerArray). Any Opinions?
Not sure if this is what you want but i’d do it this way:
add an int onto the bot and have every int stand for a different state. This var should auto update based on the game setting in the loby
have an empty actor blueprint whom’s only role is to check that int. Based on that, this second blueprint will act as a translater.
make your NPCStatecontroller as you were planning (but i recommend customizing them based on what each mode is doing to keep yourself from messy-ing up things)
4.that second actor will now check the bot and spawn and link the controller. (remember to have it delete and replace the controller every time you change game modes)
Edit: i’d also make this second blueprint make ref arrays for the bots and the controllers (if you want more than 1 bot in game that is)
Hello @TheNomadNamedY and thank you for your recommendation. I have several functions that setup Lobby and Team Matches for Players referencing information in the PlayerState. We desire to use the same functions to manage bots using playerstate as well. This will eliminate the need for additional scripting and allows management of bot’s scoreboards etc in the same fashion as players. The only difference between Players and Bots from a game mode perspective is who is controlling them.
I elected to compile and use a AIPlayerState Plugin which greatly simplified Bot integration with Generic Shooter Tournament Bots and nullified this thread. Note: I created the AIPlayerState C++ Plugin Icon within UnrealEditor using only primitives and PBR Mats (Zoom In); Inspired by this + this.