What I'm trying to do is apply a leader_flag for newly spawned human rulers in empires controlled by the player. So far, I can get it to work if I do not try and scope specifically to either the player or the AI. If I try and add a scope pointing to either the player or AI, it will not apply the leader_flag to the ruler.
Here is a sample of my common/on_actions/on_action_test.txt file:
Below is the sample code in events/test_event.txt. This code DOES WORK in applying the appropriate leader_flag to the ruler, but this method would result in applying the leader_flag to rulers of both AI and human players.
How can I code it to apply only to human player controlled empires?
Here is a sample of my common/on_actions/on_action_test.txt file:
Code:
on_leader_spawned = {
events = {
ruler_test.1
}
}
Below is the sample code in events/test_event.txt. This code DOES WORK in applying the appropriate leader_flag to the ruler, but this method would result in applying the leader_flag to rulers of both AI and human players.
How can I code it to apply only to human player controlled empires?
Code:
namespace = ruler_test
country_event = { # a new human leader is generated for an empire, to be available for recruitment
id = ruler_test.1
is_triggered_only = yes
hide_window = yes
trigger = {
FROM = {
is_ruler = yes
species = { species_portrait = human }
}
}
immediate = {
if = {
limit = {
THIS = { has_country_flag = human_1 } # United Nations of Earth
}
FROM = { set_leader_flag = UNE_ruler }
break = yes
}
if = {
limit = {
THIS = { has_country_flag = human_2 } # Commonwealth of Man
}
FROM = { set_leader_flag = COM_ruler }
break = yes
}
else = { # Custom Empire
FROM = { set_leader_flag = custom_empire_ruler }
break = yes
}
}
}