I'm working on a small mod that increases the size of the planet over time, with the time delay until the next planet size increase hard coded in a tedious switch statement:
I would really like to remove those hard coded values (and the switch statement entirely) by setting the days = planet_size * tile_delay, where tile_delay is based on a constant adjusted by the country having either of the two terraforming resources available.
Unfortunately, I've tried dozens of iterations of set_variable, while iterations, every_tile iterations and other techniques, but can't get the script interpreter happy.
Some examples of what I've tried:
This throws a malformed token error for planet_size, even though it works similarly with the switch trigger =
Several iterations of the above, all resulting in Invalid Scope for either the change_variable statement, or when I try to use the variable later in the code.
Am I beating my head against an impossible task, or is there a way to set, and then use a variable later in this way?
Thanks in advance!
Code:
every_owned_planet = {
limit = {
planet_size < 26
num_pops > 0
OR = {
has_planet_flag = ai_terraforming_size
has_building = building_tile_terraformer
}
NOT = {
has_planet_flag = recently_terraformed
}
}
switch = {
trigger = planet_size
1 = { set_timed_planet_flag = { flag = recently_terraformed days = 27 } change_planet_size = 1 }
2 = { set_timed_planet_flag = { flag = recently_terraformed days = 54 } change_planet_size = 1 }
3 = { set_timed_planet_flag = { flag = recently_terraformed days = 81 } change_planet_size = 1 }
4 = { set_timed_planet_flag = { flag = recently_terraformed days = 108 } change_planet_size = 1 }
5 = { set_timed_planet_flag = { flag = recently_terraformed days = 135 } change_planet_size = 1 }
.
.
.
24 = {
change_planet_size = 1
remove_planet_flag = ai_terraforming_size
remove_modifier = "terraforming_ecosystem"
every_tile = { limit = {has_building = building_tile_terraformer} remove_building = yes }
}
I would really like to remove those hard coded values (and the switch statement entirely) by setting the days = planet_size * tile_delay, where tile_delay is based on a constant adjusted by the country having either of the two terraforming resources available.
Unfortunately, I've tried dozens of iterations of set_variable, while iterations, every_tile iterations and other techniques, but can't get the script interpreter happy.
Some examples of what I've tried:
Code:
while = {
count = planet_size
change_variable = {
which = terraform_delay
amount = 27
}
}
Code:
every_tile = {
change_variable = {
which = terraform_delay
amount = 27
}
}
Am I beating my head against an impossible task, or is there a way to set, and then use a variable later in this way?
Thanks in advance!