AI daily routine

Hi!
I’m new in Unreal Engine and also I’m not a perfect english speaker, excuse me about that.

I’m looking for a way to make an AI character who makes different tasks during the day, for example a postman that wakes up at 6am, goes from mailbox to mailbox in a small village and finishes his work at 12pm, and then returns to his house.

I think that I can achieve this through blueprints like “simple move to location”, delays, targets, animations… (or using behavior trees), but my problem is that I want to use the “Now” node (or anything that would do the same) to adjust the gameplay time to the real time, so I need something that “check” the OS time and locate the character in the correct way of that routine (for example, if I connect at 11am I want to see that character walking from the last mailbox to his house or if I connect at 6:01 he’s leaving his house to do his job)

I know that this is maybe a higher level but I just want to know if there is a tutorial or something related to this anywhere from what I could get guided.

Also, and if it’s possible, I would love to do this by using blueprints.

Thank you very much!.

I haven’t used any commands to get the OS time but you can always make an in-game clock(quite easy to make can take 5 minutes or less) I can help with that if needed.

And I guess every 30 minutes you can do a check on all AI to see if they have a job scheduled.
So for example at 6:00 do “get all actors of class” - “Postman”.
This will get all the actors of type postman.
You can then run function in them - this function could be what makes them go out to work - or it might just be a variable that is picked up from the AI behaviour tree blackboard.

Thank you Newest for answering me!

The node “now” is like a clock, it checks the OS time and you can take the variable minutes (or hours or seconds…) from it and check if the AI is doing it’s job (I didn’t know about the “get all actors from class” and it will be very useful for me!!). But my real problem is the location of that AI, not the task.

I mean that if I locate the character in the world and it starts making a task because of the time (for example going to the next mailbox if it’s 10:00am), if I disconnect and reconnect 20 minutes later it will respawn at the same point! I want to reconnect and see it reaching that mailbox.

Sry if I’m not explaining it well.

Alright bassed on that, from what I understand, your issue is that if you disconnect, and then rejoin everything is exactly how it was beforehand?

If so then that is probably something where you need to keep the server running - and telling the AI where to go/when and so on.
And the player just joins the server.

If this game is supposed to be just singleplayer then when the player joines you might need to do some sort of similar thing with the get all actors of class and then calculate where each actor SHOULD be by that time of day.
Since its singleplayer if they close the game its not going to keep processing where the AI should go, so thats probably the best choice.

Maybe do something along the lines of see what the times is, then get the Before and Next jobs.

Such as : its 12:20, at 12PM the AI was supposed to leave the post office, by 12:30 it should be at co-ordinates … which is a house.

Then I guess you would need to just place it roughly 2/3 along the path between those points.

But in general this is something that would work a bit more accurately if there was a 24/7 server that just keeps processing everything even if the players turn off their PC or disconnect the game.

That’s exactly what I meant, you understood perfectly what I want to do!

So would it be possible to manage a phisical line (the path that the AI will take) with blueprints so I could make a “time division” to locate the character spawn in the correct point?

Well, at least you gave me some information from where start searching, thank you very much!

Its probably possible, but in general you want most your AI task to be done with the behavour trees, with just BP support where needed. I have never setup anything like it so can’t really say how at this point.