• Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

WB Coding Change soldiers into sailors (single)

Users who are viewing this thread

Mauromagno Patriota

Sergeant Knight
WBNWVC
Hello everyone, I have a problem with a code, actually, the code works, but only half ... (a friend of Discord made me the code)
I want to convert land soldiers to sailors for naval battles, I have this code that converts them, but in the troop orders panel, the replaced soldiers appear as dead and the new sailors appear as allies, which produces at the end of the battle, in the statistics, the sum of those deaths ..., but when I attack again or leave that battle, I have the same amount of troops, it is as if there had never been a battle. since the new troops do not adhere to the origin team
There is a post with a code that I already tried, but it is from 2009 and it does not work for me.
https://forums.taleworlds.com/index.php?threads/naval-battles.78272/post-2037657
Image
https://www.pinterest.cl/pin/426223552245366288/
Any help is welcome ... thanks
Code:
(ti_on_agent_spawn, 0, 0, [],
[
        (store_trigger_param_1, ":agent_no"),
        (agent_get_troop_id, ":troop", ":agent_no"),
        (agent_get_position, pos22, ":agent_no"),
        (agent_get_team, ":team", ":agent_no"),
        (assign, ":troop_to_use", 0),
        (assign, ":spawned_agent", -1),
        (try_begin), ########## Chile
                (is_between,":troop", tropas_ch1_ini,tropas_ch1_fin),#chile 1
                (agent_fade_out, ":agent_no"),
                (agent_set_visibility, ":agent_no", 0),
                (assign, ":troop_to_use", "trp_marino_recluta"),
            (else_try),############ Virreinato del Peru
                (is_between,":troop", tropas_vp1_ini,tropas_vp1_fin),#Virreinato del Peru 1
                (agent_set_visibility, ":agent_no", 0),
                (agent_fade_out, ":agent_no"),
                (assign, ":troop_to_use", "trp_marino_recluta_esp"),
            (else_try),############ Ejercito de los Andes
                (is_between,":troop", tropas_andes1_ini,tropas_andes1_fin),#los Andes 1
                (agent_set_visibility, ":agent_no", 0),
                (agent_fade_out, ":agent_no"),
                (assign, ":troop_to_use", "trp_marino_recluta"),
            (else_try),############ Alto Peru
                (is_between,":troop", tropas_ap1_ini,tropas_ap1_fin),#Alto Peru 1
                (agent_set_visibility, ":agent_no", 0),
                (agent_fade_out, ":agent_no"),
                (assign, ":troop_to_use", "trp_marino_recluta_esp"),
            (else_try),############ Provincias Unidas
                (is_between,":troop", tropas_pu1_ini,tropas_pu1_fin),#Provincias Unidas 1
                (agent_set_visibility, ":agent_no", 0),
                (agent_fade_out, ":agent_no"),
                (assign, ":troop_to_use", "trp_marino_recluta"),
        (try_end),

        (try_begin),
            (gt, ":troop_to_use", 1),
            (set_spawn_position, pos22),
            (spawn_agent, ":troop_to_use"),
            (assign, ":spawned_agent", reg0),
            (agent_set_team, ":spawned_agent", ":team"),
        (try_end),

        (try_begin),
            (gt, ":spawned_agent", -1),
        (try_end),
]),
 
Last edited:
Top Bottom