So I'm trying to come up with a mod that will let the defender in a war use their favours over other empires to call those empires into the war (the more favours they hold, the higher the chance the other AI will say yes) - in exchange for "voiding" those favours and some influence cost.
However in the event file I am trying to find commands that will let me take the current empire and detect if it holds favours:
Anyone know if some sort of "favour_count" or "empire_owes_target_favours" function exists?
I've copied in my event file and on action file below for reference.
On action file
Event file
However in the event file I am trying to find commands that will let me take the current empire and detect if it holds favours:
- see if [country] holds any favours from anyone at all (if no, end event chain)
- see which countries/countryIDs [country] holds favours over
- see how many favours [country] holds for each respective country
Anyone know if some sort of "favour_count" or "empire_owes_target_favours" function exists?
I've copied in my event file and on action file below for reference.
On action file
Code:
# A war is beginning, executed for every country in the war.
# Root = Country
# From = War
on_war_beginning = {
events = {
WarfareFavoursMod.1 # Call the initial mod event when a war is declared.
}
}
Event file
Code:
namespace = WarfareFavoursMod
#this event runs a check to find the AI defending side war leader.
country_event = {
id = WarfareFavoursMod.1
hide_window = yes # non-visible check
is_triggered_only = yes # triggered by on_action on_war_declared
immediate = {
from = {
if = {
limit = {
AND = {
is_war_leader = { who = root side = defenders} # Find me the war leader on the defending side
is_ai = yes # Only for AI nations (humans get a manual edict)
}
}
root = { # Do I even need to reference root here?
country_event = { id = WarfareFavoursMod.2 } # Trigger the next step now that you have the AI defending war leader -- WarfareFavoursMod.2
}
}
}
}
}
}
Code:
#The defending war leader now determines which countries it holds favours from
country_event = {
id = WarfareFavoursMod.2
hide_window = yes #non-visible check
is_triggered_only = yes #triggered by on_action on_war_declared
immediate = {
## limit = { ## figure out who owes the AI Defending War leader favours.}
owner = {
set_timed_country_flag = {
flag = Used_Favours_for_Call_to_Defence # called allies to war - for events to hook in to
days = 720 # 2 years
}
##TODO
## country_event = { id = WarfareFavoursMod.3 } for favour debtors
}
}
}
Code:
# Send an event to all favour debtors, asking them to join the defender's war.
# Factor in opinion as a % chance for AI to honour their favours or refuse.
country_event = {
id = WarfareFavoursMod.3
hide_window = no # non-visible check
is_triggered_only = yes # triggered by on_action on_war_declared
##STUFF FOR LATER
}
Last edited: