Skip to content

Dialogue

Aaron edited this page Jul 21, 2026 · 1 revision

Dialogue variables

%a    Active quest reward
%adj  NPC name adjective (same structure as the prefix)
%adn  artifact dungeon name
%adv  NPC name adverb (same structure as the prefix)
%amn  artifact dungeon name?
%an   NPC name that gives artifact quest
%at   Active quest dungeon type (Mine, Cavern, Labyrinth,...)
%art  current artifact name
%apr  artifact province name
%arc  artifact leaving player's possession
%ba   Active quest bonus reward (unused)
%ccs  current MQ city
%ccl  current MQ dungeon
%cn   if in wilderness, current province name; otherwise, the current city name
%cn2  the nearest settlement name (same city type as the current)
%cp   current MQ province
%ct   current city type
%da   Active quest deadline date (short format)
%de   Active quest deadline, in days
%des  NPC description (same structure as the prefix)
%di   cardinal direction to dlgPoint
%dit  number of days quest NPC waits for player
%doc  NPC occupation/profession details
%ds   Active quest giver description (see below)
%du   number of days quest NPC says fast travel will take
%dnl  first word of %nc value
%ef   used with building names?
%en   NPC's home equipment store name
%fq   active quest giver's first name (female if not quest giver seed & 3)
%fn   NPC first name (similar to %n)
%g    he/she/it depending on dlgGender
%g2   him/her/it depending on dlgGender
%g3   his/her/its depending on dlgGender
%hc   player's home city
%hod  nearest holiday string: random normalized #169+holidayId
%jok  joke: random normalized #363
%lp   current province
%mi   item name for the active noble quest
%mn   monster name for the active quest
%mpr  province where the artifact map is
%mt   monster for the active quest ("Troll" etc.)
%n    NPC name
%nap  gold cost amount to get artifact info from NPC (see %oap)
%nc   a local name for the active quest
%ne   a local name for the active quest
%nh   nearest holiday name
%nhd  nearest holiday date, without the year
%non  empty string
%nr   (same as %ne)
%nt   building name
%o    a rival faction name for the active quest, or "%qf"
%oap  gold cost amount to get artifact info from NPC (see %nap)
%oc   NPC occupation/profession
%omq  quest item for the active quest (depends on the destination)
%opp  assassin from hostile guild
%oth  oath: random line from oaths[prov]. prov is the current province or random if imp. city
%pcn  PC full name. Sets dlgGender
%pcf  PC first name. Sets dlgGender
%pre  NPC name prefix (from a special data structure)
%qc   city where the active quest was taken
%qt   description of the active quest type ("deliver something" etc.)
%qf   title+first name for the opponent in the active quest
%qmn  notification that quest object is nearby
%r    relation type for the active quest ("daughter" etc.)
%ra   PC race
%rcn  random city-state name in the current province
%rf   ruler first name, or "Uriel Septim" if Imp. city
%rpn  random province name
%sn   name of snake charmer NPC's pet
%st   "war/peace" based on algorithm
%suf  NPC name suffix (same structure as the prefix)
%t    ruler title
%tan  $dlgDungeonName
%tc   target city name for the active quest
%tem  NPC's home temple name
%tg   target faction name for the active quest
%ti   (same as %du)
%tl   target venue name for the active quest, or "%dnl"
%tq   quest giver title for the active quest
%tt   class of the npc for the active quest

Random string is a random &-delimited piece of the dialogue string with the given id. Normalized means that all whitespace (including line breaks) is collapsed to single spaces.

TODO: document algorithms and npc/quest variables

War/Peace

loc <- currentCity.quarter
seed1 <- currentCity.seed
seed2 <- (seed1 & 0xFF) + (weather[loc] & 7)
seed <- (seed1 & 0xFFFFFF00) | (seed2 & 0xFF)
srand(seed)
return state[rnd() & 1]

Those strings are stored in szlist @3D63C.

Descriptions

Description strings for NPCs are stored in the following structure:

BYTE x, y;
szlist strings;

The strings array has x + 2y elements. The first x elements are gender-neutral, followed by y male and y female strings.

TEMPLATE.DAT variants

Strings 0 to 4 and 14 in TEMPLATE.DAT have several variants and stored several times.

To get the corresponding letter:

id <- 0
if 6 <= gameHour <= 18 then
   w <- 0
   if <overcast or raining> then w <- 1
   if <snow overcast or snowing> then w <- 2
   if <raining or snowing> then w <- w + 4
   id <- w + getSeason() * 8
   letter <- dayLetters[id]
else
   letter <- nightLetters[getSeason()]
endif

dayLetters is a 32-byte array @4108A nightLetters is a 4-byte array @46211

Clone this wiki locally