How to remove some mercs without mod-system?

Users who are viewing this thread

Lyx

Sergeant
Okay, situation is as follows:

- modifying Native Expansion mod
- want to make certain troops NOT appear in taverns as mercs

I know how to use the troops-editor and i also know that supposedly the game starts looking for mercs at "watchman" and stops looking at "end mercenaries" (something like that). So here is what i did so far:

First try: Moved the undesired troops in troops.txt BEFORE watchman. Afterwards fixed affected inconsistencies (changed troop-positions) via troop editor. Nope, they still appear in taverns.

Second try: Same as first, but instead moved them AFTER the "mercenary end"-marker. This still appear in taverns. Yes, i started a new game, its not a savegame issue.

I someway suspect that when a module gets compiled, only the positions of where mercenaries start and where they end in the troops.txt are saved, not the names of the begin- and end-mark itself. If that is the case, then where is that position stored, so that i can change it? Again, i am NOT looking for a way to do this with the module system. The module system is no option, because i made more than enough changes outside of it, for it not being feasible to start anew from scratch, just to fix mercs.
 
Lyx said:
I someway suspect that when a module gets compiled, only the positions of where mercenaries start and where they end in the troops.txt are saved, not the names of the begin- and end-mark itself.
This is correct.

If that is the case, then where is that position stored, so that i can change it? Again, i am NOT looking for a way to do this with the module system. The module system is no option, because i made more than enough changes outside of it, for it not being feasible to start anew from scratch, just to fix mercs.
What you want is update_mercenary_units_of_towns which looks like this in Native:
update_mercenary_units_of_towns -1
6 6 3 1224979098644774912 648518346341351443 648518346341351461 2136 3 1224979098644774913 360287970189639706 360287970189639713 501 3 1224979098644774912 90 1224979098644774913 2136 3 1224979098644774914 3 8 501 3 1224979098644774912 91 1224979098644774914 3 0

The number in red is the starting troop.  If you drop the highest level bits which say "this is a troop" you get the offset in the troop database (in this case, 26 or trp_watchman for the start guy and 33 or trp_mercenaries_end for one past the end guy).  Assuming the mercenaries you want to hack out are contiguously in the beginning or the end of that range, just add or subtract from those two values as necessary and you're good to go.  The important thing is to find the 2136 which is store_random_in_range, always followed by a 3, probably followed by a number starting with 122 and two numbers starting with 360.  If there are more than two 2136s in the NE version, you'll have to do some spelunking to figure out what they did differently.

If the mercenaries you want to hack out are NOT contiguous, you have a difficult choice.  If you try to swap them around, you may screw up code that refers to a given type of troop.  Sword sisters in Native are one such troop since they're specified for tournaments.  If you get this wrong, it is very likely that stuff will break in unexpected ways.  Alternatively,  you can get the module system and write a bit of code to get the structure for a bunch of "if this, then that" kinds of hacks which force the chosen troop ID from one troop to another.  For this to work correctly, you'll need to fill in the troop ID blanks to match the ones in NE which will be tedious, but not impossible, and far less error prone.

While you're in there, you can also crank the number of available mercenaries by hacking up the green and orange values.  Note that they follow the second 2136.

Hope that helps!

ps)  I don't have the latest version of NE, but version 0.570's script does not appear to be different than Native.
 
Thank you for the informative reply. Since the troops are not contigous, i decided to go with a more dirty hack - i simply created duplicates of the troops which i want to keep over those which i want to move out, and then made all the upgrade pointers link to the "originals". Sure, certainly not clean, but works good enough for personal purposes.

I guess someday i should start from scratch, get the NE source, and then only port those modifications which i want to native (which aren't many. I'm not all that interested in adding quantitatively more and bump up complexity for the sake of complexity (items,troops,over-the-top stats)). What i would want to do, is only significant gameplay additions (managing own kingdom, quests, spearwall) and rebalancing of what is already there. But i'm getting carried away here.... thanks again for the detailed info.
 
Well, if i get around to doing this, and merc & co have some reservations about giving out the full source publicly, then i will probably propose to them, that i would create a lightweight variant of NE - that is, without new units, items, factions, npcs (except of advisers), so just vanilla MnB but with own kingdom stuff and spearwall, shieldbash, morale system - and then make the source to that available publicly (so, basically me creating a lightweight variant for them). That way, the source to the full NE would remain non-public, but a lightweight variant of it would be publicly available. Then i'd use that lightweight base for my own mod. But even if all this works out and merc is okay with it, it wont happen anytime soon, because i'm currently too busy with other projects.
 
Back
Top Bottom