OUTDATED; FOR 0.711 & BEFORE.
OK, now that we have new mod tools & Thorgrim's marvelous map editor, everybody keeps asking how to add new towns.
I've been working on a mod on the Lombard Leagues. The following is what I've been doing and it works. (as an addendum, I throw in how I've been giving the town to a new faction).
It is just enough to get a decent town up & running. It is a bit long-winded, but until someone comes up with a better scheme (or can reduce all this to some editor tool), it works.
Note: This is a revamped version of an older primer.
This version is complete & working
----------------------------
Primer for New Towns
===========================
As a driving example, say I want to add a new city (call it "Milan") and perhaps give it to a new faction (call it the "Guelfs").
Step 1: Back up everything, create your module, etc. I presume you've already done this?
Step 2: Create scenarios for your town. Go to the SceneObj folder under your module. So copy & paste five scenario files and rename them:
scn_milan_castle.sco
scn_milan_center.sco
scn_milan_merchant.sco
scn_milan_smithy.sco
scn_milan_tavern.sco
If you want to add more cities (Bologna, Treviso, etc.), just do the same for each.
Step 3 (module_game_menus.py): When you reach a town on the map, the menu opens up. Now we must specify the entries on the game menus.
Open up module_game_menus.py. Adding your city's menu is a simple copy & paste job, e.g. copying rivacheg's menu, then pasting it at the bottom & changing it to Milan.
Make sure you change your scenes so that they match the titles you gave your .scn files, etc.
(It is recommended you paste all your new entries after the halmar entry).
(You can also adjust price for goods here if you want at this point -- that's the second line. But best leave that for the later "mopping up" stage.)
Step 4 (module_scenes.py): Now we must generate scenes, linking the menus to the actual scenarios & access stuff.
This is just another cut & paste job. Open module_scenes.py, and copy and paste some scene and substitute for the name of the relevant city. e.g. copying & pasting rivacheg, and then subbing for milanese terms.
Don't be alarmed about sargoth_center & thirsty_lion. These are in practically every scene after sf_indoors. Don't change those. Just change from "rivacheg_merchant" to "milan_merchant", "rivacheg_smithy" to "milan_smithy", "rivacheg_merchant" to "milan_merchant" and "willows_tavern" to "milan_tavern" (the names of the taverns are always weird).
Pretty straightforward. Do so for every new town.
Step 5 (module_factions.py): If you want to give your towns to a new faction, keep reading. Otherwise skip to Step 6.
Suppose we wanted to give Milan to the Guelfs. First, you need to create a new faction ("Guelfs"). Open modules_factions.py. There is a list of factions. So, if you're creating a new faction, copy & paste some other faction, adjust its name and relations.
(It is recommended that you should paste your new factions at the end, after slavers.)
e.g.
(the negative terms relating to outlaws, vaegir caravans & dark knights, means that Guelfs are hostile to those factions.)
Done? OK.
Step 6 (module_parties.py) - mercs Next open up modules_parties.py. You'll see that there is a cluster of "mercs" followed by a cluster of cities. Start with the mercs. Mercs are the types of troops for hire available at the city's tavern.
Copy and paste a merc entry and make the changes, e.g. supposing we copy from rivacheg's mercs:
to Milan:
Notice that besides the name ("milan_mercs"), we also changed the faction (to fac_guelfs).
[Note: We also changed the type of troops from "trp_vaegir_peasant" to "trp_guelf_peasant. Do this only if you plan to create a new class of warriors called "guelf peasants". Otherwise, give your new town Vaegir peasants or Swadian peasants or neutral farmers or, heck, Dark Knights if you want. List of troops are in module_troops.py.]
You must add a mercs line for every city.
For consistency with the constants file, it is necessary to paste the merc lines lined up with factions, i.e.
(i) for new Swadian city, add mercs line just below uxkhal_mercs and above reyvadin_mercs
(ii) for new Vaegir city, add mercs line just below halmar_mercs and above zendar.
(iii) for new faction (Guelfs), add mercs line below halmar_mercs (or last vaegir mercs) and above zendar city line.
Step 7 (module_parties.py - towns) Now it is time to add the cities themselves. Again, open module_parties.py. Look at the list of cities and copy & paste an entry and make the relevant changes, e.g. suppose we copy rivacheg:
and paste it and change it to Milan as follows:
Let me explain what each change does:
(i) the first "milan" is just the p-reference (it will come up as p_milan in the raw txt files).
(ii) the second "Milan" is the actual name you'll visibly see used in the game.
(iii) the third "milan"is a reference to your menu entry for Milan in the module.game_menus.py (i.e. it basically says then when your party reaches Milan on the world map, it goes to "milan" menu).
(iv) fac_guelfs is the faction of the town (it will shine underneath the name on the world map) (of course, you can keep it fac_swadians or fac_vaegirs or fac_neutrals or whatever).
(v) the (30, -1.5) are the coordinates on the world map. I changed them from (13,21) to (30, -1.5). Just a hunch. Don't worry if you don't where the coordinates are. We'll fix it later with the map-editor. Just make them something slightly different for now. (Note: they cannot be greater than 70!)
(vi) The last entry ("trp_vaegir_knight") actually mystifies me. I don't know what this means exactly or why it's there, but I just left it unchanged and hoped for the best. This is not the mercs. I think it is actually just a reference to a "face" generator of the troops-for-hire (using vaegir facial characteristics), but don't quote me on that. It doesn't seem to affect anything much anyways.
Now do a similar entry for every town. Again, for reasons you'll see later, it is necessary to keep them clustered by faction, i.e.
(i) for new Swadian city, add new city line just below uxkhal and above reyvadin
(ii) for new Vaegir city, add new city line just below halmar and above salt_mine.
(iii) for new faction (Guelf) city, add new city line below halmar (or last vaegir city) and above salt_mine city line.
I can't emphasise this too much: make sure every new Guelf city is above the Salt Mine entry.
[Addendum: if you want to add new/extra points for bandit spawns, this would be the time to do so. Copy & paste a bandit line at the very bottom of module_parties.py, and adjust the title (_1, _2) & coordinates, e.g. you can have:
Will create three mountain bandit spawn points (slightly separated from each other). Don't worry about coordinates for the moment (just differentiate slightly), as we will fix them with map-editor later. (again, I suspect the river pirate reference is just the base looks of the mountain bandit faces. I don't know)
Step 8 (module_troops.py) Now, time to create some people for your new town. Open the module_troops.py. There are four people we must create: count, tavernkeeper, merchant & armorer. (I could also create guelf toops here, but I shan't detail that in this primer). Let's go one at a time:
(A) Count Let's give Milan a count. Look to where the counts are clustered in the module_troops.py file. (easy to find: just search for "king_harlaus"). Then just copy and paste the count and adjust the entry:
The first entry ("count_milan") is just a mnemonic reference to be used in dialogues & quest files.
The next two are his proper names (Why twice? Well, all "troops" in this file have their proper names in a singular form (Guelf knight) & a plural form (Guelf Knights). For individual NPCs, plural form is obviously redundant, so you must repeat the singular form twice; he will appear on screen as "Count Beccaria").
Make sure you put him in the Milan castle scene (scn_milan_castle) and you give him the right faction (fac_guelfs). The rest you can ignore at this stage (clothes, physical appearance numbers, etc.)
Important: try to keep all counts clustered by faction: all Swadian counts together, followed by all Vaegir counts, followed by all Guelf counts, etc.
Definitely try not to post any new NPCs above the count line. That seems to cause problems.
(B) Armorer
Armorer cluster follows the counts. Just do the same, copy & paste:
Again, just mnemonic reference (milan_armorer), two proper names (Landulf) for the nice fellow, his scene (milan_smithy) and his faction (fac_guelfs).
Again, it is useful to keep armorers clustered by faction all in the same place.
(C) Weaponsmith
Weaponsmith follows the armorers. Again, just do the same copy & paste:
Again, mnemonic reference (milan_weaponsmith), two proper names (Theodit), his scene (milan_smithy) and his faction (fac_guelfs) are the only things you need to change. Again, keep the weaponsmiths clustered by faction.
(D) Tavernkeeper
Well, you know what to do:
Basically the same changes. Make sure of scene & faction, keep these clustered by faction, etc.
(E) Goods Merchant
Again (yawn):
Same stuff. Except don't change faction here. Leave it commoners.
Also: Yes, you don't need to group them by faction since they don't have any, but it won't kill you to be consistent. But make sure all your new merchants in the module_troops.txt should be below zendar_merchant & above zendar_chest.
A few troubleshooting notes:
(1) Notice all the people are fac_guelfs, EXCEPT the hoods_merchant, who's faction is commoners!
(2) Notice armorer is in entry point (1), the weaponsmith in entry point (2) at the milan_smithy.
(3) To make them female, just insert a tf_female note at the point: "tf_hero|tf_female|tf_is_merchant", etc. But since I ain't adjusting faces, it is best to just copy an existing female, lest you end up with a very masculine-looking woman
(4) Make sure that for armorer, weaponsmith & goods_merchant the note "tf_is_merchant" is there, otherwise they won't sell you stuff. And make sure it is not on the count or tavernkeeper (otherwise they'll try to sell you their clothes! )
You will have to adjust dialogues so that these new people say the right things to you. That's the next step.
Step 9 (module_dialogs.py): OK. You've created your fellows. Now let's make 'em talk the right talk & walk the right walk. We go through each in turn:
(A) Count talk Open module_dialogs.py and search for the count cluster (tip: search for "king_harlaus"). Cut & paste a line for your count, e.g.
Note I am using the earlier mnemonic reference (count_milan), not his proper name, here.
Again, best to keep these lines clustered by faction (Swadian counts together, Vaegir counts together, Guelf counts together). I don't think it makes a difference, but try being consistent.
Notes:
-- The "$player_relation_to_guelfs" line is if you're having your new faction (guelfs) give out quests of their own (a bit complicated and will go beyond this primer). If not, just omit it.
-- if adding a new Swadian or Vaegir city, make sure that line is appropriate, i.e. $player_relation_to_swadians for a new Swadian town, $player_relation_to_vaegirs for a new Vaegir town.
And you're done. If Milan is a Swadian or Vaegir city, it will participate in the Swadian/Vaegir quests racket. If Milan is Guelf city, well, then, I'll let you figure out for yourself how to have your new faction operate its own quest system. It's a bit more complicated. (I might make a quest primer at some point)
(B) Armorer & Weaponsmith talk. These guys don't have anything interesting to say. They already talk the right talk. So don't need to do anything about them in module_dialogs.py.
(C) Tavernkeeper talk Again open module_dialogs.py and search for the tavernkeeper cluster (tip: search for "#Tavernkeepers").
Copy & paste line & make changes:
Note the only thing that changes is that the tavernkeeper is renamed to "milan_tavernkeeper" and mercs renamed to "p_milan_mercs". The latter is a reference to the troops he'll have for you to hire. Make sure you've already done the mercs adjustment in Step 6 above!
Again, best to keep these lines clustered by faction & together.
(D) Goods_merchant talk Again open module_dialogs.py and search for the goods merchant cluster (search for "trp_zendar_merchant").
Copy & paste line a line & make changes:
So here, you just need to rename trp_rivacheg_merchant to trp_milan_merchant. Again, try to keep them pasted in that cluster consistently for the heck of it.
(Note: Remember the goods merchant dialogs for the town info (what do you buy/sell?). Really you should wait to adjust that after you've mapped your country out with the map editor and thought about the economy a little bit. See the "Mopping Up" section below)
Step 10 (module_constants.py) Now it is time to set the constants. This is the tricky bit. If you've done everything consistently in clusters & such, this should be smooth.
Open module_constants.py. You'll see several clusters of numbers.
(A) Towns Ignore the first two clusters, concentrate on the third (Swadian towns, etc.) Adjust this as follows:
(Note: The begin command is inclusive, the end command is non-inclusive. So when going through Swadian town list, you're telling the motor that the first town to consider is Sargoth, the last town to consider is the one right before Reyvadin.)
What's this about? It sets the range for triggers (which we'll do next). Remember, when a Vaegir Count tells you to capture a Swadian nobleman going from town x to town y, i'td better be that towns x & y are Swadian. Also, if a goods merchant wants you take a caravan or delivery to another town z, it had better be that town z is not the salt mine, or the four-ways inn or, worse yet, a spawn point (its happened to me!).
So you may want to open up your module_parties.py file to be sure that all the Swadian towns (and only Swadian towns) sit between the sargoth entry & the reyvadin entry. Similarly for Vaegir & Guelf towns. If you created more than one Guelf city, all guelf city entries in the module_parties.py file should be within that range.
Make sure the generic towns begin/end includes all and only towns with tavernkeepers within its range (a merchant needs to send stuff to a tavernkeeper).
Make sure it is right! If you constructed your module_parties.py properly like I told you that should be the case. If not, fix it and make it so.
(B) The next cluster gives you the number of Swadian towns, the number of Vaegir towns & you're going to add the number of Guelf towns (necessary for the random number assignment) e.g. suppose I added two Swadian towns, two Vaegir towns and two Guelf towns. Then I'd adjust the constants to:
(C) Next come the merc parties. Again, make sure you get the ranges right. Should be something like:
(note: double check with the module_parties.py to make sure that these ranges match. It ends in "p_zendar" since the last merc party should be just above the first city entry (Zendar) in the module_parties.py file.)
(D) Armor_merchant, weapon_merchant and goods_merchant ranges in the constants should be checked against the module_troop.py file. Open that and make sure they're right. If you did what I told you to do, it should be OK and you don't really need to change anything here. If not, fix the troops file so that it is.
(E) Finally, towards the very bottom there is a list of spawn points.
Remember I said you could add a few more spawn points in the module_parties.txt. Well, if you did, you've got to adjust the number here.
OK? So that's all I want to say about the module_constants.py folder. It is important you get this right, or else really weird sh*t will start happening.
Step 11 (module_triggers.py Ok, we're nearly there. If you didn't create a new faction, skip to Step 12. If you created a new faction, read this.
We need to make sure our tavernkeepers replenish their troops-for-hire. You only need to worry about refreshing tavernkeepers only if you created a new faction. Since we did (Guelfs), let us proceed.
(i) Open up module_triggers.py and scroll down to "#Refresh Tavernkeepers"
(ii) copy & paste a string, adjusting it akin to the following:
It basically like the one for the Swadians & Vaegirs. Note the only things that changed are the (a) range set (guelf_merc_parties_begin, gulf_merc_parties_end) and (b) the types of troops hired (trp_guelf_peasant & trp_guelf_footman)
If you did your constants right, (a) isn't a problem. What about (b)? Who are these trp_guelf_peasant & trp_guelf_footman guys? Well, I created them in the module_troops.py file -- gave them armor, features & stuff (should be self-evident how -- ain't going to explain it here). If you don't want to bother creating new troops right now, easiest just make the guelf mercs like the zendar troops, i.e. insert trp_townsman and trp_watchman in the lines above instead. You can fix it up later when/if you design your own troops. Of course, you could have different troops for hire -- say dark hunters & dark knights. )
OK, THAT'S IT FOR NOW.
Step 12 (build_module.bat) Save all your .py files. Run build_module.bat. Look for any errrors in the output.
If there are any, go fix them before you proceed. THIS IS IMPORTANT. You don't want to use the map-editor on a crappy parties.txt file and be forced to do it all over again.
Step 13 (Thorgrim's map editor) Your town is ready. But your new cities (& new spawn points) aren't in the right place probably. Time for playing with the map-editor and putting your cities where you want them to be.
Warning: DON'T PROCEED WITH MAP-EDITOR until you're sure the parties.txt generated by the .bat is right, i.e. the mercs, city & spawn point entries are all there and in the right order. If not, stop and go back to Step 12. If everything is hunky-dory, it's playtime.
Personally, I'd recommend using the Map Editor on your "native folder" rather than your module folder. Why? Because if you work with the module folder, then anything you change in the parties.txt with the map editor is going to be ovewritten whenever you run build_module.bat again. (And you will run it again). You'll lose all your changes and pull your hair out.
So, the best procedure is as followS:
(A) First, back up the map.txt & parties.txt file of your native folder (the original .704 one)
(B) Transfer a copy of the new parties.txt (the one just created for your mod by the .bat) from your module folder to your native folder.
(C) Open up Thorgrim's map-editor, making sure you're working on the native folder rather than the module folder.
These steps taken, you'll see that all the new cities and spawn points appear on the map. Move them around to your heart's content.
When you're finished, save & exit the map-editor. Now, the parties.txt in your native folder is the "proper" one, so transfer a copy of it to the module folder, overwriting whatever parties.txt was there.
Important: Again, be sure to keep a copy of the final parties.txt you map-edited in your native folder at all times!!! (or somewhere safe, not in your module folder) You're bound to run the build_module.bat again in the future and you don't want that file to be overwritten by the .bat-created parties.txt.
[If you want to be triple secure, you can do the obvious: open up the map-edited parties.txt & open up the modules_parties.py. Carefully (& painstakingly) transfer the coordinates for each damn city & spawn point (incl. the main party starting position) from the map-edited parties.txt to the modules_parties.py. That way, in the future, when you run the build_module.bat, even if it overwrites, it will create something very nearly like you want it. But for lazy bums like me -- and those who are always fiddling with their maps -- keep at least a copy of the map-edited parties.txt out of the module folder.]
Step 14 (Mopping Up)
One more adjustment -- the town info & economy. This could be done before, but I preferred leaving it until you'd used the map-editor to map out & design everything where you want it to be. Now it is time to give some thought to the economy, where you have special prices for goods. After designing your town, decide which good is especially bought & sold in which town.
Suppose you decide your new town of Milan is going to sell tools cheap & buy wine expensively.
(i) Open module_game_menus.py
(ii) search for Milan's menu entry. Adjust the reset price line rates to something like:
and you're done. You can also readjust the prices for all other towns as you wish the economy of your mod to be.
(iii) Once you get all the prices mapped out, if you want the town merchants to inform you of what you buy & sell, open module_dialogs.py. Go to the cluster of goods_ merchant_town_info and paste line for your new cities, e.g.:
The necessary changes are self-evident. Note "p_milan" thing in the first line!
(iv) Finally, to refresh the merchant's inventory, open module_triggers.py file. Look at the first cluster where all the goods merchants are. Copy & paste a line:
Changes are obvious. This will ensure your Milanese merchant's inventory is refreshed (and has a good supply of tools).
Adjust the other towns in the similar way.
ET VOILA. Now your economy is fully operational.
Step 15 (FINAL):
(i) Carefully ensure you have a copy map-edited parties.txt out of the modules folder (say, in your native folder)
(ii) Run build_module.bat again.
(iii) Transfer copy of map-edited parties.txt back into the module folder (overrite .bat-generated one).
(iv) Fire up game. Go visit new towns and kill river pirates on the way.
AND THAT'S IT.
OK, now that we have new mod tools & Thorgrim's marvelous map editor, everybody keeps asking how to add new towns.
I've been working on a mod on the Lombard Leagues. The following is what I've been doing and it works. (as an addendum, I throw in how I've been giving the town to a new faction).
It is just enough to get a decent town up & running. It is a bit long-winded, but until someone comes up with a better scheme (or can reduce all this to some editor tool), it works.
Note: This is a revamped version of an older primer.
This version is complete & working
----------------------------
Primer for New Towns
===========================
As a driving example, say I want to add a new city (call it "Milan") and perhaps give it to a new faction (call it the "Guelfs").
Step 1: Back up everything, create your module, etc. I presume you've already done this?
Step 2: Create scenarios for your town. Go to the SceneObj folder under your module. So copy & paste five scenario files and rename them:
scn_milan_castle.sco
scn_milan_center.sco
scn_milan_merchant.sco
scn_milan_smithy.sco
scn_milan_tavern.sco
If you want to add more cities (Bologna, Treviso, etc.), just do the same for each.
Step 3 (module_game_menus.py): When you reach a town on the map, the menu opens up. Now we must specify the entries on the game menus.
Open up module_game_menus.py. Adding your city's menu is a simple copy & paste job, e.g. copying rivacheg's menu, then pasting it at the bottom & changing it to Milan.
(
"milan",0,
"You enter the Guelf town of Milan.",
"none",
[[reset_price_rates],[set_price_rate_for_item,"itm_pottery",67],[set_price_rate_for_item,"itm_linen",130]],
[
("milan_castle",[],"Go to the castle.",[[set_jump_mission,"mt_town_default"],
[jump_to_scene,"scn_milan_castle"],
[change_screen_mission]]),
("milan_tavern",[],"Visit the tavern.",[[set_jump_mission,"mt_town_default"],
[jump_to_scene,"scn_milan_tavern"],
[change_screen_mission]]),
("milan_smithy",[],"Visit the smithy.",[[set_jump_mission,"mt_town_default"],
[jump_to_scene,"scn_milan_smithy"],
[change_screen_mission]]),
("milan_merchant",[],"Speak with the Merchant.",[[set_jump_mission,"mt_town_default"],
[jump_to_scene,"scn_milan_merchant"],
[change_screen_mission]]),
("milan_leave",[],"Leave town.",[[leave_encounter],[change_screen_return]]),
]
),
Make sure you change your scenes so that they match the titles you gave your .scn files, etc.
(It is recommended you paste all your new entries after the halmar entry).
(You can also adjust price for goods here if you want at this point -- that's the second line. But best leave that for the later "mopping up" stage.)
Step 4 (module_scenes.py): Now we must generate scenes, linking the menus to the actual scenarios & access stuff.
This is just another cut & paste job. Open module_scenes.py, and copy and paste some scene and substitute for the name of the relevant city. e.g. copying & pasting rivacheg, and then subbing for milanese terms.
("milan_center",0,"sargoth_square", "bo_sargoth_square", (-24,-22),(21,13),-100,"0",
["milan_tavern","milan_castle","milan_merchant"],[]),
("milan_castle",sf_indoors, "thirsty_lion", "bo_thirsty_lion", (-100,-100),(100,100),-100,"0",
["exit"],[]),
("milan_tavern",sf_indoors, "thirsty_lion", "bo_thirsty_lion", (-100,-100),(100,100),-100,"0",
["exit"],[]),
("milan_smithy",sf_indoors, "thirsty_lion", "bo_thirsty_lion", (-100,-100),(100,100),-100,"0",
["exit"],[]),
("milan_merchant",sf_indoors, "thirsty_lion", "bo_thirsty_lion", (-100,-100),(100,100),-100,"0",
["exit"],[]),
Don't be alarmed about sargoth_center & thirsty_lion. These are in practically every scene after sf_indoors. Don't change those. Just change from "rivacheg_merchant" to "milan_merchant", "rivacheg_smithy" to "milan_smithy", "rivacheg_merchant" to "milan_merchant" and "willows_tavern" to "milan_tavern" (the names of the taverns are always weird).
Pretty straightforward. Do so for every new town.
Step 5 (module_factions.py): If you want to give your towns to a new faction, keep reading. Otherwise skip to Step 6.
Suppose we wanted to give Milan to the Guelfs. First, you need to create a new faction ("Guelfs"). Open modules_factions.py. There is a list of factions. So, if you're creating a new faction, copy & paste some other faction, adjust its name and relations.
(It is recommended that you should paste your new factions at the end, after slavers.)
e.g.
("guelfs", 0, 0.5,[("outlaws",-0.05),("vaegir_caravans",-0.2), ("dark_knights",-0.05)]),
(the negative terms relating to outlaws, vaegir caravans & dark knights, means that Guelfs are hostile to those factions.)
Done? OK.
Step 6 (module_parties.py) - mercs Next open up modules_parties.py. You'll see that there is a cluster of "mercs" followed by a cluster of cities. Start with the mercs. Mercs are the types of troops for hire available at the city's tavern.
Copy and paste a merc entry and make the changes, e.g. supposing we copy from rivacheg's mercs:
("rivacheg_mercs","rivacheg_mercs",pf_disabled, no_menu, pt_none,
fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
to Milan:
("milan_mercs","milan_mercs",pf_disabled, no_menu, pt_none,
fac_guelfs,0,ai_bhvr_hold,0,(0,0),[(trp_guelf_peasant,5,0)]),
Notice that besides the name ("milan_mercs"), we also changed the faction (to fac_guelfs).
[Note: We also changed the type of troops from "trp_vaegir_peasant" to "trp_guelf_peasant. Do this only if you plan to create a new class of warriors called "guelf peasants". Otherwise, give your new town Vaegir peasants or Swadian peasants or neutral farmers or, heck, Dark Knights if you want. List of troops are in module_troops.py.]
You must add a mercs line for every city.
For consistency with the constants file, it is necessary to paste the merc lines lined up with factions, i.e.
(i) for new Swadian city, add mercs line just below uxkhal_mercs and above reyvadin_mercs
(ii) for new Vaegir city, add mercs line just below halmar_mercs and above zendar.
(iii) for new faction (Guelfs), add mercs line below halmar_mercs (or last vaegir mercs) and above zendar city line.
Step 7 (module_parties.py - towns) Now it is time to add the cities themselves. Again, open module_parties.py. Look at the list of cities and copy & paste an entry and make the relevant changes, e.g. suppose we copy rivacheg:
("rivacheg","Rivacheg",icon_town|pf_town, "rivacheg", pt_none,
fac_vaegirs,0,ai_bhvr_hold,0,(13,21),[(trp_vaegir_knight,6,0)]),
and paste it and change it to Milan as follows:
("milan","Milan",icon_town|pf_town, "milan", pt_none,
fac_guelfs,0,ai_bhvr_hold,0,(30,-1.5),[(trp_vaegir_knight,6,0)]),
Let me explain what each change does:
(i) the first "milan" is just the p-reference (it will come up as p_milan in the raw txt files).
(ii) the second "Milan" is the actual name you'll visibly see used in the game.
(iii) the third "milan"is a reference to your menu entry for Milan in the module.game_menus.py (i.e. it basically says then when your party reaches Milan on the world map, it goes to "milan" menu).
(iv) fac_guelfs is the faction of the town (it will shine underneath the name on the world map) (of course, you can keep it fac_swadians or fac_vaegirs or fac_neutrals or whatever).
(v) the (30, -1.5) are the coordinates on the world map. I changed them from (13,21) to (30, -1.5). Just a hunch. Don't worry if you don't where the coordinates are. We'll fix it later with the map-editor. Just make them something slightly different for now. (Note: they cannot be greater than 70!)
(vi) The last entry ("trp_vaegir_knight") actually mystifies me. I don't know what this means exactly or why it's there, but I just left it unchanged and hoped for the best. This is not the mercs. I think it is actually just a reference to a "face" generator of the troops-for-hire (using vaegir facial characteristics), but don't quote me on that. It doesn't seem to affect anything much anyways.
Now do a similar entry for every town. Again, for reasons you'll see later, it is necessary to keep them clustered by faction, i.e.
(i) for new Swadian city, add new city line just below uxkhal and above reyvadin
(ii) for new Vaegir city, add new city line just below halmar and above salt_mine.
(iii) for new faction (Guelf) city, add new city line below halmar (or last vaegir city) and above salt_mine city line.
I can't emphasise this too much: make sure every new Guelf city is above the Salt Mine entry.
[Addendum: if you want to add new/extra points for bandit spawns, this would be the time to do so. Copy & paste a bandit line at the very bottom of module_parties.py, and adjust the title (_1, _2) & coordinates, e.g. you can have:
("mountain_bandit_spawn_point_1","mountain_bandit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(-27, -18 ),[(trp_river_pirate,15,0)]), ("mountain_bandit_spawn_point_2","mountain_bandit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(-26, -18 ),[(trp_river_pirate,15,0)]), ("mountain_bandit_spawn_point_3","mountain_bandit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(-25, -18 ),[(trp_river_pirate,15,0)]),
Will create three mountain bandit spawn points (slightly separated from each other). Don't worry about coordinates for the moment (just differentiate slightly), as we will fix them with map-editor later. (again, I suspect the river pirate reference is just the base looks of the mountain bandit faces. I don't know)
Step 8 (module_troops.py) Now, time to create some people for your new town. Open the module_troops.py. There are four people we must create: count, tavernkeeper, merchant & armorer. (I could also create guelf toops here, but I shan't detail that in this primer). Let's go one at a time:
(A) Count Let's give Milan a count. Look to where the counts are clustered in the module_troops.py file. (easy to find: just search for "king_harlaus"). Then just copy and paste the count and adjust the entry:
["Count_Milan","Count_Beccaria","Count_Beccaria",tf_hero, scn_milan_castle|entry(1),reserved, fac_guelfs,[itm_saddle_horse,itm_leather_jacket,itm_nomad_boots],def_attrib|level(2),wp(20),knows_common,
0x00000000000002550000a7a7668278d4],
The first entry ("count_milan") is just a mnemonic reference to be used in dialogues & quest files.
The next two are his proper names (Why twice? Well, all "troops" in this file have their proper names in a singular form (Guelf knight) & a plural form (Guelf Knights). For individual NPCs, plural form is obviously redundant, so you must repeat the singular form twice; he will appear on screen as "Count Beccaria").
Make sure you put him in the Milan castle scene (scn_milan_castle) and you give him the right faction (fac_guelfs). The rest you can ignore at this stage (clothes, physical appearance numbers, etc.)
Important: try to keep all counts clustered by faction: all Swadian counts together, followed by all Vaegir counts, followed by all Guelf counts, etc.
Definitely try not to post any new NPCs above the count line. That seems to cause problems.
(B) Armorer
Armorer cluster follows the counts. Just do the same, copy & paste:
["milan_armorer","Landulf","Landulf",tf_hero|tf_is_merchant, scn_milan_smithy|entry(1),0,
fac_guelfs,[itm_coarse_tunic,itm_nomad_boots],def_attrib|level(5),wp(20),knows_inventory_management_10,
0x0000000000011114000007ac54632aa1],
Again, just mnemonic reference (milan_armorer), two proper names (Landulf) for the nice fellow, his scene (milan_smithy) and his faction (fac_guelfs).
Again, it is useful to keep armorers clustered by faction all in the same place.
(C) Weaponsmith
Weaponsmith follows the armorers. Again, just do the same copy & paste:
["milan_weaponsmith","Theodit","Theodit",tf_hero|tf_is_merchant, scn_milan_smithy|entry(2),0,
fac_guelfs,[itm_leather_jacket,itm_hide_boots],def_attrib|level(5),wp(20),knows_inventory_management_10,
0x0000000000010122000075f214dbb19c],
Again, mnemonic reference (milan_weaponsmith), two proper names (Theodit), his scene (milan_smithy) and his faction (fac_guelfs) are the only things you need to change. Again, keep the weaponsmiths clustered by faction.
(D) Tavernkeeper
Well, you know what to do:
["milan_tavernkeeper","Ernest","Ernest", tf_hero| scn_milan_tavern|entry(1),0, fac_guelfs,[itm_leather_apron,itm_hide_boots],def_attrib|level(2),wp(20),knows_common,
0x00000000000111140000649a99012625],
Basically the same changes. Make sure of scene & faction, keep these clustered by faction, etc.
(E) Goods Merchant
Again (yawn):
["milan_merchant","Elduin","Elduin",tf_hero|tf_is_merchant, scn_milan_merchant|entry(1),0,
fac_commoners,[itm_leather_apron,itm_leather_boots],def_attrib|level(2),wp(20),knows_inventory_management_10,
0x0000000000001001000003d0d371822f],
Same stuff. Except don't change faction here. Leave it commoners.
Also: Yes, you don't need to group them by faction since they don't have any, but it won't kill you to be consistent. But make sure all your new merchants in the module_troops.txt should be below zendar_merchant & above zendar_chest.
A few troubleshooting notes:
(1) Notice all the people are fac_guelfs, EXCEPT the hoods_merchant, who's faction is commoners!
(2) Notice armorer is in entry point (1), the weaponsmith in entry point (2) at the milan_smithy.
(3) To make them female, just insert a tf_female note at the point: "tf_hero|tf_female|tf_is_merchant", etc. But since I ain't adjusting faces, it is best to just copy an existing female, lest you end up with a very masculine-looking woman
(4) Make sure that for armorer, weaponsmith & goods_merchant the note "tf_is_merchant" is there, otherwise they won't sell you stuff. And make sure it is not on the count or tavernkeeper (otherwise they'll try to sell you their clothes! )
You will have to adjust dialogues so that these new people say the right things to you. That's the next step.
Step 9 (module_dialogs.py): OK. You've created your fellows. Now let's make 'em talk the right talk & walk the right walk. We go through each in turn:
(A) Count talk Open module_dialogs.py and search for the count cluster (tip: search for "king_harlaus"). Cut & paste a line for your count, e.g.
[trp_count_milan ,"start", [], "Well {playername}...",
"governer_start",[[assign,"$governer_relation","$player_relation_to_guelfs"]]],
Note I am using the earlier mnemonic reference (count_milan), not his proper name, here.
Again, best to keep these lines clustered by faction (Swadian counts together, Vaegir counts together, Guelf counts together). I don't think it makes a difference, but try being consistent.
Notes:
-- The "$player_relation_to_guelfs" line is if you're having your new faction (guelfs) give out quests of their own (a bit complicated and will go beyond this primer). If not, just omit it.
-- if adding a new Swadian or Vaegir city, make sure that line is appropriate, i.e. $player_relation_to_swadians for a new Swadian town, $player_relation_to_vaegirs for a new Vaegir town.
And you're done. If Milan is a Swadian or Vaegir city, it will participate in the Swadian/Vaegir quests racket. If Milan is Guelf city, well, then, I'll let you figure out for yourself how to have your new faction operate its own quest system. It's a bit more complicated. (I might make a quest primer at some point)
(B) Armorer & Weaponsmith talk. These guys don't have anything interesting to say. They already talk the right talk. So don't need to do anything about them in module_dialogs.py.
(C) Tavernkeeper talk Again open module_dialogs.py and search for the tavernkeeper cluster (tip: search for "#Tavernkeepers").
Copy & paste line & make changes:
[trp_milan_tavernkeeper,"start", [], "Good day dear {sir/madam}. How can I help you?",
"tavernkeeper_talk",[(assign,"$tavernkeeper_party","p_milan_mercs")]],
Note the only thing that changes is that the tavernkeeper is renamed to "milan_tavernkeeper" and mercs renamed to "p_milan_mercs". The latter is a reference to the troops he'll have for you to hire. Make sure you've already done the mercs adjustment in Step 6 above!
Again, best to keep these lines clustered by faction & together.
(D) Goods_merchant talk Again open module_dialogs.py and search for the goods merchant cluster (search for "trp_zendar_merchant").
Copy & paste line a line & make changes:
[trp_milan_merchant,"start", [], "Welcome {sir/madam}.", "merchant_begin",[]],
So here, you just need to rename trp_rivacheg_merchant to trp_milan_merchant. Again, try to keep them pasted in that cluster consistently for the heck of it.
(Note: Remember the goods merchant dialogs for the town info (what do you buy/sell?). Really you should wait to adjust that after you've mapped your country out with the map editor and thought about the economy a little bit. See the "Mopping Up" section below)
Step 10 (module_constants.py) Now it is time to set the constants. This is the tricky bit. If you've done everything consistently in clusters & such, this should be smooth.
Open module_constants.py. You'll see several clusters of numbers.
(A) Towns Ignore the first two clusters, concentrate on the third (Swadian towns, etc.) Adjust this as follows:
swadian_towns_begin = "p_sargoth"
swadian_towns_end = "p_reyvadin"
vaegir_towns_begin = "p_reyvadin"
vaegir_towns_end = "p_milan"
guelf_towns_begin = "p_milan"
guelf_towns_end = "p_salt_mine"
towns_begin = "p_sargoth"
towns_end = "p_salt_mine"
(Note: The begin command is inclusive, the end command is non-inclusive. So when going through Swadian town list, you're telling the motor that the first town to consider is Sargoth, the last town to consider is the one right before Reyvadin.)
What's this about? It sets the range for triggers (which we'll do next). Remember, when a Vaegir Count tells you to capture a Swadian nobleman going from town x to town y, i'td better be that towns x & y are Swadian. Also, if a goods merchant wants you take a caravan or delivery to another town z, it had better be that town z is not the salt mine, or the four-ways inn or, worse yet, a spawn point (its happened to me!).
So you may want to open up your module_parties.py file to be sure that all the Swadian towns (and only Swadian towns) sit between the sargoth entry & the reyvadin entry. Similarly for Vaegir & Guelf towns. If you created more than one Guelf city, all guelf city entries in the module_parties.py file should be within that range.
Make sure the generic towns begin/end includes all and only towns with tavernkeepers within its range (a merchant needs to send stuff to a tavernkeeper).
Make sure it is right! If you constructed your module_parties.py properly like I told you that should be the case. If not, fix it and make it so.
(B) The next cluster gives you the number of Swadian towns, the number of Vaegir towns & you're going to add the number of Guelf towns (necessary for the random number assignment) e.g. suppose I added two Swadian towns, two Vaegir towns and two Guelf towns. Then I'd adjust the constants to:
num_swadian_towns = 9
num_vaegir_towns = 9
num_guelf_towns = 2
(C) Next come the merc parties. Again, make sure you get the ranges right. Should be something like:
swadian_merc_parties_begin = "p_sargoth_mercs"
swadian_merc_parties_end = "p_reyvadin_mercs"
vaegir_merc_parties_begin = "p_reyvadin_mercs"
vaegir_merc_parties_end = "p_milan_mercs"
guelf_merc_parties_begin = "p_milan_mercs"
guelf_merc_parties_end = "p_zendar"
(note: double check with the module_parties.py to make sure that these ranges match. It ends in "p_zendar" since the last merc party should be just above the first city entry (Zendar) in the module_parties.py file.)
(D) Armor_merchant, weapon_merchant and goods_merchant ranges in the constants should be checked against the module_troop.py file. Open that and make sure they're right. If you did what I told you to do, it should be OK and you don't really need to change anything here. If not, fix the troops file so that it is.
(E) Finally, towards the very bottom there is a list of spawn points.
num_forest_bandit_spawn_points = 1
num_mountain_bandit_spawn_points = 1
num_steppe_bandit_spawn_points = 1
num_black_khergit_spawn_points = 1
num_sea_raider_spawn_points = 2
Remember I said you could add a few more spawn points in the module_parties.txt. Well, if you did, you've got to adjust the number here.
OK? So that's all I want to say about the module_constants.py folder. It is important you get this right, or else really weird sh*t will start happening.
Step 11 (module_triggers.py Ok, we're nearly there. If you didn't create a new faction, skip to Step 12. If you created a new faction, read this.
We need to make sure our tavernkeepers replenish their troops-for-hire. You only need to worry about refreshing tavernkeepers only if you created a new faction. Since we did (Guelfs), let us proceed.
(i) Open up module_triggers.py and scroll down to "#Refresh Tavernkeepers"
(ii) copy & paste a string, adjusting it akin to the following:
(try_for_range,reg(2),guelf_merc_parties_begin,guelf_merc_parties_end),
(store_party_size,reg(6),reg(2)),
(lt,reg(6),20),
(store_random,reg(7),4),
(val_add,reg(7),1),
(party_add_members,reg(2),"trp_guelf_peasant",reg(7)),
(store_random,reg( 8 ),2),
(party_add_members,reg(2),"trp_guelf_footman",reg( 8 )),
(end_try,0),
]),
It basically like the one for the Swadians & Vaegirs. Note the only things that changed are the (a) range set (guelf_merc_parties_begin, gulf_merc_parties_end) and (b) the types of troops hired (trp_guelf_peasant & trp_guelf_footman)
If you did your constants right, (a) isn't a problem. What about (b)? Who are these trp_guelf_peasant & trp_guelf_footman guys? Well, I created them in the module_troops.py file -- gave them armor, features & stuff (should be self-evident how -- ain't going to explain it here). If you don't want to bother creating new troops right now, easiest just make the guelf mercs like the zendar troops, i.e. insert trp_townsman and trp_watchman in the lines above instead. You can fix it up later when/if you design your own troops. Of course, you could have different troops for hire -- say dark hunters & dark knights. )
OK, THAT'S IT FOR NOW.
Step 12 (build_module.bat) Save all your .py files. Run build_module.bat. Look for any errrors in the output.
If there are any, go fix them before you proceed. THIS IS IMPORTANT. You don't want to use the map-editor on a crappy parties.txt file and be forced to do it all over again.
Step 13 (Thorgrim's map editor) Your town is ready. But your new cities (& new spawn points) aren't in the right place probably. Time for playing with the map-editor and putting your cities where you want them to be.
Warning: DON'T PROCEED WITH MAP-EDITOR until you're sure the parties.txt generated by the .bat is right, i.e. the mercs, city & spawn point entries are all there and in the right order. If not, stop and go back to Step 12. If everything is hunky-dory, it's playtime.
Personally, I'd recommend using the Map Editor on your "native folder" rather than your module folder. Why? Because if you work with the module folder, then anything you change in the parties.txt with the map editor is going to be ovewritten whenever you run build_module.bat again. (And you will run it again). You'll lose all your changes and pull your hair out.
So, the best procedure is as followS:
(A) First, back up the map.txt & parties.txt file of your native folder (the original .704 one)
(B) Transfer a copy of the new parties.txt (the one just created for your mod by the .bat) from your module folder to your native folder.
(C) Open up Thorgrim's map-editor, making sure you're working on the native folder rather than the module folder.
These steps taken, you'll see that all the new cities and spawn points appear on the map. Move them around to your heart's content.
When you're finished, save & exit the map-editor. Now, the parties.txt in your native folder is the "proper" one, so transfer a copy of it to the module folder, overwriting whatever parties.txt was there.
Important: Again, be sure to keep a copy of the final parties.txt you map-edited in your native folder at all times!!! (or somewhere safe, not in your module folder) You're bound to run the build_module.bat again in the future and you don't want that file to be overwritten by the .bat-created parties.txt.
[If you want to be triple secure, you can do the obvious: open up the map-edited parties.txt & open up the modules_parties.py. Carefully (& painstakingly) transfer the coordinates for each damn city & spawn point (incl. the main party starting position) from the map-edited parties.txt to the modules_parties.py. That way, in the future, when you run the build_module.bat, even if it overwrites, it will create something very nearly like you want it. But for lazy bums like me -- and those who are always fiddling with their maps -- keep at least a copy of the map-edited parties.txt out of the module folder.]
Step 14 (Mopping Up)
One more adjustment -- the town info & economy. This could be done before, but I preferred leaving it until you'd used the map-editor to map out & design everything where you want it to be. Now it is time to give some thought to the economy, where you have special prices for goods. After designing your town, decide which good is especially bought & sold in which town.
Suppose you decide your new town of Milan is going to sell tools cheap & buy wine expensively.
(i) Open module_game_menus.py
(ii) search for Milan's menu entry. Adjust the reset price line rates to something like:
[[reset_price_rates],[set_price_rate_for_item,"itm_tools",70],[set_price_rate_for_item,"itm_wine"
,133]],
and you're done. You can also readjust the prices for all other towns as you wish the economy of your mod to be.
(iii) Once you get all the prices mapped out, if you want the town merchants to inform you of what you buy & sell, open module_dialogs.py. Go to the cluster of goods_ merchant_town_info and paste line for your new cities, e.g.:
[anyone,"goods_merchant_town_info", [[store_encountered_party,reg(1)],[eq,reg(1),"p_milan"]],
"You can buy tools from here at a very good price.\
The best place to sell them would be Bologna. Heard they pay quite well for tools over there.\
And next time you come here bring some wine. I will pay well for wine.","goods_merchant_town_info_completed",[]],
The necessary changes are self-evident. Note "p_milan" thing in the first line!
(iv) Finally, to refresh the merchant's inventory, open module_triggers.py file. Look at the first cluster where all the goods merchants are. Copy & paste a line:
(reset_item_probabilities,100),(set_item_probability_in_merchandise,"itm_tools",700),
(troop_add_merchandise,"trp_milan_merchant",itp_type_goods,num_merchandise_goods),
Changes are obvious. This will ensure your Milanese merchant's inventory is refreshed (and has a good supply of tools).
Adjust the other towns in the similar way.
ET VOILA. Now your economy is fully operational.
Step 15 (FINAL):
(i) Carefully ensure you have a copy map-edited parties.txt out of the modules folder (say, in your native folder)
(ii) Run build_module.bat again.
(iii) Transfer copy of map-edited parties.txt back into the module folder (overrite .bat-generated one).
(iv) Fire up game. Go visit new towns and kill river pirates on the way.
AND THAT'S IT.