Skip to main content

Daily Routines (TA_)

Daily routines are Daedalus functions prefixed with TA_ (German Tagesablauf — daily schedule). They define what an NPC does during a given time slot — where they go, what activity they perform, and for how long.

All TA_ functions are defined in Content/AI/Human/TA.d, and the corresponding ZS_ states in Content/AI/Human/TA_Human/.

How the routine system works

Every TA_ function is a wrapper around the engine function TA_Min, which registers an NPC activity for a specific time slot:

func void TA_Sleep(var int start_h, var int start_m, var int stop_h, var int stop_m, var string waypoint)
{
TA_Min(self, start_h, start_m, stop_h, stop_m, "ZS_GotoBed", waypoint);
};

Parameters

All TA_ functions share the same signature:

ParameterTypeDescription
start_hintStart hour (24h format)
start_mintStart minute
stop_hintEnd hour
stop_mintEnd minute
waypointstringTarget waypoint (WP_) or freepoint (FP_) name

Rtn_ functions (daily schedules)

Routines are assigned to NPCs via the daily_routine variable pointing to an Rtn_ function:

instance Blacksmith(Npc_Default)
{
name = "Blacksmith";
// ...
daily_routine = Rtn_Start_Blacksmith;
};

func void Rtn_Start_Blacksmith()
{
TA_Smith_Anvil (08,00, 12,00, "FORGE_SMITH");
TA_Stand_Eating (12,00, 13,00, "FP_SMITH_EAT");
TA_Smith_Anvil (13,00, 18,00, "FORGE_SMITH");
TA_Smalltalk (18,00, 20,00, "FP_SMITH_TALK");
TA_Sleep (20,00, 08,00, "BED_SMITH");
};
tip

A daily schedule should cover the full 24 hours without gaps. If the end time of one routine doesn't match the start time of the next, the NPC will stand idle during the gap.

warning

The end time of one block must equal the start time of the next block. Blocks must not overlap.

ZS_ states (Zustand)

Each TA_ routine references a ZS_ state (Zustand — state), which consists of three functions:

  1. ZS_<Name>()Init: NPC walks to the waypoint, prepares items, sets perception.
  2. ZS_<Name>_Loop()Loop: Repeated behavior (animations, mob interactions). Returns LOOP_CONTINUE.
  3. ZS_<Name>_End()End: Cleanup when the time slot ends.

Waypoints and freepoints

  • WP_ (Waypoint) — a fixed, named point in the game world. The NPC walks exactly to this point.
  • FP_ (Freepoint) — a flexible point near a waypoint. Many ZS_ states automatically search for available freepoints nearby (e.g., Wld_IsFPAvailable(self, "STAND")).
  • Mobs — interactive world objects (e.g., anvil, bed, bench) that the NPC interacts with via AI_UseMob().

Human routine list

Standing / idle

FunctionZS_ StateFP / MobDescription
TA_Stand_ArmsCrossedZS_Stand_ArmsCrossedFP "STAND"Stands with arms crossed. Random idle animations: scratching, stretching, shifting legs.
TA_Stand_WPZS_Stand_WP— (waypoint)Stands idle exactly at the waypoint (no FP search). Arms-crossed pose + idle.
TA_Stand_GuardingZS_Stand_GuardingFP "STAND"Stands on guard — hands on hips, randomly looks around.
TA_Stand_SweepingZS_Stand_SweepingFP "SWEEP"Stands and sweeps with a broom. Creates ItMi_Broom if not owned.
TA_Stand_DementorZS_Stand_DementorFP "STAND"Dementor (Seeker) pose. Non-standard perception — senses like a monster.
TA_Stand_RangerMeetingZS_Stand_RangerMeetingFP "STAND"Ranger meeting. Minimal perception. Lares stands in guard pose, others with arms crossed.

Drinking

FunctionZS_ StateFP / MobDescription
TA_Stand_DrinkingZS_Stand_DrinkingFP "STAND"Stands and drinks booze (ItFo_Booze). Creates item if not owned. Random drinking animations.

Eating

FunctionZS_ StateFP / MobDescription
TA_Stand_EatingZS_Stand_EatingFP "STAND"Stands and eats a random food (apple, cheese, bacon, or mutton). Animation matches the food type.

Sitting

FunctionZS_ StateFP / MobDescription
TA_Sit_BenchZS_Sit_BenchMob "BENCH"Sits on a bench. Random sitting idle animations.
TA_Sit_CampfireZS_Sit_CampfireFP "CAMPFIRE"Sits on the ground at a campfire (no mob — uses FP).
TA_Sit_ChairZS_Sit_ChairMob "CHAIR"Sits on a chair. Random sitting idle animations.
TA_Sit_ThroneZS_Sit_ThroneMob "THRONE"Sits on a throne.

Sleeping

FunctionZS_ StateFP / MobDescription
TA_SleepZS_GotoBedMob "BEDHIGH"Goes to bed and sleeps. Limited perception — reacts to quiet sounds, damage, and talk (wakes up).
TA_Sleep_DeepZS_Sleep_DeepMob "BEDHIGH"Deep sleep — does not react to quiet sounds. Only damage and talk can wake the NPC.

Cooking

FunctionZS_ StateFP / MobDescription
TA_Cook_CauldronZS_Cook_CauldronMob "CAULDRON"Cooks in a cauldron. Creates ItMi_Scoop (ladle) if not owned.
TA_Cook_PanZS_Cook_PanMob "PAN"Cooks in a pan. Creates raw mutton; eats cooked mutton when finishing.
TA_Cook_StoveZS_Cook_StoveMob "STOVE"Cooks on a stove. Creates raw mutton if not owned.
TA_Roast_ScavengerZS_Roast_ScavengerMob "BARBQ"Roasts a scavenger on a spit.

Smithing / crafting

FunctionZS_ StateFP / MobDescription
TA_Smith_AnvilZS_Smith_AnvilMob "BSANVIL"Hammers on an anvil.
TA_Smith_CoolZS_Smith_CoolMob "BSCOOL"Cools metal in a water trough.
TA_Smith_FireZS_Smith_FireMob "BSFIRE"Heats metal at the forge fire.
TA_Smith_SharpZS_Smith_SharpMob "BSSHARP"Sharpens a weapon on a grindstone.
TA_Make_RuneZS_Make_RuneCreates runes at a rune table.
TA_Potion_AlchemyZS_Potion_AlchemyMob "LAB"Brews potions at an alchemy table. Creates ItMi_Flask if not owned.

Physical labor

FunctionZS_ StateFP / MobDescription
TA_Pick_FPZS_Pick_FPFP "PICK"Picks / digs — moves between PICK freepoints, changes position every ~7s.
TA_Pick_OreZS_Pick_OreMob "ORE"Mines ore. Creates and equips a two-handed axe (ItMw_2h_Axe_L_01) if not owned.
TA_Repair_HutZS_Repair_HutMob "REPAIR"Repairs a hut — hammers nails. Random repair animation.
TA_Sweep_FPZS_Sweep_FPFP "SWEEP"Scrubs with a brush (ItMi_Brush) at a freepoint.
TA_Wash_FPZS_Wash_FPFP "WASH"Washes / does laundry at a freepoint. Kneeling wash animation.
TA_Rake_FPZS_Rake_FPFP "PICK"Rakes with a rake (ItMi_Rake) at a freepoint.
TA_SawZS_SawMob "BAUMSAEGE"Saws wood on a tree saw.
TA_Stomp_HerbZS_Stomp_HerbMob "HERB"Stomps herbs — alchemy preparation.

Study / writing

FunctionZS_ StateFP / MobDescription
TA_Read_BookstandZS_Read_BookstandMob "BOOK"Reads at a bookstand.
TA_Study_WPZS_Study_WP— (waypoint)Studies at a waypoint — stands with arms crossed and reads a fake scroll (FakeScroll_Addon).

Social / communication

FunctionZS_ StateFP / MobDescription
TA_SmalltalkZS_SmalltalkFP "SMALLTALK"Stands at a freepoint and every ~8s chats with a nearby NPC in the same state.

Prayer

FunctionZS_ StateFP / MobDescription
TA_Pray_InnosZS_Pray_InnosMob "INNOS"Prays to Innos at an altar (mob interaction).
TA_Pray_Innos_FPZS_Pray_Innos_FPFP "PRAY"Kneels and prays to Innos at a freepoint.
TA_Pray_SleeperZS_Pray_SleeperMob "IDOL"Prays to the Sleeper at an idol (mob interaction).
TA_Pray_Sleeper_FPZS_Pray_Sleeper_FPFP "PRAY"Kneels and prays to the Sleeper at a freepoint.

Speeches

FunctionZS_ StateFP / MobDescription
TA_Preach_VatrasZS_Preach_VatrasDelivers Vatras-style sermons. Cycles through 21 sermons, changing every ~13s.
TA_Announce_HeroldZS_Announce_HeroldHerald makes announcements. Every ~70s interrupts guard pose to deliver a message.

Movement

FunctionZS_ StateFP / MobDescription
TA_RunToWPZS_RunToWPRuns to a waypoint, then stands in guard pose looking around.
TA_FleeToWpZS_FleeToWpFlees to a waypoint (running + HUMANS_FLEE.MDS animation overlay).
TA_Follow_PlayerZS_Follow_PlayerFollows the player.
TA_Guide_PlayerZS_Guide_PlayerGuides the player to a destination.
TA_Guard_PassageZS_Guard_PassageGuards a passage — blocks the player's path. Perception every 0.1s.
TA_Guard_HammerZS_Guard_HammerFP "STAND"Stands on guard. Handles the quest Holy Hammer — returns it to the monastery if near the sanctum.
TA_CircleZS_CircleRitual circle magic. Effects depend on guild (dementor / KDW / mage).

Music / performances

FunctionZS_ StateFP / MobDescription
TA_Play_LuteZS_Play_LuteFP "STAND"Plays a lute. Creates ItMi_Lute if not owned.
TA_ConcertZS_ConcertIn Extremo band concert. Each band member equips their instrument.
TA_DanceZS_DanceDances a random style (9 variants: T_DANCE_01 through T_DANCE_09).
TA_Spit_FireZS_Spit_FireFP "STAND"Fire breathing (fire-eater). Creates ItLsTorchFireSpit if not owned.

Training

FunctionZS_ StateFP / MobDescription
TA_Practice_MagicZS_Practice_MagicFP "STAND"Practices magic. Random animations: T_PRACTICEMAGIC through T_PRACTICEMAGIC4, R_SCRATCHHEAD.
TA_Practice_SwordZS_Practice_SwordPractices swordfighting. Equips best melee weapon; if none — creates ItMw_1h_Bau_Mace.

Smoking

FunctionZS_ StateFP / MobDescription
TA_Smoke_JointZS_Smoke_JointFP "STAND"Smokes a joint (swampweed). Creates ItMi_Joint if not owned.
TA_Smoke_WaterpipeZS_Smoke_WaterpipeMob "SMOKE"Smokes a waterpipe.

Miscellaneous

FunctionZS_ StateFP / MobDescription
TA_PeeZS_PeeFP "PEE"Relieves themselves.
TA_GhostZS_GhostGhost behavior — non-standard perception (only talk and damage).
TA_GhostWuselZS_GhostWuselFP "FP_ROAM"Wandering ghost — moves between freepoints.

Monster routines

Monsters use simpler routines managed by the central scheduler ZS_MM_AllScheduler, which routes the monster to the appropriate state based on the time of day.

FunctionZS_ StateFPDescription
TA_RoamZS_MM_Rtn_Roam"FP_ROAM"Monster roams between FP_ROAM freepoints. Random wait time (0–5s) at each point.
TA_RestZS_MM_Rtn_Rest"FP_ROAM"Monster rests — stands in place with random idle animations.
TA_SleepMonsterZS_MM_Rtn_Sleep"FP_ROAM"Monster sleeps (lies down). Limited perception — quiet sounds from hostile guilds wake it to combat.
TA_WuselZS_MM_Rtn_Wusel"FP_ROAM"Monster runs restlessly between freepoints (changes point every 1s).

Special monster routines

FunctionZS_ StateDescription
TA_MM_Rtn_EatGroundZS_MM_Rtn_EatGroundMonster eats from the ground — random head-lifting animations while eating.
TA_MM_Rtn_DragonRestZS_MM_Rtn_DragonRestDragon rests — regenerates HP (1 HP every 2 ticks) if it's a dragon.
TA_MM_Rtn_FollowSheepZS_MM_Rtn_FollowSheepSheep (or animal) follows the hero if it's a party member.
TA_MM_Rtn_OrcSitZS_MM_Rtn_OrcSitOrc sits at a campfire (FP "FP_CAMPFIRE") in a guard-sleep pose.
TA_MM_Rtn_SummonedZS_MM_Rtn_SummonedSummoned creature — follows the hero, has a limited lifetime (MONSTER_SUMMON_TIME).

Mobs — interactive object reference

Routines that use mobs require the corresponding interactive object to be placed near the waypoint.

Mob NameUsed By
BSANVILTA_Smith_Anvil
BSCOOLTA_Smith_Cool
BSFIRETA_Smith_Fire
BSSHARPTA_Smith_Sharp
BARBQTA_Roast_Scavenger
BAUMSAEGETA_Saw
BEDHIGHTA_Sleep, TA_Sleep_Deep
BENCHTA_Sit_Bench
BOOKTA_Read_Bookstand
CAULDRONTA_Cook_Cauldron
CHAIRTA_Sit_Chair
HERBTA_Stomp_Herb
IDOLTA_Pray_Sleeper
INNOSTA_Pray_Innos
LABTA_Potion_Alchemy
ORETA_Pick_Ore
PANTA_Cook_Pan
REPAIRTA_Repair_Hut
SMOKETA_Smoke_Waterpipe
STOVETA_Cook_Stove
THRONETA_Sit_Throne

Freepoints — type reference

FP TypeUsed By
CAMPFIRETA_Sit_Campfire
FP_CAMPFIRETA_MM_Rtn_OrcSit
FP_ROAMTA_GhostWusel, TA_Roam, TA_Rest, TA_SleepMonster, TA_Wusel and other monster routines
PEETA_Pee
PICKTA_Pick_FP, TA_Rake_FP
PRAYTA_Pray_Innos_FP, TA_Pray_Sleeper_FP
SMALLTALKTA_Smalltalk
STANDTA_Stand_ArmsCrossed, TA_Stand_Guarding, TA_Stand_Drinking, TA_Stand_Eating, TA_Stand_Dementor, TA_Play_Lute, TA_Practice_Magic, TA_Smoke_Joint, TA_Spit_Fire
SWEEPTA_Stand_Sweeping, TA_Sweep_FP
WASHTA_Wash_FP

Complete daily schedule example

// City blacksmith — full day
func void Rtn_Start_CitySmith()
{
TA_Sleep (22,00, 06,00, "BED_SMITH_01");
TA_Stand_Eating (06,00, 07,00, "FP_SMITH_EAT");
TA_Smith_Fire (07,00, 08,00, "FORGE_SMITH_01");
TA_Smith_Anvil (08,00, 12,00, "FORGE_SMITH_01");
TA_Smith_Cool (12,00, 12,30, "FORGE_SMITH_01");
TA_Stand_Eating (12,30, 13,00, "FP_SMITH_EAT");
TA_Smith_Anvil (13,00, 17,00, "FORGE_SMITH_01");
TA_Smith_Sharp (17,00, 18,00, "FORGE_SMITH_01");
TA_Smalltalk (18,00, 20,00, "FP_SMITH_TALK");
TA_Stand_Drinking (20,00, 22,00, "FP_TAVERN_SMITH");
};
info

TA_ functions called inside an Rtn_ function don't need to be in chronological order — the engine sorts the time blocks automatically. However, keeping them in order is recommended for code readability.

Changing routines at runtime

You can dynamically change an NPC's daily schedule using Npc_ExchangeRoutine:

// Changes the NPC's routine to a new schedule
Npc_ExchangeRoutine(self, "NIGHT_GUARD");

This requires a corresponding Rtn_NightGuard_<NPC_ID>() function to be defined.

To revert to the default routine:

// Restores the default daily schedule
Npc_ExchangeRoutine(self, "START");