Problem with this is, Upon the AI spawning I want each room they are bound to, to be random.
This way every time you play the game there will be a different AI in each room.
For Example
10 Rooms
AI Spawns and is assigned to a room then that room is removed from the array
This happens 10 times until all rooms are occupied.
When the AI dies that room is added to the array for a new AI to spawn at a set interval.
that would work either I’m afraid, as the target points are outside the room so the room has to match up with the target point which is directly outside the door.
This would be simple if you could create a target point inside of the Room blueprint, that way you could just reference it like the room.
I am going to assume that your rooms are static, meaning they are already built and represented in the game world.
Plop a target actor in each room, each one gets a different Tag or name or however you want to identify it. As long as they are different from each other one.
Have something omnipresent, like the Level blueprint, catalog all of the target actors in an array. Make the array accessible outside of the blueprint (eyeball).
On constructed or begin play or whenever you want, in the AI, have it pull the array, get a random number between 0 and the length of the array, assign it that number.
Pull the array information from that indexed random number, get the location, spawn there. Target point assigned.
Either delete the target actor (sloppy method) or remove it from the index (cleaner method).
Loop back to 3 the required number of times.
Generally that would be the flow of logic for what you are looking for.
If you build rooms at random locations, you can still spawn target actors in the room. Just get the room location and spawn a target actor in the middle of it. Then flow from step 2.
It wont let me insert a target point inside the Rooms BP, the option is just non existent.
Your method wont work, as I want the AI to be bound to the rooms Box collision (which I have already done) and the target point to be an extra event that the AI will move to upon being called.
So the room itself needs to be randomised not the target points.
Your rooms are randomised but you can still include a child actor in the middle of each of the rooms and then do exactly how Yggdrasil is talking about.
If he’s using blueprints he doesn’t even need to use target points I was only suggesting that to make things easy.
He could just have a int variable inside each room blueprint and assign this randomly .
Then assign this room number randomly to each ai. For each room number have a transform location of the matching room number he wants the AI to move to.
Eg room 1 give it a roomNumber int variable with a default value of 1.
AI spawns , AI number 6 is randomly assigned the room number 1.