How to make custom troops?

正在查看此主题的用户

DJK83

Sergeant
I was hoping to avoid asking a noob question like this, but after searching through these forums for about 3 hours, I've yet to find all the info I need to add a custom type of troop to the game. I've got the troop trees figured out -- I successfully added a new upgrade option using existing troop types. But when it comes to creating a new type, I just don't have all the information I need. In module_troops.py, I copied and pasted an existing entry and customized it like I wanted, but I'm just not sure where else I'm supposed to be adding references to it.

I mean, there are so many places where the different types of troops are listed, my head is spinning. So if anyone could explain what's required to make a new troop type actually work in-game, I'd greatly appreciate it. In my attempt, it did actually show up as an upgrade option, but when I clicked it, the new custom troop simply disappeared, so clearly there's more that needs to be done. Also, names of existing troop types seemed to be shuffled -- my Swadian Knights turned into Men at Arms, etc.
 
If names get shuffled you probably missed to rename the plural form of your troop?

There isn't much more that needs to be done. All you need is a unique identifier for your troop. In case you don't add additional troops just leave the old entry as it is.

There isn't much else to do with your troops. You can tell the game to make them the reinforcement for your troops but you can also leave that out since it is already defined and with experience they will upgrade those troops into yours automatically.
 
What exactly do you mean by the plural form? And where does that go? Also, by unique identifier, do you just mean it's name? What I was actually trying to do was add a Swadian archer as an additional option when you're upgrading from skirmisher, and would normally be going to crossbowman. So I started by copying the swadian_crossbowman entry in the troops file, and then edited the skills and weapon. I renamed it "swadian_archer", and then added it to the troops tree thing so it shows up as an upgrade. If there are other places it needs to be, I don't know about them. At the moment, I only have it listed twice -- both in modules_troops.
 
You need to start a new game - if you change the order of troops, then the game will not be able to load the proper troops from the older savegame.
 
What do you mean by changing the order? Because I was able to successfully add to the troop tree using existing troops (in my first test, I added the option of upgrading from the Swadian skirmisher to either a crossbowman or a Vaegir archer. That worked fine. I didn't have a problem until I tried to make a new kind of troop.
 
take a look at the top of the module_troops.py file. You'll find a description of all the entries.

There you can see that the first entry is the identifier of that entry so you can call it from all the other files.
Followed by the name for the troop as shown in game and the third entry would be the plural form of the name to be shown in game when there is more than just one unit of that troop.

Make sure if you add an additional entry that it does have a unique identifier (aka the very first entry) and everything should be alright already.

By changing the order he meant the order of the entries in the file. Everytime you change stuff in there you need to start a game from scratch to have it work properly.
 
The savegame does not contain references to troops, but index numbers in the same order as id_troops.py (automatically generated when you compile) and loads the composition for all parties based on those indices. Equipment for those troops may or may not be retained, but names and upgrades are definitely reloaded based on module_troops. So if you have something like the following:
插入代码块:
trp_swadian_crossbowman = 123
trp_swadian_archer = 124
trp_swadian_man_at_arms = 125
trp_swadian_knight = 126
The game doesn't know that 125 used to refer to Swadian Knights - so it loads the information for Man-at-Arms instead. The same now applies to every troop after Swadian Archers from your older savegame. In short, start a new game and everything should be fine.
 
Okay, I see. So there's absolutely no way to add new troops without messing up existing savegames?
 
后退
顶部 底部