NPC Schedules
Estimated reading time: 3 minutesOverview
Schedules describe where a named NPC should be for each hour of the day, plus optional conditional overrides. Internally this is backed by Schedule instances and the maplebirch.npc.Schedule helpers. v3.2.5 improves NPC schedule registration and special-schedule dependency resolution; pair it with GameVersion >= 0.5.9.7 so time handling matches the supported game build.
Register with maplebirch.npc.addSchedule(npcName, config), where config is either a ScheduleConfig object or a builder function (schedule) => … chaining at / when. This delegates to maplebirch.npc.Schedule.set.
API summary
addSchedule(npcName, config)
ScheduleConfig
daily: time is an hour index, or [startHour, endHour] inclusive; each hour in the range gets the same location.
special: array of conditional rows with condition, location, and optional id, before, after, insteadOf, override (same shape as SpecialScheduleConfig in the framework).
Object-style example
Builder example
EnhancedDate hints
Callbacks receive an EnhancedDate with helpers such as weekEnd, schoolDay, season flags, dawn / daytime / dusk / night, and isAt / isBetween / isHourBetween. For weather or story flags, read normal game globals (V, Weather, …); not every game field is mirrored on date.
Special schedule options
override: true: evaluated ahead of non-override specials after sorting.before/after/insteadOf: declare ordering between specials. Cycles log a warning and fall back to the original order.
Query & maintenance
Instance and current location
Update / remove specials
Clear
Bulk snapshot
Read-only getter maplebirch.npc.Schedule.location returns { [npcName: string]: string }.
