• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

GottJammern

Corporal
37 Badges
Oct 23, 2016
29
2
  • Crusader Kings II: Charlemagne
  • Crusader Kings II
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • BATTLETECH - Digital Deluxe Edition
  • BATTLETECH: Flashpoint
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Prison Architect
  • Stellaris: Ancient Relics
  • BATTLETECH: Season pass
  • BATTLETECH: Heavy Metal
  • Crusader Kings III
  • Age of Wonders III
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Teleglitch: Die More Edition
As title, I am trying to reduce the roots age via exported variable.

My variable is being correctly set, but I CANNOT get the add_age command to apply the variable, though commands such as add_age = -25 apply. Perhaps I need to refer to the variable in a different way with the add_age command?

Hopefully someone has a tip. Thanks!

Code:
ROOT = {
            export_to_variable = { which = difference_between_currentage_and_25 value = age }
            if = {
                limit = {age = 26}
                subtract_variable = {
                    which = difference_between_currentage_and_25
                    value = 25
                }
            }
            add_age = -difference_between_currentage_and_25
            set_character_flag = changed_to_25
        }
 
I almost tried this earlier. A simple multiply_variable by -1 would suffice then? I'll try that tonight.

EDIT: Worked great, thanks for the advice gentlemen!
 
Last edited:
It's not the most efficient, but it's very rarely used, so eh. I subtract age to set appearance to 25, add the eternal_youth trait, then add the removed age back on so the character looks 25 but their age remains correct. Afterwards I set the two variables to 0 so they are culled on the next load.

Code:
immediate = {
        ROOT = {
            export_to_variable = { which = difference_between_currentage_and_25 value = age }
            export_to_variable = { which = amount_to_subtract value = age }
            if = {
                limit = {age = 26}
                subtract_variable = {
                    which = difference_between_currentage_and_25
                    value = 25
                }
                subtract_variable = {
                    which = amount_to_subtract
                    value = 25
                }
                multiply_variable = {which = amount_to_subtract value = -1}
            }
        }
    }
    
    option = {
        name = EVTOPTASpell.11
        hidden_tooltip = {
            add_age = amount_to_subtract
        }
        add_trait = eternal_youth
        hidden_tooltip = {
            add_age = difference_between_currentage_and_25
            set_variable = { which = amount_to_subtract value = 0 }
            set_variable = { which = difference_between_currentage_and_25 value = 0 }
        }
    }