KaelaMenshaKhaine

QoL Game Rules Dragon aged fix

Jan 4th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.46 KB | None | 0 0
  1. #On actions related to health events
  2.  
  3. on_decline_of_health = {
  4. trigger = {
  5. NOT = { has_game_rule = decline_of_health_disabled }
  6. NOT = { has_trait = dragon } # Exclude dragons
  7. }
  8. on_actions = {
  9. decline_of_health_pulse
  10. delay = { days = { 1 89 } }
  11. illness_progression
  12. delay = { days = { 90 179 } }
  13. illness_progression
  14. delay = { days = { 180 269 } }
  15. illness_progression
  16. delay = { days = { 270 365 } }
  17. illness_progression
  18. }
  19. }
  20.  
  21. illness_progression = {
  22. effect = {
  23. ## illness progression
  24. random_list = {
  25. 2 = {
  26. modifier = { # young child
  27. effective_age < 8
  28. add = {
  29. value = -8
  30. add = effective_age
  31. }
  32. }
  33. modifier = { # elderly
  34. effective_age > age_of_decline
  35. add = {
  36. value = age_of_decline
  37. subtract = effective_age
  38. }
  39. }
  40. modifier = { # injuries
  41. has_trait = wounded_1
  42. add = -2
  43. }
  44. modifier = {
  45. has_trait = wounded_2
  46. add = -4
  47. }
  48. modifier = {
  49. has_trait = wounded_3
  50. add = -6
  51. }
  52. modifier = {
  53. has_trait = maimed
  54. add = -6
  55. }
  56. modifier = { # estimated physique
  57. always = yes
  58. add = gauge_physique
  59. }
  60. modifier = { # estimated hygiene
  61. always = yes
  62. add = gauge_hygiene
  63. }
  64. modifier = { # physician and treatment
  65. always = yes
  66. add = treatment_value
  67. }
  68. modifier = {
  69. OR = {
  70. has_game_rule = decline_of_health_harsh
  71. has_game_rule = decline_of_health_severe
  72. }
  73. add = -10
  74. }
  75. }
  76. 1 = {
  77. trigger = { has_trait = ill
  78. NOT = { has_trait = dragon }
  79. }
  80. modifier = { # in season
  81. current_month > 9
  82. add = {
  83. value = current_month
  84. add = -9
  85. }
  86. }
  87. modifier = {
  88. current_month < 6
  89. add = {
  90. value = 6
  91. subtract = current_month
  92. }
  93. }
  94. get_illness_stage = { TRAIT = ill }
  95. save_scope_value_as = {
  96. name = ill_progress
  97. value = {
  98. value = { 1 2 } # base
  99. if = {
  100. limit = { exists = var:illness_stage }
  101. add = { 0 var:illness_stage }
  102. multiply = { 1 var:illness_stage }
  103. }
  104. floor = yes
  105. }
  106. }
  107. change_illness_progress = {
  108. TRAIT = ill
  109. VALUE = scope:ill_progress
  110. }
  111. }
  112. 3 = {
  113. trigger = { has_trait = pneumonic
  114. NOT = { has_trait = dragon }
  115. }
  116. modifier = { # in season
  117. current_month > 9
  118. add = {
  119. value = current_month
  120. add = -9
  121. }
  122. }
  123. modifier = {
  124. current_month < 6
  125. add = {
  126. value = 6
  127. subtract = current_month
  128. }
  129. }
  130. get_illness_stage = { TRAIT = pneumonic }
  131. save_scope_value_as = {
  132. name = ill_progress
  133. value = {
  134. value = { 1 3 } # base
  135. if = {
  136. limit = { exists = var:illness_stage }
  137. add = { 0 var:illness_stage }
  138. multiply = { 1 var:illness_stage }
  139. }
  140. floor = yes
  141. }
  142. }
  143. change_illness_progress = {
  144. TRAIT = pneumonic
  145. VALUE = scope:ill_progress
  146. }
  147. }
  148. 1 = {
  149. trigger = { has_trait = great_pox
  150. NOT = { has_trait = dragon }
  151. }
  152. get_illness_stage = { TRAIT = great_pox }
  153. save_scope_value_as = {
  154. name = ill_progress
  155. value = {
  156. value = { 1 2 } # base
  157. if = {
  158. limit = { exists = var:illness_stage }
  159. add = { 1 var:illness_stage }
  160. }
  161. }
  162. }
  163. change_illness_progress = {
  164. TRAIT = great_pox
  165. VALUE = scope:ill_progress
  166. }
  167. }
  168. 1 = {
  169. trigger = { has_trait = lovers_pox
  170. NOT = { has_trait = dragon }
  171. }
  172. get_illness_stage = { TRAIT = lovers_pox }
  173. save_scope_value_as = {
  174. name = ill_progress
  175. value = {
  176. value = { 1 2 } # base
  177. if = {
  178. limit = { exists = var:illness_stage }
  179. add = { 1 var:illness_stage }
  180. }
  181. }
  182. }
  183. change_illness_progress = {
  184. TRAIT = lovers_pox
  185. VALUE = scope:ill_progress
  186. }
  187. }
  188. 1 = {
  189. trigger = { has_trait = leper
  190. NOT = { has_trait = dragon }
  191. }
  192.  
  193. get_illness_stage = { TRAIT = leper }
  194. save_scope_value_as = {
  195. name = ill_progress
  196. value = {
  197. value = { 1 3 } # base
  198. if = {
  199. limit = { exists = var:illness_stage }
  200. add = { 1 var:illness_stage }
  201. }
  202. }
  203. }
  204. change_illness_progress = {
  205. TRAIT = leper
  206. VALUE = scope:ill_progress
  207. }
  208. }
  209. 1 = {
  210. trigger = { has_trait = gout_ridden
  211. NOT = { has_trait = dragon }
  212. }
  213. get_illness_stage = { TRAIT = gout_ridden }
  214. save_scope_value_as = {
  215. name = ill_progress
  216. value = {
  217. value = { 1 3 } # base
  218. if = {
  219. limit = { exists = var:illness_stage }
  220. add = { 1 var:illness_stage }
  221. }
  222. }
  223. }
  224. change_illness_progress = {
  225. TRAIT = gout_ridden
  226. VALUE = scope:ill_progress
  227. }
  228. }
  229. 3 = {
  230. trigger = { has_trait = consumption
  231. NOT = { has_trait = dragon }
  232. }
  233. get_illness_stage = { TRAIT = consumption }
  234. save_scope_value_as = {
  235. name = ill_progress
  236. value = {
  237. value = { 1 3 } # base
  238. if = {
  239. limit = { exists = var:illness_stage }
  240. add = { 0 var:illness_stage }
  241. multiply = { 1 var:illness_stage }
  242. }
  243. floor = yes
  244. }
  245. }
  246. change_illness_progress = {
  247. TRAIT = consumption
  248. VALUE = scope:ill_progress
  249. }
  250. }
  251. 3 = {
  252. trigger = { has_trait = cancer
  253. NOT = { has_trait = dragon }
  254. }
  255. modifier = { # young child
  256. effective_age < 8
  257. add = {
  258. value = -8
  259. add = effective_age
  260. }
  261. }
  262. modifier = { # elderly
  263. effective_age > age_of_decline
  264. add = {
  265. value = effective_age
  266. subtract = age_of_decline
  267. }
  268. }
  269. get_illness_stage = { TRAIT = cancer }
  270. save_scope_value_as = {
  271. name = ill_progress
  272. value = { # chronic
  273. value = { 1 1.2 } # base
  274. if = {
  275. limit = { exists = var:illness_stage }
  276. add = { 0 var:illness_stage }
  277. add = { 0 var:illness_stage }
  278. multiply = { 1 var:illness_stage }
  279. }
  280. floor = yes
  281. }
  282. }
  283. change_illness_progress = {
  284. TRAIT = cancer
  285. VALUE = scope:ill_progress
  286. }
  287. }
  288. 1 = {
  289. trigger = { has_trait = typhus
  290. NOT = { has_trait = dragon }
  291. }
  292. get_illness_stage = { TRAIT = typhus }
  293. save_scope_value_as = {
  294. name = ill_progress
  295. value = {
  296. value = { 1 4 } # base
  297. if = {
  298. limit = { exists = var:illness_stage }
  299. add = { 1 var:illness_stage }
  300. }
  301. }
  302. }
  303. change_illness_progress = {
  304. TRAIT = typhus
  305. VALUE = scope:ill_progress
  306. }
  307. }
  308. 5 = {
  309. trigger = { has_trait = bubonic_plague
  310. NOT = { has_trait = dragon }
  311. }
  312. get_illness_stage = { TRAIT = bubonic_plague }
  313. save_scope_value_as = {
  314. name = ill_progress
  315. value = { # rapid
  316. value = { 1.2 3.2 } # base
  317. if = {
  318. limit = { exists = var:illness_stage }
  319. add = { 1 var:illness_stage }
  320. multiply = { 1 var:illness_stage }
  321. multiply = { 1 var:illness_stage }
  322. }
  323. floor = yes
  324. }
  325. }
  326. change_illness_progress = {
  327. TRAIT = bubonic_plague
  328. VALUE = scope:ill_progress
  329. }
  330. }
  331. 3 = {
  332. trigger = { has_trait = smallpox
  333. NOT = { has_trait = dragon }
  334. }
  335. get_illness_stage = { TRAIT = smallpox }
  336. save_scope_value_as = {
  337. name = ill_progress
  338. value = { # rapid
  339. value = { 1.2 2 } # base
  340. if = {
  341. limit = { exists = var:illness_stage }
  342. add = { 1 var:illness_stage }
  343. multiply = { 1 var:illness_stage }
  344. multiply = { 1 var:illness_stage }
  345. }
  346. floor = yes
  347. }
  348. }
  349. change_illness_progress = {
  350. TRAIT = smallpox
  351. VALUE = scope:ill_progress
  352. }
  353. }
  354. 3 = {
  355. trigger = { has_trait = measles
  356. NOT = { has_trait = dragon }
  357. }
  358. get_illness_stage = { TRAIT = measles }
  359. save_scope_value_as = {
  360. name = ill_progress
  361. value = {
  362. value = { 1.5 3.5 } # base
  363. if = {
  364. limit = { exists = var:illness_stage }
  365. add = { 1 var:illness_stage }
  366. multiply = { 1 var:illness_stage }
  367. }
  368. floor = yes
  369. }
  370. }
  371. change_illness_progress = {
  372. TRAIT = measles
  373. VALUE = scope:ill_progress
  374. }
  375. }
  376. 2 = {
  377. trigger = { has_trait = dysentery
  378. NOT = { has_trait = dragon }
  379. }
  380. get_illness_stage = { TRAIT = dysentery }
  381. save_scope_value_as = {
  382. name = ill_progress
  383. value = {
  384. value = { 1 2 } # base
  385. if = {
  386. limit = { exists = var:illness_stage }
  387. add = { 1 var:illness_stage }
  388. multiply = { 1 var:illness_stage }
  389. }
  390. floor = yes
  391. }
  392. }
  393. change_illness_progress = {
  394. TRAIT = dysentery
  395. VALUE = scope:ill_progress
  396. }
  397. }
  398. 1 = {
  399. trigger = { has_trait = ergotism }
  400. get_illness_stage = { TRAIT = ergotism }
  401. save_scope_value_as = {
  402. name = ill_progress
  403. value = {
  404. value = { 1 2 } # base
  405. if = {
  406. limit = { exists = var:illness_stage }
  407. add = { 1 var:illness_stage }
  408. }
  409. }
  410. }
  411. change_illness_progress = {
  412. TRAIT = ergotism
  413. VALUE = scope:ill_progress
  414. }
  415. }
  416. 1 = {
  417. trigger = { has_trait = sickly
  418. NOT = { has_trait = dragon }
  419. }
  420. get_illness_stage = { TRAIT = sickly }
  421. save_scope_value_as = {
  422. name = ill_progress
  423. value = {
  424. value = { 2 3 } # base
  425. if = {
  426. limit = { exists = var:illness_stage }
  427. add = { 1 var:illness_stage }
  428. multiply = { 1 var:illness_stage }
  429. }
  430. floor = yes
  431. }
  432. }
  433. change_illness_progress = {
  434. TRAIT = sickly
  435. VALUE = scope:ill_progress
  436. }
  437. }
  438. }
  439. random = { # fever?
  440. chance = {
  441. value = 1
  442. if = {
  443. limit = { exists = var:illness_stage }
  444. add = var:illness_stage
  445. }
  446. multiply = 10
  447. max = 100
  448. }
  449. add_character_modifier = {
  450. modifier = mr_qol_fever_modifier
  451. days = { 2 14 }
  452. }
  453. }
  454. remove_variable = illness_stage
  455. clear_saved_scope = ill_progress
  456.  
  457. random = {
  458. chance = 25
  459. trigger_event = {
  460. on_action = illness_progression
  461. days = { 15 30 }
  462. }
  463. }
  464. }
  465. }
  466.  
  467. decline_of_health_pulse = {
  468. trigger = {
  469. is_immortal = no
  470. NOT = { has_trait = dragon } # Exclude dragons
  471. }
  472. # estimated fastest death: ~5 years
  473. # estimated aging_factor for 30 years: ~1.36
  474. effect = {
  475. # calculate mr_qol_aging
  476. if = {
  477. limit = {
  478. trigger_if = {
  479. limit = { is_ai = yes }
  480. effective_age >= 50
  481. }
  482. trigger_else = {
  483. effective_age >= 30
  484. }
  485. }
  486. if = {
  487. limit = { NOT = { has_variable = mr_qol_aging } }
  488. set_variable = {
  489. name = mr_qol_aging
  490. value = 0.1
  491. }
  492. }
  493. if = { # maxed out
  494. limit = {
  495. trigger_if = {
  496. limit = { has_game_rule = decline_of_health_normal }
  497. var:mr_qol_aging < 10000
  498. }
  499. trigger_else_if = {
  500. limit = { has_game_rule = decline_of_health_harsh }
  501. var:mr_qol_aging < 100000
  502. }
  503. trigger_else = {
  504. var:mr_qol_aging < 1000000
  505. }
  506. }
  507. change_variable = {
  508. name = mr_qol_aging
  509. multiply = aging_factor
  510. }
  511. }
  512. }
  513. else_if = {
  514. limit = { has_variable = mr_qol_aging }
  515. remove_variable = mr_qol_aging
  516. }
  517. # set modifiers
  518. if = {
  519. limit = { has_variable = mr_qol_aging }
  520. switch = { # reset modifier stack
  521. trigger = has_character_modifier
  522. mr_qol_aging = { remove_all_character_modifier_instances = mr_qol_aging }
  523. mr_qol_aging_harsh = { remove_all_character_modifier_instances = mr_qol_aging_harsh }
  524. mr_qol_aging_severe = { remove_all_character_modifier_instances = mr_qol_aging_severe }
  525. }
  526. set_variable = {
  527. name = mr_qol_aging_copy
  528. value = {
  529. value = var:mr_qol_aging
  530. floor = yes
  531. }
  532. }
  533. while = {
  534. limit = { var:mr_qol_aging_copy > 1 }
  535. switch = {
  536. trigger = has_game_rule
  537. decline_of_health_normal = { add_character_modifier = mr_qol_aging }
  538. decline_of_health_harsh = { add_character_modifier = mr_qol_aging_harsh }
  539. decline_of_health_severe = { add_character_modifier = mr_qol_aging_severe }
  540. }
  541. change_variable = {
  542. name = mr_qol_aging_copy
  543. multiply = 0.5
  544. }
  545. }
  546. remove_variable = mr_qol_aging_copy
  547. }
  548. }
  549. }
Add Comment
Please, Sign In to add comment