Results 1 to 7 of 7

Thread: Is it possible to merge armies together via script?

  1. #1

    Default Is it possible to merge armies together via script?

    I have recently learned from another post that the "move" command used in scripts does not work to send an AI-controlled character into a settlement that already has a garrison. Now I seem to have found that it also does not work to send a general to the same location as another general, be them AI-controlled or player-controlled, and that trying to do so will simply causes the static general to move one tile away from his current tile in order to give room for the newcomer.

    But since there are commands to force armies to move, to attack other armies, and to besiege settlements, I wonder if there is also a command to force two armies of the same faction to merge into one.

    I need this now in order to simulate the march of Stannis Baratheon against Winterfell. His army is split in several small groupings because of the large number of generals he has (every general must start with a separate army of his own), but I would much rather fuse them into a smaller number of larger armies as they approach Winterfell to attack. If they attack in such small numbers they will stand no chance.

  2. #2

    Default Re: Is it possible to merge armies together via script?

    The same happens when you use a multi-turn move to move a character onto a tile that becomes occupied with another army. The move command that you issue in game, which is the same as the 'move' command in script, is only for movement, merging is a separate command that you haven't issued. I don't know of any script command for merging. There is a merge_selected_button but I'm not sure when that's usable. It may be referring to merging units as in 15 + 20 => 35 or tt might just be for agents (princesses have a button to merge into army instead of attempting a marriage mission). Even if there is a merge command, I'm not sure who it would act on - it would be unique as the only script command that acts on units on the strat map instead of characters.

    It's not completely clear what you're trying to do. If Stannis has a bunch of generals with him, wouldn't they lead their own armies anyway? If his faction is AI-controlled, just ensure they're all within a tile of one another and they will always fight together in battle as reinforcements (unless you changed the reinforcement probabilities or limited the number of men on the battlefield in the configs). A 2x2 death ball of generals will always participate in the battle, there's no way to attack one without attacking the other three. I think 4 is the theoretical max you can ensure will engage, obviously you can have more armies in a battle (I guess 9 is the limit without accounting for AI-requested regional reinforcements) but you can always attack the death ball from a different corner to get no more than 4 enemies at once.

    The alternative is that Stannis has a bunch of generals with him in his stack which seems a bit odd to me. Or maybe these characters aren't meant to represent generals but more like minor characters in Stannis' retinue? If that's the case, you could give Stannis some ancillaries representing those characters, and then monitor PostBattle and check if the ancillaries still exist after waiting a few seconds (for death animations to finish, just like in your other thread). If the characters exist somewhere on the map, but their ancillaries don't exist, then kill those characters. It will be a bit odd if these characters are on the other side of the map and yet still die with Stannis at Winterfell, but if you force them to stay nearby, then it would work well even if they manage to avoid participating in the battle. An even simpler solution is to just kill these characters if Stannis dies, but the ancillaries can visually convey their link to Stannis to the player.

  3. #3

    Default Re: Is it possible to merge armies together via script?

    Quote Originally Posted by Callistonian View Post
    The same happens when you use a multi-turn move to move a character onto a tile that becomes occupied with another army. The move command that you issue in game, which is the same as the 'move' command in script, is only for movement, merging is a separate command that you haven't issued. I don't know of any script command for merging. There is a merge_selected_button but I'm not sure when that's usable. It may be referring to merging units as in 15 + 20 => 35 or tt might just be for agents (princesses have a button to merge into army instead of attempting a marriage mission). Even if there is a merge command, I'm not sure who it would act on - it would be unique as the only script command that acts on units on the strat map instead of characters.

    It's not completely clear what you're trying to do. If Stannis has a bunch of generals with him, wouldn't they lead their own armies anyway? If his faction is AI-controlled, just ensure they're all within a tile of one another and they will always fight together in battle as reinforcements (unless you changed the reinforcement probabilities or limited the number of men on the battlefield in the configs). A 2x2 death ball of generals will always participate in the battle, there's no way to attack one without attacking the other three. I think 4 is the theoretical max you can ensure will engage, obviously you can have more armies in a battle (I guess 9 is the limit without accounting for AI-requested regional reinforcements) but you can always attack the death ball from a different corner to get no more than 4 enemies at once.

    The alternative is that Stannis has a bunch of generals with him in his stack which seems a bit odd to me. Or maybe these characters aren't meant to represent generals but more like minor characters in Stannis' retinue? If that's the case, you could give Stannis some ancillaries representing those characters, and then monitor PostBattle and check if the ancillaries still exist after waiting a few seconds (for death animations to finish, just like in your other thread). If the characters exist somewhere on the map, but their ancillaries don't exist, then kill those characters. It will be a bit odd if these characters are on the other side of the map and yet still die with Stannis at Winterfell, but if you force them to stay nearby, then it would work well even if they manage to avoid participating in the battle. An even simpler solution is to just kill these characters if Stannis dies, but the ancillaries can visually convey their link to Stannis to the player.
    What I mean is that there are several actual generals close to Stannis' position, each one leading a small army. Guys like Justin Massey, Hugo Wull, and Harwood Fell, among others. They are named characters, not ancillaries. They are marching together toward Winterfell, as a pack. Then I want them to attack the Bolton armies that are stationed in and around Winterfell.

    My concern is that the number of armies involved is just a bit too large. Not very, but I'd much rather have some of them merging into one, so as to make bigger battles with the largest possible number of soldiers on both sides. After all this is supposed to be an epic battle, not a series of small skirmishes. I could survive with things staying as they are, but that's not ideal.

  4. #4

    Default Re: Is it possible to merge armies together via script?

    It sounds like you're asking if it's possible to have more than 20 units per army, and the answer is no. Even if it were, you can only control 20 units at a time and letting the AI control your allies is... underwhelming at best. Trying to control more than 20 units effectively would be nigh impossible anyway.

    If none of that concerns you, you can still pack a 3x3 square with armies and crash the game with a battle of absolutely epic proportions. Moving and engaging armies in script is trivial, you can even disable auto-resolve. But good luck running that battle on anything short of the Fugaku.

    As far as having all of Stannis' retinue represented in a single battle, your options are to have all of them in his 20 unit army or split them into different armies. Having them all in one army just means you have an army of mostly BG units which, imo, would be very unusual not to mention technically difficult to implement. Or you can cram armies into a 3x3 and engage them in script which is technically trivial to implement.

  5. #5

    Default Re: Is it possible to merge armies together via script?

    Quote Originally Posted by Callistonian View Post
    It sounds like you're asking if it's possible to have more than 20 units per army, and the answer is no. Even if it were, you can only control 20 units at a time and letting the AI control your allies is... underwhelming at best. Trying to control more than 20 units effectively would be nigh impossible anyway.

    If none of that concerns you, you can still pack a 3x3 square with armies and crash the game with a battle of absolutely epic proportions. Moving and engaging armies in script is trivial, you can even disable auto-resolve. But good luck running that battle on anything short of the Fugaku.

    As far as having all of Stannis' retinue represented in a single battle, your options are to have all of them in his 20 unit army or split them into different armies. Having them all in one army just means you have an army of mostly BG units which, imo, would be very unusual not to mention technically difficult to implement. Or you can cram armies into a 3x3 and engage them in script which is technically trivial to implement.
    I'm not asking for a way to put more than 20 units in a single army. I also don't intend to make a battle of absurd proportions. Just joining a few of these armies (not all of them) in order to make them less difuse, if you get what I mean. The total size of the battle will not surpass 10 or 11 thousand soldiers in case I manage to get every man possible into it, which is not even what I want, to be exact.

  6. #6

    Default Re: Is it possible to merge armies together via script?

    It's obvious that I'm still not understanding exactly what you're trying to do in your mod. I'm now envisioning that you have a number (at least 4) of small armies with 3-5 units each which are led by named characters and that you want to merge these armies into a single 20 unit army led by Stannis (who naturally has the highest command level) and then you want to engage this army with a player-controlled army at or near a particular settlement. Again, I don't know of any way to merge armies like this in script. Most battle AIs do a good job coalescing reinforcements on the battle field, so I'd posit that your best bet is to put all of these armies in a 3x3 and let them coalesce on the battle field. A siege battle will be the easiest place to force the battle to take place. It is possible to force a field battle with the player but you have to know where they have a labeled character to engage and that character better be supported by an army so the player has some chance to experience the battle you want them to experience.

    It's still not clear to me how these armies got to the North, or how they get from wherever they started to Winterfell. It sounds like you want them to be marching around separately, under AI control, for a little while and then eventually come together into a single force at Winterfell for a siege or something. Left to the AI's mysterious whims, these armies will go on random walks and you'll end up teleporting them together for an epic scripted battle whether you find a way to merge them or not. If, on the other hand, you're scripting their movements from A to B, then I don't see a problem with just moving them all together to surround Winterfell, or some such, and letting the player decide how to deal with that.

  7. #7

    Default Re: Is it possible to merge armies together via script?

    Quote Originally Posted by Callistonian View Post
    It's obvious that I'm still not understanding exactly what you're trying to do in your mod. I'm now envisioning that you have a number (at least 4) of small armies with 3-5 units each which are led by named characters and that you want to merge these armies into a single 20 unit army led by Stannis (who naturally has the highest command level) and then you want to engage this army with a player-controlled army at or near a particular settlement. Again, I don't know of any way to merge armies like this in script. Most battle AIs do a good job coalescing reinforcements on the battle field, so I'd posit that your best bet is to put all of these armies in a 3x3 and let them coalesce on the battle field. A siege battle will be the easiest place to force the battle to take place. It is possible to force a field battle with the player but you have to know where they have a labeled character to engage and that character better be supported by an army so the player has some chance to experience the battle you want them to experience.

    It's still not clear to me how these armies got to the North, or how they get from wherever they started to Winterfell. It sounds like you want them to be marching around separately, under AI control, for a little while and then eventually come together into a single force at Winterfell for a siege or something. Left to the AI's mysterious whims, these armies will go on random walks and you'll end up teleporting them together for an epic scripted battle whether you find a way to merge them or not. If, on the other hand, you're scripting their movements from A to B, then I don't see a problem with just moving them all together to surround Winterfell, or some such, and letting the player decide how to deal with that.
    In essence you have already answered that it's not possible to do exactly as I intend, but you might like to fully comprehend what I'm trying to say.

    This particular campaign is called "War of the Five Kings, Final Stages" and it begins at a point in which only Riverrun and Stannis still oppose the Iron Throne. Stannis starts near Deepwood Motte with several smaller armies around him, led by his many generals, and it is a two-turn journey from there to Winterfell.

    Because the AI cannot be counted to do what Stannis logically would at this point in the war, I have scripted his armies to spend the initial turns marching against Winterfell if they are controlled by the AI. It doesn't matter whether the player controls Winterfell or not. The move will still happen.

    I need this script only so that the AI will not disperse its armies to random places as soon as the game starts. I need them to go fight the Boltons, and let luck decide who wins. The biggest problem is that Roose Bolton has fewer generals but more soldiers than Stannis, meaning his armies are much more robust and full-stacks. I have tried playing as both sides to test how balanced they are, and I have managed to win in both cases, but only because, as the player, I can afford the luxury of condensing Stannis' armies.
    Last edited by es157; June 24, 2021 at 03:29 PM.

Posting Permissions

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