Making FNAF AI system

I tried to make FNAF AI system, like choosing a room for an enemy to go from first room, but there are more than one room to choose, so i dont know how to randomly choose a variable to change, cuz when a variable of a room is 0, there is no enemy, but if it is 1, enemy is there

Welcome. I’m guessing you’re talking about Five Nights at Freddy I’m only vaguely aware of the game.

Are you picking a number or an object? An object would be easy, you can use the pick a random object if you only want certain objects then you could use an object variable condition and check for the variable value first and only pick from the ones that are either true or false.


If the numbers were in an array, then you could pick a random number based on the number of children and use the value in that child. If it’s an array or structure of Boolean values then you could create a separate array with just the ones that you want to choose from based on their Boolean value and pick from that array.

If you’re not using objects then I or someone else can add more details if needed.

Have you watched any youtube videos on breaking down the logic of FNAF’s AI? It can be helpful to understand the basic principals. Years ago I watched videos on how procedural generation works in Minecraft and it helped me understand and follow the tutorial in GDevelops documentation. With a little more research I was then able to use my knowledge of the basic principles to generate 1D terrain (like a sidescroller) and even 3D terrain.