Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #On actions related to health events
- on_decline_of_health = {
- trigger = {
- NOT = { has_game_rule = decline_of_health_disabled }
- NOT = { has_trait = dragon } # Exclude dragons
- }
- on_actions = {
- decline_of_health_pulse
- delay = { days = { 1 89 } }
- illness_progression
- delay = { days = { 90 179 } }
- illness_progression
- delay = { days = { 180 269 } }
- illness_progression
- delay = { days = { 270 365 } }
- illness_progression
- }
- }
- illness_progression = {
- effect = {
- ## illness progression
- random_list = {
- 2 = {
- modifier = { # young child
- effective_age < 8
- add = {
- value = -8
- add = effective_age
- }
- }
- modifier = { # elderly
- effective_age > age_of_decline
- add = {
- value = age_of_decline
- subtract = effective_age
- }
- }
- modifier = { # injuries
- has_trait = wounded_1
- add = -2
- }
- modifier = {
- has_trait = wounded_2
- add = -4
- }
- modifier = {
- has_trait = wounded_3
- add = -6
- }
- modifier = {
- has_trait = maimed
- add = -6
- }
- modifier = { # estimated physique
- always = yes
- add = gauge_physique
- }
- modifier = { # estimated hygiene
- always = yes
- add = gauge_hygiene
- }
- modifier = { # physician and treatment
- always = yes
- add = treatment_value
- }
- modifier = {
- OR = {
- has_game_rule = decline_of_health_harsh
- has_game_rule = decline_of_health_severe
- }
- add = -10
- }
- }
- 1 = {
- trigger = { has_trait = ill
- NOT = { has_trait = dragon }
- }
- modifier = { # in season
- current_month > 9
- add = {
- value = current_month
- add = -9
- }
- }
- modifier = {
- current_month < 6
- add = {
- value = 6
- subtract = current_month
- }
- }
- get_illness_stage = { TRAIT = ill }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 0 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = ill
- VALUE = scope:ill_progress
- }
- }
- 3 = {
- trigger = { has_trait = pneumonic
- NOT = { has_trait = dragon }
- }
- modifier = { # in season
- current_month > 9
- add = {
- value = current_month
- add = -9
- }
- }
- modifier = {
- current_month < 6
- add = {
- value = 6
- subtract = current_month
- }
- }
- get_illness_stage = { TRAIT = pneumonic }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 3 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 0 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = pneumonic
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = great_pox
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = great_pox }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- }
- }
- }
- change_illness_progress = {
- TRAIT = great_pox
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = lovers_pox
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = lovers_pox }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- }
- }
- }
- change_illness_progress = {
- TRAIT = lovers_pox
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = leper
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = leper }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 3 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- }
- }
- }
- change_illness_progress = {
- TRAIT = leper
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = gout_ridden
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = gout_ridden }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 3 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- }
- }
- }
- change_illness_progress = {
- TRAIT = gout_ridden
- VALUE = scope:ill_progress
- }
- }
- 3 = {
- trigger = { has_trait = consumption
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = consumption }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 3 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 0 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = consumption
- VALUE = scope:ill_progress
- }
- }
- 3 = {
- trigger = { has_trait = cancer
- NOT = { has_trait = dragon }
- }
- modifier = { # young child
- effective_age < 8
- add = {
- value = -8
- add = effective_age
- }
- }
- modifier = { # elderly
- effective_age > age_of_decline
- add = {
- value = effective_age
- subtract = age_of_decline
- }
- }
- get_illness_stage = { TRAIT = cancer }
- save_scope_value_as = {
- name = ill_progress
- value = { # chronic
- value = { 1 1.2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 0 var:illness_stage }
- add = { 0 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = cancer
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = typhus
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = typhus }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 4 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- }
- }
- }
- change_illness_progress = {
- TRAIT = typhus
- VALUE = scope:ill_progress
- }
- }
- 5 = {
- trigger = { has_trait = bubonic_plague
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = bubonic_plague }
- save_scope_value_as = {
- name = ill_progress
- value = { # rapid
- value = { 1.2 3.2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = bubonic_plague
- VALUE = scope:ill_progress
- }
- }
- 3 = {
- trigger = { has_trait = smallpox
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = smallpox }
- save_scope_value_as = {
- name = ill_progress
- value = { # rapid
- value = { 1.2 2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = smallpox
- VALUE = scope:ill_progress
- }
- }
- 3 = {
- trigger = { has_trait = measles
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = measles }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1.5 3.5 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = measles
- VALUE = scope:ill_progress
- }
- }
- 2 = {
- trigger = { has_trait = dysentery
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = dysentery }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = dysentery
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = ergotism }
- get_illness_stage = { TRAIT = ergotism }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 1 2 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- }
- }
- }
- change_illness_progress = {
- TRAIT = ergotism
- VALUE = scope:ill_progress
- }
- }
- 1 = {
- trigger = { has_trait = sickly
- NOT = { has_trait = dragon }
- }
- get_illness_stage = { TRAIT = sickly }
- save_scope_value_as = {
- name = ill_progress
- value = {
- value = { 2 3 } # base
- if = {
- limit = { exists = var:illness_stage }
- add = { 1 var:illness_stage }
- multiply = { 1 var:illness_stage }
- }
- floor = yes
- }
- }
- change_illness_progress = {
- TRAIT = sickly
- VALUE = scope:ill_progress
- }
- }
- }
- random = { # fever?
- chance = {
- value = 1
- if = {
- limit = { exists = var:illness_stage }
- add = var:illness_stage
- }
- multiply = 10
- max = 100
- }
- add_character_modifier = {
- modifier = mr_qol_fever_modifier
- days = { 2 14 }
- }
- }
- remove_variable = illness_stage
- clear_saved_scope = ill_progress
- random = {
- chance = 25
- trigger_event = {
- on_action = illness_progression
- days = { 15 30 }
- }
- }
- }
- }
- decline_of_health_pulse = {
- trigger = {
- is_immortal = no
- NOT = { has_trait = dragon } # Exclude dragons
- }
- # estimated fastest death: ~5 years
- # estimated aging_factor for 30 years: ~1.36
- effect = {
- # calculate mr_qol_aging
- if = {
- limit = {
- trigger_if = {
- limit = { is_ai = yes }
- effective_age >= 50
- }
- trigger_else = {
- effective_age >= 30
- }
- }
- if = {
- limit = { NOT = { has_variable = mr_qol_aging } }
- set_variable = {
- name = mr_qol_aging
- value = 0.1
- }
- }
- if = { # maxed out
- limit = {
- trigger_if = {
- limit = { has_game_rule = decline_of_health_normal }
- var:mr_qol_aging < 10000
- }
- trigger_else_if = {
- limit = { has_game_rule = decline_of_health_harsh }
- var:mr_qol_aging < 100000
- }
- trigger_else = {
- var:mr_qol_aging < 1000000
- }
- }
- change_variable = {
- name = mr_qol_aging
- multiply = aging_factor
- }
- }
- }
- else_if = {
- limit = { has_variable = mr_qol_aging }
- remove_variable = mr_qol_aging
- }
- # set modifiers
- if = {
- limit = { has_variable = mr_qol_aging }
- switch = { # reset modifier stack
- trigger = has_character_modifier
- mr_qol_aging = { remove_all_character_modifier_instances = mr_qol_aging }
- mr_qol_aging_harsh = { remove_all_character_modifier_instances = mr_qol_aging_harsh }
- mr_qol_aging_severe = { remove_all_character_modifier_instances = mr_qol_aging_severe }
- }
- set_variable = {
- name = mr_qol_aging_copy
- value = {
- value = var:mr_qol_aging
- floor = yes
- }
- }
- while = {
- limit = { var:mr_qol_aging_copy > 1 }
- switch = {
- trigger = has_game_rule
- decline_of_health_normal = { add_character_modifier = mr_qol_aging }
- decline_of_health_harsh = { add_character_modifier = mr_qol_aging_harsh }
- decline_of_health_severe = { add_character_modifier = mr_qol_aging_severe }
- }
- change_variable = {
- name = mr_qol_aging_copy
- multiply = 0.5
- }
- }
- remove_variable = mr_qol_aging_copy
- }
- }
- }
Add Comment
Please, Sign In to add comment