Has anyone attempted something like this yet?
It seems the AI cant handle the concept of "proportionality". If it has 20 Alloy jobs and 20 CG jobs, it will try and fill all of 1 and then all of the other (or completely tank its mineral supply).
It does not appear to have the capacity to "split" its workforce, or not enough anyway, to have pops 10 in 1 job-type and 10 in the other if you only had 20/40 pops in the above example.
The priority/favourite system is wholly inadequite, not letting us set tiers of jobs, and I dont think the AI can even disable jobs. So what about plan B - What if the AI could actually turn its jobs off?
I've set up 2 decisions, 1 will increase #Alloy jobs whilst decreasing #CG jobs - the other does the opposite.
example
1
4/4 A/CG split
2
5/3
3
and after refresh(manually turn off/on 1 job)
And it works the other way too, removing those modifiers, one-by-one, first, then adding alloy jobs up until no artisans are left to deduct.
I am still trying to figure out how to force an update (have to manually turn 1 job off/on for the game to shuffle pops around - currently using
check_planet_employment = yes but might have to script in for it to directly scope to an artisan/metallurgist and fire that pop instead, if it exists. to guarantee this.)
May also want to setup a 31 day cooldown for the AI (so that it always moves 1 job per month either way, if in deficit, to not have too large income swings).
I've also read that it might be "cleaner" to bury these modifiers in the planet capital building (so they appear in it's tooltip instead), rather than in the planet scope itself, that way the top bit above the city GFX wont be cluttered with factory icons on AI worlds - but that's a minor issue.
WIP SCRIPTS:
Static modifier I use:
Decision scripts
It seems the AI cant handle the concept of "proportionality". If it has 20 Alloy jobs and 20 CG jobs, it will try and fill all of 1 and then all of the other (or completely tank its mineral supply).
It does not appear to have the capacity to "split" its workforce, or not enough anyway, to have pops 10 in 1 job-type and 10 in the other if you only had 20/40 pops in the above example.
The priority/favourite system is wholly inadequite, not letting us set tiers of jobs, and I dont think the AI can even disable jobs. So what about plan B - What if the AI could actually turn its jobs off?
I've set up 2 decisions, 1 will increase #Alloy jobs whilst decreasing #CG jobs - the other does the opposite.

example
1

2

3


And it works the other way too, removing those modifiers, one-by-one, first, then adding alloy jobs up until no artisans are left to deduct.
I am still trying to figure out how to force an update (have to manually turn 1 job off/on for the game to shuffle pops around - currently using
check_planet_employment = yes but might have to script in for it to directly scope to an artisan/metallurgist and fire that pop instead, if it exists. to guarantee this.)
May also want to setup a 31 day cooldown for the AI (so that it always moves 1 job per month either way, if in deficit, to not have too large income swings).
I've also read that it might be "cleaner" to bury these modifiers in the planet capital building (so they appear in it's tooltip instead), rather than in the planet scope itself, that way the top bit above the city GFX wont be cluttered with factory icons on AI worlds - but that's a minor issue.
WIP SCRIPTS:
Static modifier I use:
Code:
add_fou_minus_art = {
job_foundry_add = 1
job_artisan_add = -1
}
add_art_minus_fou = {
job_artisan_add = 1
job_foundry_add = -1
}
Decision scripts
- still considering best AI logic, and whether to use enactment time [planet linked] or country flags [empire wide check] for monthly delay on re-executing this decision - country flags dont seem to work quite right with how i have them set up below, probably wrong scope, need to dbl check,
- or only letting it test this if there are at least X industrial districts.
- Also considering the maths behind batched commands - testing income deficit (e.g. for CG), testing the "average output" of an artisan, dividing one by the other, taking the real number and using that as a counter for how many times in one month this can be run by an AI, effectively letting it bias jobs much faster than just once a month.
- Am still testing this manually, but eventually I'll add a "for AI only" flag, to hide it from players (that can use disabling jobs instead).
Code:
#######################################
#### ADD ARTISAN MINUS FOUNDRY JOB ####
#######################################
decision_add_art_minus_fou = {
owned_planets_only = yes
sound = event_administrative_work
icon = decision_resources
# FREE
resources = { category = decisions cost = { } }
potential = { owner = { is_gestalt = no } }
# DO WE HAVE FOUNDRY JOBS TO REMOVE?
allow = {
OR = {
has_modifier = "add_fou_minus_art" # Can subtract +foundry modifier
num_assigned_jobs = { job = "foundry" value >= 1 } # Only look at filled artisan jobs, AI will waste time on empty ones
#has_available_jobs = "foundry" # ^
}
NOT = { owner = { has_country_flag = has_used_bias_decision } } # This is to force the AI to incrementally bias jobs, one at a time per month, so it doesnt cause huge siwngs.
}
# IF FOUNDRY MODIFIER EXISTS, KILL IT, OTHERWISE ADD CG MODIFIER
effect = {
# If the +foundry modifier exists, kill it first.
if = { limit = { has_modifier = "add_fou_minus_art" }
remove_modifier = "add_fou_minus_art"
owner = { set_timed_country_flag = has_used_bias_decision days = 31 } # Guarantee month roll-over / re-calc
check_planet_employment = yes
}
#If no +foundry modifier exists add +artisan modifier.
else = { #limit = { NOT = { has_modifier = "add_fou_minus_art" } }
add_modifier = { modifier = "add_art_minus_fou" clear_on_owner_change = yes } # Clear on owner change wipes these out - useful if a Non-CG nation siezes the world.
owner = { set_timed_country_flag = has_used_bias_decision days = 31 } # Guarantee month roll-over / re-calc
check_planet_employment = yes
}
}
ai_weight = {
weight = 0
modifier = {
add = 1000
has_monthly_income = { resource = consumer_goods value < 0 } # If CGs < 0 use this
}
}
}
#######################################
#### ADD FOUNDRY MINUS ARTISAN JOB ####
#######################################
decision_add_fou_minus_art = {
owned_planets_only = yes
sound = event_administrative_work
icon = decision_resources
# FREE
resources = { category = decisions cost = { } }
potential = { owner = { is_gestalt = no } }
# DO WE HAVE ARTISAN JOBS TO REMOVE?
allow = {
OR = {
has_modifier = "add_art_minus_fou" # Can subtract +artisan modifier
num_assigned_jobs = { job = "artisan" value >= 1 } # Only look at filled artisan jobs, AI will waste time on empty ones
#has_available_jobs = "artisan" # ^
}
NOT = { owner = { has_country_flag = has_used_bias_decision } } # This is to force the AI to incrementally bias jobs, one at a time per month, so it doesnt cause huge siwngs.
}
# IF CG MODIFIER EXISTS, KILL IT, OTHERWISE ADD FOUNDRY MODIFIER
effect = {
# If the +artisan modifier exists, kill it first.
if = { limit = { has_modifier = "add_art_minus_fou" }
remove_modifier = "add_art_minus_fou"
owner = { set_timed_country_flag = has_used_bias_decision days = 31 } # Guarantee month roll-over / re-calc
check_planet_employment = yes
}
#If no +artisan modifier exists add +foundry modifier.
else = { #limit = { NOT = { has_modifier = "add_art_minus_fou" } }
add_modifier = { modifier = "add_fou_minus_art" clear_on_owner_change = yes } # Clear on owner change wipes these out - useful if a Non-CG nation siezes the world.
owner = { set_timed_country_flag = has_used_bias_decision days = 31 } # Guarantee month roll-over / re-calc
check_planet_employment = yes
}
}
ai_weight = {
weight = 0
modifier = {
add = 1000
has_monthly_income = { resource = alloys value =< 10 } # if alloys <10 use this.
}
}
}
Last edited:
- 3
- 2
- 1