Skip to content
zumbak04 edited this page Apr 10, 2021 · 5 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
is_ai = yes

is_ruler = yes

any_courtier = {
	is_ai = yes

	is_ruler = yes
}
  1. has_dlc, is_alive.
  2. is_ai, is_adult, is_incapable, is_imprisoned.
  3. is_ruler, is_landed, is_independent_ruler, is_mercenary_company, is_holy_order, Government triggers, tier triggers, is_at_war.
  4. character, in_diplomatic_range.
  5. Cooldowns, attempt limits, and other blockers.
  6. Being type (being_ traits) , race (creature_ traits), religion, culture, other traits.
  7. Wealth, piety, prestige, and user variables.
  8. Other conditions.
Example
is_alive

is_ai = yes
is_adult = yes

is_independent_ruler = yes

NOT = { has_character_modifier = invited_student_society_cooldown }

trait = creature_troll
religion = religion:loa_group

# Other conditions
age > 45

any_courtier = {
	is_mercenary_company = yes
	
	is_adult = yes
	
	prestige > 1000
}
  1. save_scope_as, set_variable, and other saves/sets that will be needed further in effect.
  2. Cooldowns, attempt limits, and other blockers.
  3. Being type (being_ traits), race (creature_ traits), religion, culture, other traits.
  4. Wealth, piety, prestige, and user variables.
  5. Other effects.
  6. Event firing (trigger_event).
  7. death
Example
save_scope_as = target_test

culture = culture:gilnean

death = { death_reason = death_execution killer = root }

random_courtier = {
	add_character_flag = placeholder_ongoing_flag
	
	add_gold = 1500

	trigger_event = TEST.10
}

So far, there's no style.