Results 1 to 3 of 3

Thread: [Partially solved] How to check alliances?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default [Partially solved] How to check alliances?

    here the problem:
    Spoiler Alert, click show to read: 

    I want to check if a faction is allied with anybody is holding a specific settlement.
    of course I cannot use this
    Code:
     monitor_event FactionTurnStart [some conditions]
    if I_SettlementOwner Big_City = milan
    and DiplomaticStanceFromFaction milan = Allied
    console_command victory scotland
    end_if
     
    if I_SettlementOwner Big_City = venice
    and DiplomaticStanceFromFaction venice = Allied
    console_command victory scotland
    end_if
    end_monitor
    becouse the DiplomaticStanceFromFaction does not work with ifs.
    Since checking the alliances for each faction would be having something like 109 monitors, I was wandering if some workaround was possible.
    The idea that come in my mind is, if possible, to change the faction labels.

    Code:
    monitor_event FactionTurnEnd TrueCondition
    if I_SettlementOwne Big_City = venice
    command: label venice into global_king                   ; Is there any command? I can't find anything in my docudemos
    end_if
    if I_SettlementOwne Big_City = milan
    command: label milan into global_king
    end_if
    end_mointor
    so then the 1st script becomes:
    Code:
     monitor_event FactionTurnStart [some conditions]
    and DiplomaticStanceFromFaction global_king = Allied
    console_command victory scotland
    end_if
     
    if I_SettlementOwner Big_City = venice
    and DiplomaticStanceFromFaction global_king = Allied
    console_command victory scotland
    end_if
    end_monitor
    thanks in advance.


    EDIT solved it. here the solution

    Spoiler Alert, click show to read: 

    you use a counter for each faction
    Code:
     
    declare counter faction1_alliance       ;0 neutral, 1 allied
    declare counter faction2_alliance
    declare counter faction3_alliance
    declare counter faction4_alliance
    declare counter faction5_alliance
    then you use a monitor firing at PreFactionTurnStart

    Code:
     
    monitor_event PreFactionTurnStart TrueCondition
    and DiplomaticStanceFromFaction faction1 = Allied
    set_counter faction1_alliance
    end_monitor
    this must be repeated for each faction.
    then at turn's end each counter is set again to 0
    Code:
    monitor_event FactionTurnEnd TrueCondition      ;Set counters to 0 at turn's end
    set_counter faction1_alliance 0
    set_counter faction2_alliance 0
    set_counter faction3_alliance 0
    set_counter faction4_alliance 0
    set_counter faction5_alliance 0
    end_monitor
    So the main script becomes:
    Code:
     monitor_event FactionTurnStart [some conditions]
    if I_SettlementOwner Big_City = milan
    and I_CompareCounter milan_alliance = 1
    console_command victory scotland
    end_if
    
    if I_SettlementOwner Big_City = venice
    and CompareCounter venice_alliance  = 1
    console_command victory scotland
    end_if
    end_monitor


    BUT this leads to a big number of monitors firing during passage of turn - wich is a bad thing. Does anybody have an alternative solution (= less time consuming?)
    Last edited by Kiliç Alì; January 16, 2012 at 05:19 AM.

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  2. #2

    Icon1 Re: [Partially solved] How to check alliances?

    Kiliç Alì: There are actual events for declaring and breaking an alliance, so you don't need to keep setting and resetting the counters:
    Spoiler Alert, click show to read: 
    Code:
    declare_counter sicily_allied_with_milan
    
    	monitor_event FactionAllianceDeclared FactionType sicily
    		and TargetFactionType milan
       		set_counter sicily_allied_with_milan 1
    	end_monitor
    
    	monitor_event FactionBreakAlliance FactionType sicily
    		and TargetFactionType milan
       		set_counter sicily_allied_with_milan 0
    	end_monitor

  3. #3
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: [Partially solved] How to check alliances?

    Off the top of my head:

    monitor_event UpdateAttitude FactionType factionX
    and TargetFactionType factionY
    and DiplomaticStance = allied
    and I_comparecounter XYallies != 1
    set_counter XYallies 1
    end_monitor

    monitor_event UpdateAttitude FactionType factionY
    and TargetFactionType factionX
    and DiplomaticStance = allied
    and I_comparecounter XYallies != 1
    set_counter XYallies 1
    end_monitor

    monitor_event UpdateAttitude FactionType factionX
    and TargetFactionType factionY
    and not DiplomaticStance = allied
    and I_comparecounter XYallies = 1
    set_counter XYallies 0
    end_monitor

    monitor_event UpdateAttitude FactionType factionY
    and TargetFactionType factionX
    and not DiplomaticStance = allied
    and I_comparecounter XYallies = 1
    set_counter XYallies 0
    end_monitor

    That tracks X and Y faction's alliance with each other when AI attitudes update. Fine if you're happy with it being tracked at the start of the first faction's turn. Would be a simpler script if it just tracked relations with the player (but I was thinking about hotseat ) - 30 factions means X needs to track 29 relationships, Y needs to track 28 (not X), Z needs to track 27 (not X or Y), etc. Nice big script.
    Last edited by Taiji; January 17, 2012 at 07:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •