• 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.

Pancakelord

Lord of Pancakes
44 Badges
Apr 7, 2018
3.375
12.292
  • Cities: Skylines - Green Cities
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Ancient Relics
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Imperator: Rome
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Imperator: Rome Deluxe Edition
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Stellaris: Necroids
  • Sword of the Stars
  • Crusader Kings III
  • War of the Roses
  • Cities: Skylines
  • Stellaris: Federations
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Lithoids
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris - Path to Destruction bundle
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
  • Stellaris
  • Cities: Skylines Deluxe Edition
  • Sword of the Stars II
  • March of the Eagles
  • Darkest Hour
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:
  1. see if [country] holds any favours from anyone at all (if no, end event chain)
  2. see which countries/countryIDs [country] holds favours over
  3. see how many favours [country] holds for each respective country
Spent the little while searching for anything related to favours and I am turning up a blank.
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:
The three things related to favors listed in the trigger docs are num_favors (a check) add_favors (an effect) and remove_favors (another effect).
 
The three things related to favors listed in the trigger docs are num_favors (a check) add_favors (an effect) and remove_favors (another effect).
Thanks for that! ah ... they spell it the american way without a "U", explains why it didn't come up.

remove_favors is definitely useful for what i need, to clear expended favours
i'm not sure if num_favours could be used to see all favours the current AI owns, as it just checks against a specific country (I could cycle through and check every valid country ... but that really wont do wonders for performance).