Mod info: troops.txt

Users who are viewing this thread

Effidian

Recruit
Since we have our own forum now and this file is getting asked about more and more, I figured I'd separate the info from the attackable peasants thread for easy reference.

Here is a complete entry from troops.txt:
Code:
borcha Borcha Borcha 528 393304 0 1
  52 0 43 0 37 0 40 0 -1 0 -1 0 ....
  7 13 14 4 13
 76 82 84 77 77 77
18016606659543040 4194818 0 
  529 77618924032622 0 0

Disecting this into separate lines:

Code:
borcha Borcha Borcha 528 393304 0 1

borcha = name
Borcha = text
Borcha = text (don't know what the difference between the two are)
528 = unit flags
393304 = location
0 = unit flags2
1 = faction (although this doesn't seem to matter much)

unit flags have the following bits:
0-3: Unit type (0 = male, 1 = female, 2 = undead)
4: Hero
5: Inactive
6: Unkillable
7: Always die
8: Can't capture
9: Shielded
10: mounted (used for movement speed calculation)
11: ranged item required (will get a ranged weapon from item list)
16-23: 2nd upgrade option (index in troops.txt)
24-31: 1st upgrade option (index in troops.txt)

location has the following bits and is used to place an NPC in a town:

0-15: index in sites.txt
16-23: unique number for that site

unit flags2
0-3: Merchant Type (1 = horse, 2 = weapon, 3 = armor, 4 = goods)
4: force helm
5: force boots
6: force armor
7: force horse
8-15: (unused)
16-23: hire base unit (index in troops.txt)
24-31: hire party (index in parties.txt)

Code:
  52 0 43 0 37 0 40 0 -1 0 -1 0 ....

The equipment line consists of 64 pairs of values. The first is an index in item_kinds1.txt, the second is always 0. -1 indicates no item. In the case of troops, the equipment they get seems to be randomized from their list. Otherwise, they'd always have the same thing. Either that or they just use a random item from their equipment. Not really sure.

Code:
  7 13 14 4 13

7 = strength
13 = agility
14 = intelligence
4 = charisma
13 = level

These will get modified based on how many points the unit would get at the specified level (but only upward). These seem to be the minimum values and may exceed what the unit would normally have for the level.

Code:
 76 82 84 77 77 77

Proficiencies:
76 = one-handed
82 = two-handed
84 = polearem
77 = archery
77 = crossbow
77 = thrown

Code:
18016606659543040 4194818 0

18016606659543040 = skill set 1
4194818 = skill set 2
0 = skill set 3

Set 1 and 2 sometimes have values above bit 32. I have no idea what they are for. Not including them doesn't seem to do anything.

skill set 1 is as follows:
0-3: trade
4-7: leadership
8-11: prisoner_management
12-15: first_aid
16-19: surgery
20-23: wound treatment
24-27: inventory_management
28-31: spotting
32-?: ?

skill set 2 is as follows:
0-3: pathfinding
4-7: tactics
8-11: tracking
12-15: trainer
16-19: horse_archery
20-23: riding
24-27: athletics
28-31: shield
33-?: ?

skill set 3 is as follows:
0-3: weapon master
4-7: power draw
8-11: power_throw
12-15: power_strike
16-19: ironflesh

Code:
  529 77618924032622 0 0

529 = hair_start
77618924032622 = face_start
0 = hair_end
0 = face_end
 
I just spent some time with Hair and Face changes so heres how:

borcha Borcha Borcha 528 393304 0 1
52 0 43 0 37 0 40 0 -1 0 -1 0 ....
7 13 14 4 13
76 82 84 77 77 77
18016606659543040 4194818 0
529 77618924032622 0 0


As noted above, the leftmost bottom entry (529) is hair_color/skin/beard/hair_style.

Plug 529 into wincalc and convert to hex, you get 211.
--Leftmost entry would be 0 it just isnt shown here. Hair_color is a 0-4. Black,Brown,Red,Blonde,Grey. Borcha has black
--Second from left is 2. Skin is 0-5. Standard, Blue-eys, wrinkle1, wrinkle2, dark and women have (5)old face. Borcha has wrinkle1.
--Third from left is 1. Beard is 0-6. None, mustache, light beard, none, heavy beard, goatee, mustache. Borcha has a mustache.
--Fourth from left is 1. Hair_style is 0-7. bald, short/wild, short/combed, short/bowl, long, long/tiedup, bald/tail, balding. Borcha has short/wild.

I just made up the names for the textures here but they are in the same order as character creation. I should point out that there may be a higher ranger then ive indicated, I didnt experiment to see if there were hidden or discarded textures.

The next number is 77618924032622 and it records the facial slider bar settings. Plug it into wincalc and convert to oct. Youll get 16 numbers from 0-7. A 0 means slider all the way to the left, 7 is all the way to the right. 3 or 4 is in the middle or so.
 
Nicely done. I wonder what that 3rd and 4th number are for. I'll have to look at those again tonight. I always had assumed they were part of appearance, but maybe not...
 
9: recruitable (?)

By that do you mean when you approach them they say "Can we join you?" like rescued prisoners? Or just in general: there is a possibility that at some point they could be in your party by capture.
 
bloodmerc said:
9: recruitable (?)

By that do you mean when you approach them they say "Can we join you?" like rescued prisoners? Or just in general: there is a possibility that at some point they could be in your party by capture.

I'm not entirely sure, which is why there is a question mark. The bit is set for Borcha, Marnid, and a couple other units that aren't in the game. So, I don't really know what it is for.

All the ones with a ? mean that I'm not sure what they are. Some I'm guessing on because of which units have it set.
 
By popular demand....

How to create an upgrade path.

Let's say you wanted to have watchman branch to either caravan guards or let's say bandits for this example. Here is the first line of the watchman entry in troops.txt.

Code:
watchman watchman watchman 167772160 0 96 8

As mentioned in the beginning of this thread, the first number is the unit flags. We are interested in bits at index 16-23 and 24-31. So, let's first convert the value to hex.

167772160 = 0x0A000000

I added a leading zero to the hex number for clarity (feel free to add as many leading zeroes as you need if it makes it easier for you). Since each hex digit is 4 bits, we want to skip the first 4 hex digits (from the right) to get to the bit at index 16 . Working at this from the left.

0A = bits 24-31
00 = bits 16-23
0000 = bits 0 - 15

If you compare that data with the info at the top of the thread, you see that bits 24-31 are the first upgrade option and bits 16-23 are the second. 0x0A is 10 decimal and if you look in troops.txt the unit at index 10 is the caravan guard.

Okay, so to add the bandit path, you first get the index of the bandit unit, which happens to be 34, and onvert that to hex, which gives you 22. Now replace bits 16-23 with 22.

0A = bits 24-31
22 = bits 16-23
0000 = bits 0 - 15

Put that back together to get 0x0A220000 and convert that to decimal, 170000384. Now just replace the unit flags in the original with your flags:

Code:
watchman watchman watchman 170000384 0 96 8

And there you go. The watchman which has to choose between "good" and "evil". :smile:
 
Okay, I figured out the "hire" screen. It was 1 of the remaining unknown values. "unit flags2"

Its a bit quirky though, so I think there are some issues with the interpretations, but I setup the tournament_master so I could hire river pirates, so I know it works to some extent. The dialog also had "farmers", and I have no idea why that was.
 
The second set of numbers (after the first two entries) on the appearance line appears to be an alternate set so that NPCs of one type can have some variety.
 
After some fooling around the troops file became more interesting tonght. The first and second appearance lines started to seem odd to me when I suddenly realized my troops had more diverse faces than I was scripting them to have. Im pretty sure that the first and second set of entries are the *range*.

One example. I altered a standard swadian set to include a guy with short/neat hair (value 8 ). The other set had a short/wild (value 1). Suddenly I notice a few bald guys with pony tails are filling the swadian ranks (value 6). Still, they all had black hair and mustaches as usual.. the range for that was still unchanged.

Really should have been obvious that there were more than two faces for a unit but the helmets tend to make you over look it. Im not sure if the bone structure of the face (second entry) is also part of a range or two hard and fast entries. Probably a range but havent bothered to check.

Also found out that the info flags for mounted and archery have to do with what equipment will ABSOLUTELY be selected from the inventory. A non-archer flagged guy may or may not have a crossbow to use (that you put in his inventory) but if you flip the archer switch he *will* have it. Im pretty sure the mounted flag does the same for horses in the inventory.

That flag may or may not have AI effects as well but inventory control seems to be the purpose.
 
I figured out some more inventory control stuff.

borcha Borcha Borcha 528 393304 0 1
52 0 43 0 37 0 40 0 -1 0 -1 0 ....
7 13 14 4 13
76 82 84 77 77 77
18016606659543040 4194818 0
529 77618924032622 0 0

Top line, zero entry is what you called unit_flags_2 above. The first 8 bits are more inventory control stuff. Im pretty sure they control whether an NPC is ensured of selecting one of 4 armor related items.

A knight would have 240 in this spot, convert to hex...
Shield?(1), Armor (1), Boots (1), Helm(1), 0, 0, 0, 0.

Archers dont have the helm bit, they may or may not use/take the helms in their inventory. Probably to give them an irregular look. Cheaper units only have the boots flag. This order of shield, armor, boot, helm is also the order things are placed in the knights inventory.

The only odd thing is that what I think is the shield bit doesnt work. The order is right for shield but units with this flipped dont seem guaranteed a shield. Its not horses as thats taken care of elsewhere and would be out of order. Its also flipped on some high level infantry.

I dont really know of a single unit that is guaranteed a shield. If anyone does, let me know. Im assuming for now that this bit is disabled or misunderstood.

This might be a question for Armagan, Im kind of stumped.
 
Actually you came close to it yourself. :smile: It's the horsie bit. The infantry probably isn't affected by it because he didn't have a horse to begin with.

By the way, I am really amazed by the progress you people have been doing. You are doing stuff that would be quite difficult even with the development tools. Way to go! :grin:
 
Heh, damn.

Armagan, any chance you could clue me in as to whether there is a shield bit? I cant seem to find a way to force one.

Thanks.
 
Unfortunately there was no shield bit in version 0.633. In the new version
I have moved all these bits to the main flags and added the shield bit as well, so at least it will be there in the next version.
 
Back
Top Bottom