Living Town: Arglebar’s Routine Part I

in Tutorials


Aaaaand we’re back. The GameDevFort launch unfortuantely made me late, but this time, instead of being months, it was just a day late! I’m improving!

Anyway. last time I just got used to the scripts I will be using, but this time, I’m going to build Arglebar’s routine, as I defined it in the planning article.

  • 6am: Wake up and fix and eat a breakfast
  • 7am: Go to the field and work
  • 12pm: Sit on his stool near his campfire and eat a light lunch
  • 12:30pm: Go to the field and work
  • 7pm: Come home, fix and eat a dinner
  • 8pm: Sit in front of fireplace and rest
  • 10pm: Go to bed

As the clock starts at midnight, we’ll need to start him in his bed.

Just a quick copy paste. Make sure you set the top part of the bed to passable!

Just a quick copy paste. Make sure you set the top part of the bed to passable!

My next step is figuring out how to reference the time. I go into the script and realize that I will need to change one additional thing. I need access to the MINUTE variable as well, so I add that in to the group of variables the time system dumps to on line 210.



We’ll also need one more variable, a variable to tell Arglebar what he needs to do next. we’ll make that Variable 5. Always, Always, Always remember to name your variables!



With his routine, he has actually 12 steps. 6 for each location he is at, and another 6 for moving to those locations. You might think 7, but he does the same thing twice in his routine, head to the field and work. So his variable will work like this:

  • 0 = In Bed
  • 1 = Go fix breakfast
  • 2 = Eat breakfast
  • 3 = Go to the Field
  • 4 = Work in the Field
  • 5 = Go to stool
  • 6 = Eat Lunch
  • 7 = Go Home
  • 8 = Eat Dinner
  • 9 = Go to fireplace
  • 10 = Rest in front of fire
  • 11 = Go to Bed

Now, each time we move him in and out of the house, we will have to pathfind him to the entrance/exit, transfer him to another part of the map, then pathfind him to where he is going in the new area. This leads to a problem when we look at it as dynamic, for instance in the “Go To Field” he can start in either his house or at the fire. That means we need to know whether he is inside or outside during this step.

And that is where the almighty RegionIDs come in. Just paint the outside all as one RegionID, and the inside part as all another! Then name the three variables after his Routine variable as Arglebar’s RegionID, Arglebar’s X, and Arglebar’s Y.


RegionID really needs to be able to use the fill tool… Also, I missed a spot… Luckily I don’t think he will be standing on hte bookshelf.

Now that we have that in place, let’s build all the different steps in his event. Because we are using a variable to determine the steps, each level will be mutually exclusive, your would think we won’t have to worry about the order of the pages. But because it always checks if it is x or HIGHER, you need to make sure that you order them so that the variable condition ascends as it goes right.

He is going to just ignore the player when moving, and just say what he is doing when he is at each location. This is easier than writing actual dialogue… and hey, this is just a prototype anyway.

On each of the steps where he is just doing something (all the even variables), just add a show text command that says what he is doing.

He sleeps aggressively.

He sleeps aggressively.

On the odd variable conditions, where Arglebar is moving, we need to switch him to UNDER the players (so that players can’t block his movement), and switch it to a parallel process, and have the contents be a pathfinding call to put him where he is. If you would need him to go inside or outside, first put move him to the entrance/exit, then transfer, then pathfind again to get to the final spot. At the end of the movement, change the variable to the next variable in sequence. This will cover every condition EXCEPT variable condition 3, which has two starting points.


For the going to the field one, we need to drop his X and Y into variables, then use that to get the location info for the Region ID he is on. Then we use that in a conditional branch. You can see how this is organized below.



Next time, I’ll attach all of this to an event that will push between these states depending on the time. Do you think I made any errors? Can you think of a way to test this before I attach it to the time system? Tell me what you think in the comments below!

Download project to this point!

0 comments… add one

Leave a Comment