How should I approach this NPC path making with spline?

Hi, Im new to this community! Sorry for the ultra-specific question but Ive been racking my brain for quite some time on this and I have deadlines coming so any help would be much appreciated!

Im trying to do a path for an NPC with spline. The NPC in question patrols an apartment with 4 rooms and a hallway connecting them. I want the NPC to walk in all of the rooms and sometimes have a a chance of looping in the room it finds itself before continuing the patrol. Ive thought of 2 methods so far. 1st: each room having its own spline loop that intersect eachother at junction points (the NPC has a chance of switching spline paths). 2nd: one singular spline loop passing through all the rooms(when the owner arrives at lets say spline point 5, which is at the junction point between 2 rooms, it jumps to the closest point that doesnt pass in the next room effectively skipping it).

Hi @ChemicalAbusah

Your idea seems sound enough. Maybe you shoukd have a spline per room as you said, also a spline per each stage between rooms, that way as you get to the spline end it will give you a trigger point where you ask the question what next? Continue to next room or enter room, same inside the room ask the question what next , next room or patrol this one again. Have a variable to count the number of patrols around the same room so it doesnt get caught in an infinite loop (random generators arent exactly perfectly random)

But yeah seems pretty good , or other option you could have a nav mesh, have a list of locations the guard can go to, randomly set one do a move to command, then choose if enter room. That would make it even more “random” than always having the same loop, but thats your choice how you want to play it