Results 1 to 15 of 15

Thread: Military AID

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Military AID

    I was wondering why when two factions are allies, non of each ever give any military aid, we've the option but they never accept or even send troops, so my question is how to make this happen with more frequence between allies and really make them send troops on aid ?

    :hmmm:
    Common sense removed due being Disruptive.

  2. #2

    Default Re: Military AID

    Yeah, and I always felt vassals should offer military assistance. It's probably doable via mercs and AoR?

    BTW, When allied AI armies are in trouble, they could ask assistance from player's forces nearby. It'd be cool if players can do something similar.

  3. #3
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Military AID

    I did take a look at scripting something for this months ago, but never got anything I was satisfied with. More on that later.

    I am far from an expert on the AI aspects of the game, but it seems to me this is where it should be done at.

    The problem seems to me that the only two basic army decisions are "invade" and "defend" with all their levels and variations.

    Invade means you are attacking a settlement/region that is not yours. Defend means you are defending your own territory.

    For something like this to work, there would need to be a defend_ally or defend_neighbor or something similar. All of the "ally" entries seem to be centered around not invading an ally. There are no conditions/commands I can find that would let allies send each other help. This is why I took a look at a scripting option:


    When this first came to me, I was asked by someone if an ally to the player could put out a "Call for Aid". I never released any of this as I was not happy with it, but maybe enough people pooled together can improve it. I am not going to go and dig out the actual script, its on another machine, but I will tell you how it works.

    For the player to help AI:
    monitor_event Transgression TransgressionName pick one, there are several.
    if TargetFactionType xxx
    and FactionStanding > xxx
    pop event choice window, send reinforcements?
    If yes, set_faction_standing higher
    start a counter


    if transgression still exists after x turns, reinforcements were not actually sent, or not enough were sent to solve problem.
    set_faction_standing lower, probably lose alliance


    For the AI:
    I_SettlementUnderSiege or IsUnderSiege(character)
    and FactionType xxx

    if FactionStanding faction1 > x then 25% faction1 sends help to target_faction
    spawn army in allies region
    give money
    increment_kings purse


    if FactionStanding faction1 > y then 50% faction1 sends help to target_faction
    spawn army in allies region
    give money
    increment_kings purse


    if FactionStanding faction1 > z then 75% faction1 sends help to target_faction
    spawn army in allies region
    give money
    increment_kings purse


    The problem comes when trying to tell the spawned AI armies what to do. There is nothing to force them to attack the enemy of their ally. There is the siege_settlement command, but that is useless because most likely we are trying to defend an allies settlement, not help them take one.

    There is the engage_armies command, but that is useless unless we know the generals name, and since the e_select_character doesnt seem to work properly, we cant pull his name from event references and use the "this" option. Nor have I found a way to set a label on a character after he is created.

    So sometimes the army will attack, sometimes they will just turn around and go home, or even off to another region.

    The other problem is how big this script gets to be. There are so many alliance variations. England + France is fine, but what if England is also allied with HRE and HRE attacks France. Checking FactionStanding all the time runs into a lot of checks.

    One way I came up with to reduce some of that is by setting some counters.

    monitor_event FactionAllianceDeclared FactionType england
    and TargetFactionType france
    set_event_counter england_france_alliance 1

    monitor_event FactionBreakAlliance FactionType england
    and TargetFactionType france
    set_event_counter england_france_alliance 0


    You have to have two events for faction * however many factions there are. So with 30 factions, there are 60 events per faction. Then repeat that for each faction = 900 events.

    Then check all of those counters every time there is a transgression to make sure you dont send reinforcements when two of your allies fight.

    It CAN be made to actually send armies, but as I said before, no promises what those armies do once they are spawned.

  4. #4

    Default Re: Military AID

    well having them closer would be nice, because if the player army engage in battle the spawned ally army would engange in battle two ...
    Common sense removed due being Disruptive.

  5. #5
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Military AID

    To have them close you would have to script a possibility for every single x,y location on the map. On a 500 x 500 map thats 250k locations.

  6. #6

    Default Re: Military AID

    What about decreasing the faction standing between the players ally and the faction attacking the player. This would/could aid in forcing your ally to attack/declare war etc on the enemy faction when you spawn the allied army. Similar to increasing the faction standing between the player and ally when the player agrees to send forces. You would also run into issues where the players enemy is also the players Ally's Ally. So another counter would need to be in play to help the ally decide who it should side with.

    900 events is an awful lot of scripting for one aspect of game play. Surely a complicated set of scripting commands to get right, but the potential for game play would be a bonus indeed.

    I also agree that the best way to fix the whole 'AI issue' is through scripting. Be it garrison scripts, money scripts, your call for aid idea, and other scripts that affect how the AI goes about its turn to turn movements and such. It seems that the AI files in general have been improved to the best they will get with the current engine without using scripts to further influence what the AI does.
    ...longbows, in skilled hands, could reach further than trebuchets...

  7. #7

    Default Re: Military AID

    and what if we use the allied faction to besiege or go help if we're besieged, so replacing the x y by settlements ?
    Common sense removed due being Disruptive.

  8. #8
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Military AID

    Quote Originally Posted by Ataegina View Post
    and what if we use the allied faction to besiege or go help if we're besieged, so replacing the x y by settlements ?
    Then you are down to the number of settlements x the number of factions X the number of possible alliances and pick a spot close to each city to spawn armies.

  9. #9

    Default Re: Military AID

    well seems theres is no way to make a small script for this without making a bunch of entries.....
    Common sense removed due being Disruptive.

  10. #10
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Military AID

    Quote Originally Posted by Ataegina View Post
    well seems theres is no way to make a small script for this without making a bunch of entries.....
    It will definitely not be small, but it could end up being a good replacement for a garrison script.

  11. #11
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Military AID

    Ok I am doing some research here. I think if we use the event_counters such as I described above we will have the best chance of getting this somewhat right.

    I suggest all of you read through the Transgression triggers in descr_faction_standings.txt for a little insight into how faction relationships work.

    These events work, we need a set of them for each possible alliance, and they have to go both ways. In this example, Scotland offers and breaks the alliance with France, but we need an option where France initiates the action as well. We can set the same counter, but 4 options per alliance is needed.
    Code:
    monitor_event FactionAllianceDeclared FactionType Scotland ;faction initiating alliance
     and TargetFactionType france ;faction accepting alliance
      set_event_counter scotland_france_alliance 1
    end_monitor
     
    monitor_event FactionBreakAlliance FactionType scotland ;faction breaking alliance
     and TargetFactionType france ;faction alliance is broken with
      set_event_counter scotland_france_alliance 0
    end_monitor

    This code also works. I only built this to prove we could detect which faction has attacked the settlement of which faction.
    Code:
    monitor_event Transgression TransgressionName TC_INSTIGATE_SIEGE
     and FactionType england
     and TargetFactionType slave
      add_money england 20000
    end_monitor

    Once the start of the siege is detected, then we apply conditions:
    Code:
    monitor_event Transgression TransgressionName TC_INSTIGATE_SIEGE
     and FactionType england
     and TargetFactionType scotland
     if I_EventCounter scotland_france_alliance == 1
      put some conditions here to determine whether or not france helps scotland
     we may have to run another monitor_event if we want to check stuff like
     army garrison strength and stuff like that
     
      set_counter spawn_reinforcements 1
     end_if
     
     if I_SettlementUnderSiege Edinburgh
      and I_SettlementOwner Edinbirgh == scotland
      and I_EventCounter spawn_reinforcements == 1
      spawn_army near Edinburgh
     end_if 
    end_monitor

  12. #12

    Default Re: Military AID

    well this last version seems the most adequate and easy version to be used, also i agree this can be a good replacement for the garrison script and also make more use the factions diplomacy
    Common sense removed due being Disruptive.

  13. #13
    alhoon's Avatar Comes Rei Militaris
    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,233

    Default Re: Military AID

    Well, the FACTIONX_FACTIONY_ALLIANCE doesn't need to include all factions.

    Spain-Portugal is a good canditate, Moors-Egypt, Venice - pope, Byzantium - Russia etc


    And BTW with Lusted's AI your allies send help. Military help in the form of large army stacks that move in your territory and battle your enemies.


    What I think it would work without being terribly long/tiresome to write:
    - Some logic alliance counters like Moors-Egypt, etc.
    - If these alliances exist then each of the participants could get some mercenaries, like spain does in America. Example: If Byzantines have hungarians or russians as allies, they get cheaper slav mercenaries in Constantinople region, Anatolia and Greece.
    - If these alliances exist and a faction goes to war, the other faction gives them some financial aid. Example: If Moors are at war and they're allied with the egyptians, the egyptians give them 500, 1000, 1500 denars (depending on F.standing) and vice versa. Command? From the console! Not changing king's purse so it can be checked each turn.

    Question: Can we make the "DiplomaticStanceFactions" condition work? I can't. Does anyone know how it is spelled? The Docudemons doesn't have a solid example.
    Last edited by alhoon; August 25, 2008 at 06:37 AM.
    alhoon is not a member of the infamous Hoons: a (fictional) nazi-sympathizer KKK clan. Of course, no Hoon would openly admit affiliation to the uninitiated.
    "Angry Uncle Gordon" describes me well.
    _______________________________________________________
    Beta-tester for Darthmod Empire, the default modification for Empire Total War that does not ask for your money behind patreon.
    Developer of Causa Belli submod for Darthmod, headed by Hammeredalways and a ton of other people.
    Developer of LtC: Random maps submod for Lands to Conquer (that brings a multitude of random maps and other features).

  14. #14
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Military AID

    Well it would logically have to include all factions, as you never know how things are going to shake out.

    I have never tried Lusted AI, but its one of the things I plan to look at someday.

    From the docudemons:
    DiplomaticStanceFromFaction
    faction
    faction type, logic token, stance (Allied, Suspicious, Neutral, Hostile, AtWar)DiplomaticStanceFromFaction romans_julii > Suspicious
    Test the character's faction's diplomatic stance with another specified faction
    Either
    DIPLOMATIC_STANCE_FROM_FACTION
    I am not sure what else you need there but here is a simple way to check it.
    Code:
    monitor_event FactionTurnStart FactionType france
    and DiplomaticStanceFromFaction england == Neutral
    some code
    end_monitor

  15. #15
    alhoon's Avatar Comes Rei Militaris
    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,233

    Default Re: Military AID

    Yes, I have checked this and it works. I have used it quite a lot.

    The DiplomaticStanceFactions doesn't seem to work. According to the Docudemons you should put a faction, a target faction and a stance. However, I didn't manage to make it work.
    alhoon is not a member of the infamous Hoons: a (fictional) nazi-sympathizer KKK clan. Of course, no Hoon would openly admit affiliation to the uninitiated.
    "Angry Uncle Gordon" describes me well.
    _______________________________________________________
    Beta-tester for Darthmod Empire, the default modification for Empire Total War that does not ask for your money behind patreon.
    Developer of Causa Belli submod for Darthmod, headed by Hammeredalways and a ton of other people.
    Developer of LtC: Random maps submod for Lands to Conquer (that brings a multitude of random maps and other features).

Posting Permissions

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