Page 2 of 2 FirstFirst 12
Results 21 to 28 of 28

Thread: Help needed: Editing CAI to want to make satrapies

  1. #21
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Help needed: Editing CAI to want to make satrapies

    I don't rememebr much...

    What do you want exactly to do?

    It seems to me you want to apply a factional effect to AI when the AI faction owns at least one region and have at least 1 ally? (can't say if that client thing is doable, maybe yes, maybe not, if yes it could be quite tricky to do)
    Correct?

  2. #22
    alhoon's Avatar Comes Rei Militaris
    Moderator Emeritus

    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,758

    Default Re: Help needed: Editing CAI to want to make satrapies

    Exactly that. I.e. I want AI with satrapies (or at least allies) to get bonuses. From research bonuses to more money to bonuses in morale and defense (better forces) etc
    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).

  3. #23
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Help needed: Editing CAI to want to make satrapies

    ok, here is a pack for the alliances at least (military or defensive, client/satrapies won't be counted sadly)
    https://www.mediafire.com/file/4nifi...ance.pack/file

    it works for:
    - rome 2 vanilla grand campaign only (tell me if you need it for others campaigns)
    - it has an external script which means this mod will conflict with any other mod that has an external script too (I can fix this if you tell me what other mod you're using, check if it contains "campaigns > whatever campaign folder > scripting.lua")

    basically it gives a factional effect (which is not visible since it is for AI) to every AI faction who has at leaast one alliance.

    Effects I've put in:

    - +10% to research
    - +10% to tax rate
    - +5% to attack to every unit (non mercs)
    - +5% to defense to every unit (non mercs)
    - +5% to morale to every unit (non mercs)

    you can add the effects you want (keep in mind to put the correct effect scope and to leave end_round_completed as the only advancement stage) or change their values into "effect_bundles_to_effects_junctions_tables"

    here is the script (really simple):
    Code:
    -- 000---------------------
    --******* Current scripts and concepts by: Jake Armitage and alhoon from TWC
    --******* Mod "ALHOON'S ALLIANCE"
    --******* October 2019
    -- 000---------------------
    
    module(..., package.seeall);
    _G.main_env = getfenv(1);
    
    -- ###------------------------- START *******
    -- LIBRARIES REQUIRED  ---------------------------------------------------------------------
    -- ###-------------------------
    
    events = require "data.lua_scripts.events"
    local scripting = require "lua_scripts.EpisodicScripting"
    
    -- ###---------------------------------- END*
    
    -- ###------------------------- START *******
    -- ALHOON'S ALLIANCE ---------------------------------------------------------------------
    -- ###-------------------------
    
    local function ALHOON_ALLIANCE(context)
    
        if context:faction():is_human() == false
        then
    
            if context:faction():num_allies() >= 1
            then
    
            local faction = context:faction():name()
            scripting.game_interface:apply_effect_bundle("alhoon_alliance" ,faction, -1)
                    
            elseif context:faction():num_allies() < 1
            then
    
            local faction = context:faction():name()
            scripting.game_interface:remove_effect_bundle("alhoon_alliance" ,faction)    
            
            end
        end
    end        
    
    -- ###---------------------------------- END*    
        
    -- ###------------------------- START *******
    -- CALLBACKS ---------------------------------------------------------------------
    -- ###-------------------------
    
    scripting.AddEventCallBack("FactionTurnStart", ALHOON_ALLIANCE);
    
    -- ###---------------------------------- END*
    if you want to make it works for player only (so to actually see the effect into faction panel) just change:
    if context:faction():is_human() == true

    if you want to make it enabled for both just put this line too:
    if context:faction():is_human() == false
    or context:faction():is_human() == true
    ----------------------------

    The client/satrapy thing should be doable.
    I've found a CA script (gaul campaign) that more or less do this, it retrieves the type of diplomatic stance between 2 factions.
    It is a little tricky to be used and not really immediate. I will surely work on this ('cause I'll need it for the DeI submod VPS) but I don't think I'll do that too soon.
    I'm actually modding other features right now and I want to finish them.
    So, please, have some patience.
    Last edited by Jake Armitage; October 12, 2019 at 09:34 AM.

  4. #24
    alhoon's Avatar Comes Rei Militaris
    Moderator Emeritus

    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,758

    Default Re: Help needed: Editing CAI to want to make satrapies

    Quote Originally Posted by Jake Armitage View Post
    I'm actually modding other features right now and I want to finish them.
    So, please, have some patience.
    Man, you're amazing!!!

    No need to hurry, what you gave me works and works well. Sure, it works for Alliances too, that's fine. Alliances are not that common and I don't mind them being mutually beneficent.
    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).

  5. #25
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Help needed: Editing CAI to want to make satrapies


  6. #26
    alhoon's Avatar Comes Rei Militaris
    Moderator Emeritus

    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,758

    Default Re: Help needed: Editing CAI to want to make satrapies

    Well, it didn't work on first try, but perhaps I messed up something (I tried to activate it for the player to see the bonuses and started with the Seleucids). I'll keep trying.

    Perhaps it needs a full turn to activate so the very first turn it's off? I had only one mod on at the time that changes the unit cards
    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).

  7. #27
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Help needed: Editing CAI to want to make satrapies

    it works, remember that you must have at least 1 ally (defensive or military) not a client state/satrpay.
    the function used doesn't check client state/satrpay, just alliances.
    then, next turn you have forged the alliance, effect will take place.
    Spoiler Alert, click show to read: 

    the long number in brackets indicates the number of turns the effect will take place.
    in this case the number of turn is infinite (or better, not definite) which means it will last forever until you have at least 1 alliance.

    i've done it this way 'cause AI can have indefinite values only inside the script
    "scripting.game_interface:apply_effect_bundle("alhoon_alliance" ,faction, -1)"
    that -1 is the number of turns, -1 is forever/indefinite

    here's the pack for player only, maybe you mesed up something, can't say
    https://www.mediafire.com/file/5ja76...ayer.pack/file

    ----------------

    now I see I've put a wrong effect entry, the one for technology.
    into "effect_bundles_to_effects_junctions_tables" copy "rom_building_research_points_mod" instead of "rom_building_research_cost_mod". It's the second column (effect key)
    just copy/paste
    Last edited by Jake Armitage; October 15, 2019 at 05:06 AM.

  8. #28
    alhoon's Avatar Comes Rei Militaris
    Moderator Emeritus

    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,758

    Default Re: Help needed: Editing CAI to want to make satrapies

    Thanks!
    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).

Page 2 of 2 FirstFirst 12

Posting Permissions

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