Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: Change Occupation Options for Specific Factions.

  1. #1
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Change Occupation Options for Specific Factions.

    I would like to delete the occupy decision for some of the minor factions. I do not want to delete this option for all of them nor an entire culture group. For example, I want Athens to be unable to occupy but Seleucid to have the option to occupy a defeated settlement. The factions that will be unable to occupy settlements are mostly minor factions, while those that stay unchanged are mostly the major factions.

  2. #2
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    there are 2 ways for doing that

    1) assign a custom personalty into startpos by using esf and then build the personalities thorugh db (and assign custom/specific occupation decisions)

    2) do things via script, more difficult since it will require lua knowledge but much more elastic/dynamic since you will be able to have the variations you want to set
    ie athens could be set to conquer till it reaches 2/3 regions and then disable the conquer options (testudo, a dei submod has that kind of script if you wanna check)

  3. #3
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    Thank you for your response Jake.

    My lua knowledge is extremely limited, so I will have to go the alternative route.

    Where in startpos is the personalities listed? Is it under FACTION_ARRAY, FACTION and then listed below the two default values (type: System.String)? I think it is this but I want to be sure.

    Are these the tables that I must edit in db? Is there more or less?

    cai_personality_occupation_decision_components_tables
    cai_personality_occupation_decision_priorities_tables
    culture_settlement_occupation_options_tables

    If they are, do you know what the numbers are?

  4. #4
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    you can change them with editsf (pfm has it integrated):
    CAMPAIGN_STARTPOS > CAMPAIGN_ENV > CAMPAIGN_MODEL > CAI_INTERFACE > CAI_WORLD > CAI_WORLD_FACTIONS-X > CAI_FACTION > CAI_FACTION_PERSONALITY

    cai_personalities_tables
    the very last column (in rpfm at least) is the occupation decision
    as key entry you must put the entry you assign in startpos, and then fill all the other fields as you like

    then
    cai_personality_occupation_decision_components_tables
    cai_personality_occupation_decision_priorities_tables
    culture_settlement_occupation_options_tables
    (also, use rpfm and use its search bar with personality as a key word, all those table will come out)

    should be mandatory
    numbers are weights
    to make an example: you have 6 possible outcomes
    if you put 10 as a value for each of the 6 outcomes it means the total is 60
    since we have 6 then 60/6 = 10
    best way for doing that is considering 100 as the toal sum you're going to insert, this way you can have simple % values

  5. #5
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    Thank you Jake. You have provided me what I need and I am grateful. I will get to work on this after the holidays. I hope you have a wonderful Christmas.

  6. #6
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    anytime
    if your modding intentions are serious... let me know
    I'm always looking for additional guys for modding plans
    that's the thing I'm working on lately (will take a while still)
    https://www.twcenter.net/forums/show...Rome-666-(WIP)

  7. #7

    Default Re: Change Occupation Options for Specific Factions.

    I believe I have what you're looking for. This is how you do it through scripting:

    go and find data_rome2.pack\campaigns\main_rome\scripting.lua - extract that file, open it in any text editor, and add this:

    --------------------------------------------------------------
    -- Callback to check custom per-faction occupation decision
    --
    ------------------------------------------------------------

    function OccupationDecisionAvailableForFaction(faction, occupation_decision)
    out.ting("Faction " .. faction:name() .. " checks for occupation decision " .. occupation_decision)

    local faction_name = faction:name()
    local faction_culture = faction:culture()
    local faction_sub_culture = faction:subculture()

    -- valid occupation_decision strings are:
    -- "occupation_decision_loot",
    -- "occupation_decision_sack",
    -- "occupation_decision_raze",
    -- "occupation_decision_occupy",
    -- "occupation_decision_liberate",
    -- "occupation_decision_vassal"

    if (faction_sub_culture == "sc_rom_barb_east") then
    if (occupation_decision == "occupation_decision_occupy") then
    return false
    end
    end

    return true

    end
    I hope that by looking at it, you can tell what needs to be replaced/changed to get it to work as intended for you. Good luck!

  8. #8
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    yes that function is already used extensively both in DeI alexander submod and testudo
    if you wanna check an extensive use, here is an extraction
    https://www.mediafire.com/file/f65qk...DAIA.pack/file

  9. #9
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    First off, thank you MrCrazyDude115 and Jake Armitage for your responses and resources. Secondly, I apologize for the extremely late response. This is the first time I have been back to TWC since my last post due to life's interruptions.

    I have decided to try the SQL route and used MrCrazyDude115 's and Jake Armitage's examples and the function used in the DeI alexander submod to build a template. I wanted to know if this is correct?

    if (faction_culture == "rom_Barbarian") and not (faction_name == "rom_arverni", "rom_lusitani", "rom_getae", "rom_odryssia", "rom_cimbri", "rom_lugii", "rom_suebi") then
    if (occupation_decision == "occupation_decision_occupy")
    or (occupation_decision == "occupation_decision_raze")
    then
    return false
    end
    end
    So, basically I want all factions that have the "rom_Barbarian" culture to NOT be able to occupy or raze a settlement with the exception of the listed factions. I will be doing this with the other three cultures as well.

    I also wanted specific factions to be able to occupy regions with a limitation. Example: Faction: "rom_arverni" being able to occupy no more than 4 regions. Here is the code I did for that using "Testudo" as a guide. Is this correct?

    -- ***------------------------------------------------------------------- START OF SCRIPT FOR:
    rom_arverni


    -- ///------------------------------------------------------------------- REGION OWNED: 4+(rom_arverni)


    if (faction_name == "rom_arverni") and
    if (_EQU_Faction_Region_Count >= 4) then
    if (occupation_decision == "occupation_decision_occupy")
    then
    return false
    end
    end
    I am not sure if MrCrazyDude115 or Jake Armitage will even see this post but would appreciate a response by anyone that may know how to do this or that has any SQL knowledge.

    NOTE: I am using DeI mod.
    Last edited by Jayman; July 02, 2021 at 04:53 PM.

  10. #10
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    it's lua, not sql

    concept is correct but...
    - don't really think you can track down main culture, subculture only, best way is to directly build faction libraries (like testudo ie)
    - it's almost impossible to understand if your script is correct by seeing pieces only

  11. #11
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    I was working on a Civ6 mod prior to my last post and put SQL where Lua should of been. Hopefully it didn't confuse any readers.

    I created a mod using "Testudo" as the only template. In db I edited the cai_personalities_tables, cai_personality_occupation_decision_components_tables, and cai_personality_occupation_decision_priorities_tables. I have the Occupation and Personalities lua scripts and the faction libraries. I added the "start external scripts" text at the end of the scripting lua in the campaign folder. I tested this in game and it didn't work.

    Jake Armitage thank you for responding. Could you or anyone else take a look at the file and see if you see anything wrong?

    https://www.mediafire.com/file/4yb9s...sion.pack/file

  12. #12
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    give it a check with a lua compiler
    you have lua syntax errors
    surely inside Fogg_Occupation.lua
    not sure about the second

    https://rextester.com/l/lua_online_compiler

  13. #13
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    I checked it with the lua compiler and fixed all the errors. It has been tested in game for 50 turns and seems to work.

    Thank you Jake Armitage for providing the link, checking my file and for your amazing mod Testudo. To my knowledge Testudo has been the most expansive and in depth mod with this function.

    I was wondering, is it possible to make certain factions only able to occupy lands within a specific province? For example: The Averni can only occupy lands within the provinces of Gallia and Aquitania, while unable to occupy regions outside these provinces. I do not plan on doing this right away, if it is even possible, but may in the future.

  14. #14
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    mmhh.... don't think this will be good for campaign randomness, you'll have factions eventually develop always in the same ways, would be better to put a cap and let them free inside that cap, imo.
    Besides what above, I think you'll have to track down things through a "character is sieging this specific settlement callback", and then call the correct occupation decision.
    It can also become messy in the case AI is sieging 2 settlement in the same turn, probably.
    Not sure if there are other ways.

  15. #15
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    Thank you Jake for your response.

    Yes, I understand what you mean about campaign randomness. I am still interested in doing this for a couple of factions but if it messes up the AI as you mentioned, then it will not be worth it.

    Is there an example of "character is sieging this specific settlement callback" being used in vanilla or DeI? Do you think this could be possible using the AOR libraries in DeI?

  16. #16
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    mmmhhh... no I don't think there is any script with a similar structure you could mimic.
    honestly, I would abandon that idea if I were you.
    no, don't think aor libraries could be useful for that.

  17. #17
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    Thank you for your response Jake.

    I took your advice and abandoned the idea. I am happy with what I have now. Your help was invaluable and I am grateful.

  18. #18
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    you're welcome and well done

  19. #19
    Jayman's Avatar Libertus
    Join Date
    Nov 2010
    Location
    New York
    Posts
    62

    Default Re: Change Occupation Options for Specific Factions.

    I finally had some time to play a campaign and found that the mod is not working. When I did the 50 turn test I did not capture any settlements because my entire focus was watching the AI. This was foolish of me.

    When I defeat a defending settlement this happens:

    Click image for larger version. 

Name:	Untitled.jpg 
Views:	2 
Size:	225.5 KB 
ID:	365234

    Here is a link to the mod.
    https://www.mediafire.com/file/ha00x...sion.pack/file

    I cannot find what the issue is. Any help is appreciated.

  20. #20
    Jake Armitage's Avatar Artifex
    Patrician

    Join Date
    Apr 2011
    Location
    apartment 6
    Posts
    4,694

    Default Re: Change Occupation Options for Specific Factions.

    you surely have a "flying useless end" at line 33 which is bugging everything

Page 1 of 2 12 LastLast

Posting Permissions

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