Skip to content
zumbak04 edited this page Dec 12, 2019 · 8 revisions

Hello! In this article you will find the code style that we use for writing events, decisions, traits etc. It is advisable to follow this style so that other developers can have an easier time interpreting your code.

Order of Lines

  1. There should be gaps (empty lines) between the numbered groups written below. In essence, all conditions in the same number group will occur together in one code block.
  2. Inside new scopes, the order begins anew.
Example
has_dlc = "Legacy of Rome"

ai = yes
is_playable = yes

any_courtier = {
	has_dlc = "Legacy of Rome"
	
	ai = yes
	is_playable = yes
}
  1. has_dlc, is_alive, is_dying, is_untouchable_trigger, can_rule_peacefully_trigger.
  2. ai, is_playable, is_adult, is_incapable, prisoner, is_inaccessible_trigger.
  3. is_ruler, is_landed, independent, is_tributary, mercenary, holy_order, controls_religion, is_offmap_governor, government, tier, war, in_revolt.
  4. character, is_within_diplo_range, same_realm.
  5. Flags/traits/modifiers working as cooldowns, attempt limits and other blockers.
  6. Being type (being_ traits) , race (creature_ traits), class (class_ traits), mana triggers (has_<5-1>_mana_trigger), religion, culture, other traits.
  7. Wealth, piety, prestige, society currency, offmap currency and user variables.
  8. Other conditions.
Example
has_dlc = "Legacy of Rome"

ai = yes
is_playable = yes

independent = yes

NOT = { has_character_modifier = invited_student_society_cooldown }

trait = creature_troll
religion = old_gods_worship

# Other conditions (you can not write comments)
diplomacy = 15
has_guardian = yes

any_courtier = {
	is_untouchable_trigger = no
	
	is_adult = yes

	has_5_mana_trigger = yes
	
	prestige = 1000
}
  1. show_scope_change, save_event_target_as.
  2. Flags/traits/modifiers working as cooldowns, attempt limits and other blockers.
  3. Being type (being_ traits) , race (creature_ traits), class (class_ traits), mana effects (remove_<5-1>_mana_effect, add_<5-1>_mana_effect), religion, culture, other traits.
  4. Wealth, piety, prestige, society currency, offmap currency and user variables.
  5. Other effects.
  6. Event firing (character_event etc.).
  7. death
Example
save_event_target_as = target_test

add_trait = class_warlock_6
remove_3_mana_effect = yes
culture = gilnean

death = { death_reason = death_execution killer = ROOT }

random_courtier = {
	show_scope_change = yes
	
	set_character_flag = placeholder_ongoing_flag
	
	wealth = 1500

	character_event = { id = TEST.10 }
}

Utilize the order given in this article while leaving a gap between modifiers similar to how they are sectioned off. For example, there should be a gap between "Character Attribute Modifiers" and "Realm Modifiers".

Example
diplomacy = 2
combat_rating = 10

demesne_size = 2
vassal_limit = 1

build_cost_modifier = 0.2

vassal_opinion = 10
general_opinion = 10