CK3 DatabaseCrusader Kings III · 1.20.1.2 “Crozier” · unofficial
Silk & Silverout Tue, Nov 17What's free, what needs the DLC, price →

Scripted trigger

add_random_building_trigger

add_random_building_trigger = { BUILDING = … }

game/common/scripted_triggers/00_building_requirement_triggers.txt, line 744 (13 lines). Parameters: $BUILDING$.

add_random_building_trigger is a scripted trigger in Crusader Kings III, written at line 744 of its file. A call passes 1 parameter: BUILDING. The game's script calls it in 1 place, among them add_random_building_variable_effect (scripted effect). Patch 1.20.1.2, from game/common/scripted_triggers/00_building_requirement_triggers.txt.

The comment above it in the file

can this building be added?

What it checks

  • building_$BUILDING$_requirement_terrain = yes
  • If

    • free_building_slots = 0

    Then

    Otherwise

    • NOT = { has_building_or_higher = $BUILDING$_01 }

• the game's own tooltip text · ◦ our reading of the script line · code the script where neither exists

“They” is whatever it runs on (the scope it is called in). The scripted triggers and effects it calls link to their own pages; $PARAMETERS$ stay as written: each call fills them in.

The script as written (13 lines of game script)
add_random_building_trigger = { 
	building_$BUILDING$_requirement_terrain = yes # terrain fits building type
	trigger_if = { # if all slots are full, this building type exists already
		limit = { free_building_slots = 0 }
		has_building_or_higher = $BUILDING$_01
		NOT = {
			has_lesser_building_trigger = { COMPARE = $BUILDING$ }
		}
	}
	trigger_else = {
		NOT = { has_building_or_higher = $BUILDING$_01 }
	}
}

As written in game/common/scripted_triggers/00_building_requirement_triggers.txt.

Where it is used

Every place in common/, events/ and history/ that calls add_random_building_trigger.

Source: game/common/scripted_triggers/00_building_requirement_triggers.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.

Spotted a mistake on this page?