Results 1 to 8 of 8

Thread: Alliances

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Arto's Avatar Praefectus
    Join Date
    Jan 2008
    Posts
    6,297
    Tournaments Joined
    1
    Tournaments Won
    0

    Default Alliances

    I want to make a mini mod where backstabbing is impossible and where you will go to war if a faction has attacked one of your allies.

    This was my original idea
    Spoiler Alert, click show to read: 
    So I wanted to make an Alliance mod for M2TW. The idea is this : So you play as Venice. Your diplomat makes with the Turks a defensive alliance (For some turns it depends on how much money you will give). So if Byzantium attack you or otherwise, you are immediatly at war with them and you can't make alliances or other things with other factions. Another thing : So if a (strong) faction is at war with 2 or more factions you can for a coalition against it. If a faction is in a coalition, the faction will be more aggresive than usual and will help you more often until the faction has lost lots of territories or ''please insert here'' . After the faction has lost most of it's territories, those conquered territories will change into a new faction example : You play as Venice and you have conquered lots of Byzantium territories ; you have the option to keep the territories for yourself or to change it into Venitian Byzantium. With this option you will have an defencive alliance for eternity with that faction. (Only Available if you are in a coalition). Oh and one thing : Backstabbing is impossible you can leave and alliance but you never can backstab a faction.
    Knowledge is a deadly friend, if no one sets the rules. The fate of all mankind I see, is in the hands of fools - King Crimson's Epitaph.
    תחי מדינת ישראל

  2. #2

    Default Re: Alliances

    This would be a very large script. It is simply not feasible.
    Here's the problem: (In psuedocode)
    Code:
    monitor_event FactionAttacksFaction
      if AttackingFaction == england
        if DefendingFaction == hre
          if not FactionsAtWar france hre
            SetFactionsAtWar france hre
          end_if
          ;all other factions here
        end_if
        ;all other factions here
      end_if
      if AttackingFaction == france
        if DefendingFaction == hre
          if not FactionsAtWar england hre
            SetFactionsAtWar england hre
          end_if
          ;all other factions here
        end_if
        ;all other factions here
      end_if
      if AttackingFaction == hre
        if DefendingFaction == england
          if not FactionsAtWar france england
            SetFactionsAtWar france england
          end_if
          ;all other factions here
        end_if
        ;all other factions here
      end_if
      ;all other factions here
    end_monitor
    That would make the total number of if statements needed number of factions * number of factions * number of factions, or number of factions^3. So for the vanilla game, that would be 22^3, or 10648 if statements.
    Last edited by Azim; August 23, 2008 at 08:52 PM.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  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: Alliances

    It could probably be done a bit cleaner than that, but it would still be large. Actually 10k events isnt terrible, after all there are garrison scripts out there with 200k+ lines of code.

    But I wont be writing it.

  4. #4
    Arto's Avatar Praefectus
    Join Date
    Jan 2008
    Posts
    6,297
    Tournaments Joined
    1
    Tournaments Won
    0

    Default Re: Alliances

    Which .txt is that?
    Knowledge is a deadly friend, if no one sets the rules. The fate of all mankind I see, is in the hands of fools - King Crimson's Epitaph.
    תחי מדינת ישראל

  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: Alliances

    It would go in the campaign_script.txt

  6. #6
    Arto's Avatar Praefectus
    Join Date
    Jan 2008
    Posts
    6,297
    Tournaments Joined
    1
    Tournaments Won
    0

    Default Re: Alliances

    How do you actually do that?
    I've hardly any experience with this kind of scripting.
    Knowledge is a deadly friend, if no one sets the rules. The fate of all mankind I see, is in the hands of fools - King Crimson's Epitaph.
    תחי מדינת ישראל

  7. #7
    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: Alliances

    I have quite a bit of experience scripting, and I never solved this issue to my satisfaction. There are a lot of roadblocks. If you are truly interested, then you need more than a basic understanding of scripting.

    I have posted some of my research in a similar thread if you care to read through it. Its not all in code so you should be able to follow the logic fairly well. Maybe if we get enough people with ideas together, both scripters and non scripters, we can work out something decent.

    http://www.twcenter.net/forums/showthread.php?t=187424

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

    Default Re: Alliances

    There's a line in descr_campaign_ai_db.xml. About trusted allies going to war.
    I have used it in my mod. It doesn't do exactly what you want though.

    Anyway, it's the closest and easiest thing to do.

    Use Lusted's AI for preventing backstabbing of allies first.

    Then change the descr_campaign_ai_db.xml
    as follows:

    <trusted_ally_fs_threshold float="-1.0"/>
    <trusted_ally_target_fs_threshold float="-1.0"/>
    <trusted_ally_target_human_fs_threshold float="-1.0"/>
    <trusted_ally_gs_threshold float="-1.0"/>
    <trusted_ally_target_gs_threshold float="-1.0"/>
    <trusted_ally_enemy_auto_war bool="true"/>

    I have used it in my mod (Lands to conquer: Andy's modifications) and it works.

    That way everytime the AI declares war to it's allies enemies. Even if these allies are pathetic scumbugs.

    HOWEVER: the Player won't go to war with his allies enemies automatically.
    Last edited by alhoon; August 24, 2008 at 02:18 PM.
    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
  •