Welcome

Please register for Total War Access to use the forums. If you're an existing user, your forum details will be merged with Total War Access if you register with the same email or username. For more information please read our FAQ’s here.

Categories

Altering starting armies. How to do.

InvisibleInvisible Registered Users Posts: 5
I want to make a mod that should alter the starting armies (at the beginning of ME) of certain factions. There are some in the steam workshop, but nothing to my liking.

Any help is welcome!

Comments

  • D4B0SSD4B0SS Registered Users Posts: 191
    Function: grant_unit_to_character

    link:
    https://chadvandy.github.io/tw_modding_resources/campaign/episodic_scripting.html#function:episodic_scripting:grant_unit_to_character

    file: wh2_dlc12_tehenhauin.lua


    local tehenhauin_char = cm:get_closest_general_to_position_from_faction(tehenhauin_faction, 190, 209, true);

    local units = {
    "wh2_dlc12_lzd_inf_skink_red_crested_0",
    "wh2_dlc12_lzd_inf_skink_red_crested_0",
    "wh2_dlc12_lzd_mon_salamander_pack_0",
    "wh2_dlc12_lzd_mon_ancient_salamander_0",
    "wh2_main_lzd_cav_horned_ones_0"
    };

    for i = 1, #units do
    cm:grant_unit_to_character(cm:char_lookup_str(tehenhauin_char), units[i]);
    end;
  • InvisibleInvisible Registered Users Posts: 5
    Thank you for your reply.

    I want to change the whole army composition, i.e. I need also to remove a unit. I think I have to edit startpos.esf? To add and remove units at the start of the campain (ME).
  • InvisibleInvisible Registered Users Posts: 5
    I finally found my modding skills. I used the Assembly Kit "Dave" and altered two startpos tables: units and additional units. Export it and compiled the binaries with "Bob".
  • D4B0SSD4B0SS Registered Users Posts: 191
    Invisible said:

    Thank you for your reply.

    I want to change the whole army composition, i.e. I need also to remove a unit. I think I have to edit startpos.esf? To add and remove units at the start of the campain (ME).

    no need to use startpos.

    LUA is more powerful.

    cm:remove_unit_from_character(string character lookup, string unit key)
    Remove the first instance of the specified unit from the force commanded by the specified character.

    file: wh2_main_skv_clan_mors_start.lua

    ---------------------------------------------------------------
    -- setup second enemy force
    ---------------------------------------------------------------

    function setup_second_enemy_force()

    -- get enemy char for second battle
    local enemy_char_str = cm:char_lookup_str(enemy_secondary_lord_char_cqi);

    -- add customised unit setup
    cm:remove_unit_from_character(enemy_char_str, "wh2_main_hef_inf_archers_0");
    cm:grant_unit_to_character(enemy_char_str, "wh2_main_hef_inf_spearmen_0");
    cm:grant_unit_to_character(enemy_char_str, "wh2_main_hef_art_eagle_claw_bolt_thrower");
    cm:grant_unit_to_character(enemy_char_str, "wh2_main_hef_inf_spearmen_0");

    -- teleport enemy general to starting position for the intro
    cm:teleport_to(enemy_char_str, 526, 67, true);
    end;
  • D4B0SSD4B0SS Registered Users Posts: 191
    Open RPFM and export Scripts folder on disk. then use File Manager to find content in files *.lua

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file