Walkthrough for adding a Castle and Village

Users who are viewing this thread

Ap Madog

Recruit
Hi. I have just started dabbling with modding Vanilla Native in order to understand how the code works. Is there a clear, complete walk through on how to add a new village and castle? My goal in game was to have an independent castle and village base from which to start a new character while expanding my modding knowlede.

Also, is there a comprehenside guide to the module system that clearly shows how ALL of the pieces interact? ... as opposed to the bits and pieces I have found so far.


So far, with the help of various guides I have added a Castle (based on Castle 1) and a Village (based on Village 1) using the parties module but clearly there is more to do.Both Village and Castle are apparently part of the players faction and I can see from the code how the village is assigned to the Castle based on proximity.

Initially the village center was just open landscape with a weird looking villager. Worked out how to add a Village Elder and village scene but no idea how to get the village buildings added. Also, I cannot recruit from the village. Apart from that all other menus seem to work.

With the castle on entry it recognises my character as the king ... LOL . Initially both the grounds and hall were only open landscape and in a comedic moment I met a clone of my player as the castle custodian. I have added a scene for the castle based on Castle 1 and now the hall has a recognisable "room" but with missing doors, etc. The grounds are still open fields. Clearly there are another few step required but I am at a loss so far as what.

Can someone point me in the direction of a forum post/s that can assist me completing the process fully.

One great outcome is that the newly independent castle and village, the home of my "impoverished noble" character, provides an income of D2000+ per week with no capital outlay .... sufficient to afford a few mercenaries after a week s wait. I now have somewhere to garrison my troops without having to take a castle myself ... something I have managed repeatedly in my 200+ actual game play.

Regards
Ap Madog
 
Last edited:
Solution
super guide: nope. The game is huge (features wise), and the code itself is not that well organized with lots of pieces mixed together. You will need to explore it bit by bit and learn as you go.

you can do a few things tho:

1) start with a clean modsys (no game features) and implement your test code there to see how things work (economy, etc). For that you would need to delete most of the game code (all but the hardcoded stuff), you will crash for a couple hours while learning what you can and cannot do, but eventually you will end up with a empty world map, no features at all, and a clean and fast game (that does nothing).

2) use logging (those debug messages on your rgl_log.txt) to see what is going on

3) study the basic...
super guide: nope. The game is huge (features wise), and the code itself is not that well organized with lots of pieces mixed together. You will need to explore it bit by bit and learn as you go.

you can do a few things tho:

1) start with a clean modsys (no game features) and implement your test code there to see how things work (economy, etc). For that you would need to delete most of the game code (all but the hardcoded stuff), you will crash for a couple hours while learning what you can and cannot do, but eventually you will end up with a empty world map, no features at all, and a clean and fast game (that does nothing).

2) use logging (those debug messages on your rgl_log.txt) to see what is going on

3) study the basic tutorials (about things like how MBScript and the engine work) and the feature ones (like how to add a new faction) to learn how to interact with the modsys

Important of note: you need to define your base module (Native, Floris, VC, etc..) and inform people when making questions about it. Q&A is usually about Native because that is what everyone has, but the features can be quite different between modules. Most tutorials and OSP code are also focused on Native and may not work (without corrections) on any other base.
 
Upvote 0
Solution
Thanks for the responses. In case this helps anyone else who is starting out I have included my changes.

Changes made to Native modules

The plan was to add a single castle and village to become the home of my 'impoverished noble' player character and in doing so will achieve the following objectives.

1) Provide a garrison for housing trained troops over and above the characters personal retinue ... without the need to besiege an existing castle / attacking an existing faction.
2) Provide a small income from the outset of the game without the need for accumulating capital thus allowing immediate, if restricted, access to mercenary troops and items.

After finding the following resource and following some its steps I now have a fully functioning Castle and Village (completed scenes apart) which play out exactly as if I had just successfully completed a seige ... awesome. After a week the castle produces over 2000D income so a little more interesting than starting from scratch.

Note: I did NOT add a new faction but assigned the new castle_49 to fac_player_faction and assigned trp_player as lord.

Any thoughts on additional steps (scenes aside) that I have not completed would be appeciated.


Ap Madog



Resources:

- "[Tutorial] Complete Guide To Adding Factions" on forums.taleworlds.com by Kentucky James V11.


Module Updates: This was to a copy of Native files 1.171

Step 1 - Add castle_49 and village_111 entries to 'module_parties.py'.
Use an existing 'icon' and appropriate new coordinates. The village is automatically assigned to the castle if located close enough on the map and both are automatically part of the Neutral faction.

# New Castle
("castle_49","Cwrm_Gwyrdd_Castle",icon_castle_a|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(165, -10),[],260),

# New Village
("village_111", "Cwrm_Gwyrdd", icon_village_a|pf_village, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(170, -7),[], 100),



Step 2 - Add a Village Elder to 'module_troops.py'.

# New Village Elder
["village_111_elder", "Village_Elder", "{!}village_1_elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners,[itm_coarse_tunic, itm_hide_boots, itm_felt_hat],def_attrib|level(2),wp(20),knows_inventory_management_10, man_face_old_1, man_face_older_2],

# New Castle Seneschal
["castle_111_seneschal", "{!}Castle 111 Seneschal", "{!}Castle 111 Seneschal", tf_hero|tf_is_merchant, 0,reserved, fac_neutral,[itm_padded_leather, itm_leather_boots], def_attrib|level(2),wp(20),knows_common, 0x000000000010360b01cef8b57553d34e],



Step 3 - Update 'module_scripts.py'.

#Give centers to factions first, to ensure more equal distributions
(call_script, "script_give_center_to_faction_aux", "p_castle_49", "fac_player_faction"),

# Give family castles to certain nobles.
(call_script, "script_give_center_to_lord", "p_castle_49", "trp_player", 0), #Cwrm_Gwyrdd_Castle


Step 4 - Add placeholder scenes for castle_49 and village_111 ... to be updated.

("castle_49_exterior",sf_generate,"none", "none", (0,0),(100,100),-100,"0x0000000030044e900003dd02000077b20000400100005697",
[],[],"outer_terrain_plain"),
("castle_49_interior",sf_indoors, "interior_castle_m", "bo_interior_castle_m", (-100,-100),(100,100),-100,"0",
["exit"],["castle_3_seneschal"]),
("castle_49_prison",sf_indoors,"interior_prison_e", "bo_interior_prison_e", (-100,-100),(100,100),-100,"0",
[],[]),

("village_111",sf_generate,"none", "none", (0,0),(100,100),-100,"0x00000001500410320005a96800006b5300004edc00000d11",
[],[],"outer_terrain_plain"),
 
Last edited:
Upvote 0
Back
Top Bottom