Assigning centers to lords and factions

Users who are viewing this thread

Is there any way to determine, just by looking at the scripts.txt, what faction and/or lord gets what center (town/castle/village)?

I know how it looks in the module_scripts.py but I'm limited to editing the txt-files in this particular instance.

In troops.txt for example each troop is assigned a unique ID by adding the troop ID to 360287970189639680, and I thought it might be the same for centers, but I cannot find any similar thing using a combination of party ID and troop ID to determine which lord gets which center or centers. For this I assumed that the relevant code would be somewhere after give_center_to_lord -1 or start_give_center_to_lord -1.

I'd be very grateful for any assistance.
 
Alecci said:
Is there any way to determine, just by looking at the scripts.txt, what faction and/or lord gets what center (town/castle/village)?
If a mod is using Native-based system to allocate fiefs, then it's 50/50. Some centers are allocated directly, others according to some internal weighting scheme, with a bit of randomization thrown in.

Alecci said:
In troops.txt for example each troop is assigned a unique ID by adding the troop ID to 360287970189639680, and I thought it might be the same for centers, but I cannot find any similar thing using a combination of party ID and troop ID to determine which lord gets which center or centers. For this I assumed that the relevant code would be somewhere after give_center_to_lord -1 or start_give_center_to_lord -1.

I'd be very grateful for any assistance.
script_give_center_to_lord is called when it's already been determined what center is being given to what lord, this script does the actual work but the values are determined elsewhere. You should look to (call_script) operations with script_give_center_to_lord used as first parameter (it will also have script tag added, which is equal to 93674872249306316:cool:. So if script's ID is 230 (like in Native) you'll need to search for operations starting with: 1 4 936748722493063398
 
Many thanks for your input Lav, it's very much appeciated. I must say I'm quite surprised that the allocation of fiefs/centers to factions and lords are done elsewhere.

As you said, the allocation is partly determined and partly random - I'm after the determined bit and being able to editing this in a situation where I cannot use the modules but must do it through the txt files.

I would like to assign some certain fiefs/centers to certain respective lords, and perhaps my question should simply have been how to accomplish this?

Once again, a heartfelt thanks for taking your time to answer my question.
 
Alecci said:
Many thanks for your input Lav, it's very much appeciated. I must say I'm quite surprised that the allocation of fiefs/centers to factions and lords are done elsewhere.

As you said, the allocation is partly determined and partly random - I'm after the determined bit and being able to editing this in a situation where I cannot use the modules but must do it through the txt files.

I would like to assign some certain fiefs/centers to certain respective lords, and perhaps my question should simply have been how to accomplish this?

Once again, a heartfelt thanks for taking your time to answer my question.
Well, generally, even if you don't have module source code, for as long as the mod is based on Native you can safely assume that the basic framework will be the same. That is: centers at the start of the game will be allocated in script_game_start by a series of calls to script_give_center_to_lord, followed by a single call to script_assign_lords_to_empty_centers. So first of all you must check if the center you are interested in is allocated directly or not. If it's allocated directly, it's just a question of finding the matching call_script operation and replacing lord troop reference with the one you want. If it's not among the centers distributed directly, then you'll have to insert a new operation to script_game_start. Each operation is 6 numbers, first three are easy to determine (see my previous post), followed by two reference numbers of center and lord respectively, and finally a single zero (it is a flag which tells the script_give_center_to_lord whether or not some garrison needs to be added, but at the beginning of the game starting garrisons are generated in another block of the code). So you'll need to insert your own operations, before the call to script_assign_lords_to_empty_centers. And for each operation that you have inserted this way, you must increase the counter of operations in script_game_start - it will be the first number in the same line, and it should be 675 for Native.

Of course, the potential to screw the code with this approach is quite high, so backup and beware. :wink:
 
Back
Top Bottom