Skip to content
zumbak04 edited this page Nov 19, 2019 · 8 revisions

Hello! In this article you will find the code style that we use in events, decisions, traits etc. It is advisable to follow this style so that different developers do not get lost in each other's 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 the 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_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_mana_trigger, has_4_mana_trigger etc.), 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 triggers (has_5_mana_trigger, has_4_mana_trigger etc.), 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

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