OSP Kit SP [WB] Prebattle Deployment Kit v0.77 Beta

Users who are viewing this thread

This is my second step in an attempt to respond to the various comments and suggestions around this community to implement pre-battle setup and options (cf. calls for a "deployment phase"). The goal here is to cater to those who want an added level of strategy and control in the planning of their battle engagements--or, more pointedly, to allow the player to choose who will join them in battle, rather than the cryptic mix provided by the engine.

The Prebattle Deployment kit adds an option to the pre-battle menu that the player is presented with during any field encounter with an enemy party. With Tactics at level 2 or higher in the party, the player can choose to "Plan who will join you in battle". To allow for its function, a "Record Battle Size" menu option is also added to the Camp->Take an Action menu. Here the player must enter the battle size as set it is set in options (since the commands do not allow access to options settings from within code). This simply records the Battle Size, but does not impact the settings of the game. It only needs to be done once (unless the player edits their battle size setting) and then this will be stored in the savegame.

The Plan Deployment presentation lists each troop type that is in the player's party in the order they are listed in the Party Window. For each troop type in the party a number box appears, allowing a selection from 0 to the number of non-wounded troops of that type. The player can set the exact number of each troop that he/she wishes to spawn at the start of the battle. The presentation displays the number of troops that would be available to the player and holds the player's selection to that limit. Finally, across the bottom are currently three options: Scrap All--clear all number boxes to 0; to Reassess--return to the encounter menu without setting the deployment; or to Ready Troops--save this deployment and return to the encounter menu.

The selected troops will be the only troops to spawn with the player at the start of the battle, but the remainder will be available in reinforcement waves. The method used currently maintains the number of ready-to-upgrade troops. While the exact amount of XP gained by troops in their progression toward the next level cannot be stored, the player should notice minimal changes to his/her party.

Screenshots Galore
recordbattlesize.png
encountermenu.png
[spoiler="Plan Deployment" Screen]
deploymentscreen.png
[/spoiler]
setdeployment.png
inbattle.png
Note in the screenshots above that the troops at the top of the Party Window (the mounted and ranged troops) and thus Natively most likely to appear in battle are set to 0 in this test; they do not appear at the start of the battle.

Code
Considering its size, I opted to not place the code in spoilers here. Instead it can be downloaded from the M&B Repository: Repository Kit Download.

The following are modified:
  • 2 triggers added to lead_charge to edit the player's party
  • 1 script to get more information during the battle advantage calculation
  • 1 menu option added to camp action
  • 2 menu options added to two menus (simple_encounter and join_battle)
  • 1 condition operation added to the start of simple_encounter and join_battle
  • 1 condition operation added to all menu options of simple_encounter and join_battle
  • 2 presentations added
  • 9 constants defined
  • 0 globals added; globals from Native presentations are used sparingly
  • 0 slots added; party slots 47-51 (for centers) are used for "p_main_party", and troop slots 37-38 (for ladies) are used for soldiers

Quasi-technical discussion of method:
The presentation records the number in the troop's number box to a troop slot. Before the mission begins, a 'before mission start' trigger in lead_charge fires and checks the value of the troop slot of each troop-type in the player's party against the number of that type of troop in the party. Any "extra" troops are removed from the player's party just before the spawn.

The engine can only spawn from what is available to it and since the player's party is now ONLY the troops that the player wants in the first round, it is forced to spawn those troops.

After the spawn, an 'after mission start' trigger fires and uses the backup copy of the player's party (which is used to calculate casualties natively) to recall how many troops of each type SHOULD be in the party total, and adds the removed troops back to the players party so they can appear in reinforcement waves.
Currently, I am using the first 31 registers as the 'names' of the number box overlays used in the presentation. As only 60-some registers are defined, this limits my ability to expand the system to either more than one battle round, or to including more troop types. I'm unsure which way to go...my hunch is that the vast majority of player parties do not carry 30 unique troop stacks even if they have 10 or so companions, in which case I can add a second round, but I may be wrong.

The alternative, of course, is to create a huge number of new global variables (100 or so per round) to accommodate all of the possible troop types. So many globals seems unwieldy..and renews my frustration at the need to use global variables just to go between tuples of the same presentation.

Somebody helped greatly in clearing up my understanding of overlay reference IDs. Using troop slots to store the reference ID shortened the code exponentially and now will allow for all troops type in the party (regardless of number) to be accessed and opens up the possibilities for doing multiple rounds in the future.

As always, comments, questions, criticisms, suggestions are more than welcome.

Checklist to Version 1
  • Bug testing and squarshing
  • Wrap for installation via sphere's ModMerger
  • Move to M&B Repository
  • A version merged with Prebattle Orders
  • Expand use to sieges, etc.
  • Allow set battle size presentation to be called from deployment screen if battlesize=0
  • Try for ways to not lose stack XP (troops waiting for upgrade)
  • Cleaning up the presentation
  • Expand the number of troop types available (from 30 to 60)
  • Add ability to specify deployments for further reinforcement waves?

v0.77
  • Bugfix for presentation truncating the player's party list
v0.75
  • Bugfix for 'undead' troops becoming available during multi-round battles
  • Bugfix for correct number of troops available to be deployed, based on currently wounded party members
v0.7
  • XP for "ready-to-upgrade" troops is maintained
v0.6
  • Can accommodate as many troop types as are in the player's party
  • If the player hasn't recorded a battle size, will call the Record Battle Size presentation before opening the Plan Deployment presentation
  • Battle Size menus renamed from 'Set Battle Size' to 'Record Battle Size' to more accurately reflect their function
  • Cleaned up and exponentially shortened the presentation code
 
WOW  :grin:  Caba`drin you are really doing some brillant work with the coding , great work cant wait to see what you come up with next  :grin:
 
Currently, I am using the first 31 registers as the 'names' of the number box overlays used in the presentation. As only 60-some registers are defined, this limits my ability to expand the system to either more than one battle round, or to including more troop types. I'm unsure which way to go...my hunch is that the vast majority of player parties do not carry 30 unique troop stacks even if they have 10 or so companions, in which case I can add a second round, but I may be wrong.
Registers, like any other variable you use with objects only holds a reference id of the overlay being created - you can easily use slots on any object to store those values - performance won't be too much of an issue since the player will spend time changing the values anyways and you can simplify your code.

Arch3r said:
Ooh sounds cool, btw, how did you make the 4th group (spears)? Did it require lots of code or just adding a class/group?
It's one of the player-definable groups from the party menu.
 
Somebody said:
Currently, I am using the first 31 registers as the 'names' of the number box overlays used in the presentation. As only 60-some registers are defined, this limits my ability to expand the system to either more than one battle round, or to including more troop types. I'm unsure which way to go...my hunch is that the vast majority of player parties do not carry 30 unique troop stacks even if they have 10 or so companions, in which case I can add a second round, but I may be wrong.
Registers, like any other variable you use with objects only holds a reference id of the overlay being created - you can easily use slots on any object to store those values - performance won't be too much of an issue since the player will spend time changing the values anyways and you can simplify your code.

Thanks, Somebody. Revised the code accordingly and uploaded v0.6, now working with as many troop types as the player has in his/her party and ensuring a valid battle size is set before opening the Plan Deployment presentation.

EDIT: Version 0.7 uploaded with edited constants and mission_template triggers in order to maintain the number of "ready-to-upgrade" troops through the battle.
 
EDIT: Whoops, sorry for this over two weeks old necro.  :neutral:

I added the code to the source files of Diplomacy, trying to get it ingame in my setup. I think I succeeded but may have made a mistake since this was my first time using the module system.

The deployment works half though, I could choose the amount of soldiers I wanted to deploy, but after 10 seconds in the battle or so the ones I left behind joined as reinforcements. This might be because I did not reach the maximum amount of soldiers I could deploy, hence the minimum amount necessary for a reinforcement wave was reached instantly. Also, after using the menu the first time, it didn't show up at the start of battles afterwards?

It's still very impressive though, I hope you can quickly solve these glitches! (if they are not my fault, that is)

I used the first link in your OP and not the merged files, maybe I got an outdated one?
 
Captain_Octavius said:
EDIT: Whoops, sorry for this over two weeks old necro.  :neutral:

I added the code to the source files of Diplomacy, trying to get it ingame in my setup. I think I succeeded but may have made a mistake since this was my first time using the module system.

The deployment works half though, I could choose the amount of soldiers I wanted to deploy, but after 10 seconds in the battle or so the ones I left behind joined as reinforcements. This might be because I did not reach the maximum amount of soldiers I could deploy, hence the minimum amount necessary for a reinforcement wave was reached instantly. Also, after using the menu the first time, it didn't show up at the start of battles afterwards?

It's still very impressive though, I hope you can quickly solve these glitches! (if they are not my fault, that is)

I used the first link in your OP and not the merged files, maybe I got an outdated one?
Heh. Didn't think this thread was "dead"...nor that two weeks constituted a necro, but such is life :smile:

As for what you've described, you're right that I haven't worked to suppress the reinforcement waves. If you select fewer troops than what would otherwise trigger a reinforcement, you'll trigger a reinforcement at the first possibility, or about 10 seconds into the round. I didn't think it was appropriate to start messing with that too much...though I suppose there could be an option when you set your deployment orders to ask your troops to hang back either for a time or suppress reinforcements all together. I'll consider that.

If you've installed the code correctly, there shouldn't be any issue about the menu appearing after being used once. I've tested it multiple times in succession on a number of occasions.

And, no, the non-merged version is as up-to-date as it is at the moment. I've run into some hang-ups extending it to siege battles, otherwise an update with that would be up. Also, I'm not clear on how many reinforcement waves to allow the player to specify or when that will approach the appearance of daunting tedium as opposed to "useful feature."
 
I'd like to ask whether the seperate spear class is implemented in this battle kit, if not that, whether you made them yourself, if not that, where to get it.:grin:

Does it include all troops who have spears (and may have another weapon) or is it made up of exclusive spear troops?
 
Thanks to lucky lancer, a bug whereby troops who should have been dead would still be usable in multi-round battles has been fixed. Another bug where the Deployment screen would display more troops of a given type than was currently available was also found and fixed. The OP is updated and a new version has been uploaded to the Repository.

SMST said:
I'd like to ask whether the seperate spear class is implemented in this battle kit, if not that, whether you made them yourself, if not that, where to get it.:grin:

Does it include all troops who have spears (and may have another weapon) or is it made up of exclusive spear troops?
This can be done by the player without this mod--it is a Native feature. In your Party window, click on the box that says what class the given troop type is. There you can assign that troop to any one of 9 different categories--the 3 normal Infantry, Archers, Cavalry plus 6 more than the player can add and name as they wish. I typically divide my infantry between heavy infantry and spears, my cavalry between heavy cav and horse archers, and then include at least two groups for my companions--one for the fighters and another for the support staff that should stay out of the fighting.
 
Caba`drin said:
This can be done by the player without this mod--it is a Native feature. In your Party window, click on the box that says what class the given troop type is. There you can assign that troop to any one of 9 different categories--the 3 normal Infantry, Archers, Cavalry plus 6 more than the player can add and name as they wish. I typically divide my infantry between heavy infantry and spears, my cavalry between heavy cav and horse archers, and then include at least two groups for my companions--one for the fighters and another for the support staff that should stay out of the fighting.

I see. It is that Warband feature. I do not own a full Warband version, so I didn't venture that deep into the game's systems. Thanks!
 
If anyone is watching this, how hard it is to modify PBOD not to use WSE?
Would it take a week or a couple of hours?
If nothing else, I guess I'll find out in the next few days, so you can ask me later. :smile:

EDIT: Ah, I see now, too many PBOD threads, and this is not the right one.
An answer to my question:
Caba`drin said:
dia151 said:
uuhmm, the front page is a bit confusing, so whats the latest non-wse version that i can merge with module system of my own mod?
Caba`drin said:
*For any worried about compatibility with non-WSE mods, the non-WSE version will continue to receive bugfixes to those core features as necessary (and as possible without WSE): non-WSE installer (with kit)--v0.92
It's also clearly labelled on the Nexus.
 
Back
Top Bottom