SP Tutorial Module System Create New Village

Users who are viewing this thread

We learn create new village in this lesson.

We change the following files in this lesson;
Code:
module_troops.py
module_scenes.py
module_parties.py
module_scripts.py

Before we start lesson, you must copy this files.

Firstly, we open module_troops.py file and find this;
Code:
  ["village_90_elder", "Village Elder","village 1 elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners,[itm_selo_boots,itm_prostoy_jupan_b,itm_ukrine_prosta_shapka],def_attrib|level(2),wp(20),knows_inventory_management_10,                              man_face_old_1, man_face_older_2],

add after;
Code:
  ["village_91_elder", "Village Elder","village 91 elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners,[itm_selo_boots,itm_prostoy_jupan_b,itm_ukrine_prosta_shapka],def_attrib|level(2),wp(20),knows_inventory_management_10,                              man_face_old_1, man_face_older_2],

Explain;
village_91_elder = Elder's ID.
Village Elder = Name.
tf_hero = Hero.
tf_randomize_face = Random Face.
tf_is_merchant = Merchant.
[itm...] = Items.

Save this file and close.

Now, we add us scenes. Open module_scenes.py and find this;
Code:
  ("village_90",sf_generate,"none", "none", (0,0),(100,100),-100,"0x00000000300005004005fd770000296c0000472e00000139",
    [],[],"outer_terrain_plain"),

add after;
Code:
  ("village_91",sf_generate,"none", "none", (0,0),(100,100),-100,"0x00000000300005004005fd770000296c0000472e00000139",
    [],[],"outer_terrain_plain"),

Explain;
village_91 = Village ID.
0x00000... = Generated code. (I use here 90th village's code.)

We finished us work in this file. Save and quit.

Now, we must add us village!
Open module_parties.py file and find this;
Code:
  ("village_90", "Kolomak", icon_village_ukr_a|pf_village, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(55.33, -17.31),[], 40),

add after;
Code:
  ("village_91", "Us Village's Name", icon_village_swed_a|pf_village, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(21.79,83.57),[], 40),

Explain;
village_91 = Us village's ID.
Us Village's Name = Us village's name.
icon_village_swed_a = Icon of village.
pf_village = Village tag.
21.79,83.57 = Coordinate.

and finish this. Now save and quit this file.

We last process is give center to party/lord. Open module_scripts.py file.
Find this;
Code:
        (party_set_slot, "p_village_66", slot_village_bound_center, "p_town_13"),
        (store_faction_of_party, ":town_faction", "p_town_13"),
        (call_script, "script_give_center_to_faction_aux", "p_village_66", ":town_faction"),

add after;
Code:
        (party_set_slot, "p_village_91", slot_village_bound_center, "p_town_1"),
        (store_faction_of_party, ":town_faction", "p_town_1"),
        (call_script, "script_give_center_to_faction_aux", "p_village_91", ":town_faction"),

Explain;
p_village_91 = Us village's ID.
p_town_1 = Here we write us villages attacked town/castle. (For example, p_town_1: If we write this there, when someone take town_1, they will take p_village_91 as well.)

Yeh, we finished this lesson.
Enjoy It...
 
Is this Tutorial made with WB v.1.143 ? Because I can't find the code in the last step in the file.
 
I followed this tutorial too and as you said the last step is missing. However the rest is enough. I added 3 villages.

About the last step, there is a script that ties a village to a nearest town so no need to define yourself, I suppose.
 
I'm very sorry, i forgot.


Code:
        (party_set_slot, "p_village_66", slot_village_bound_center, "p_town_13"),
        (store_faction_of_party, ":town_faction", "p_town_13"),
        (call_script, "script_give_center_to_faction_aux", "p_village_66", ":town_faction"),
last part is this :smile:
 
Excellent tutorial! You should perhaps make one for Forts and Towns too, though it works the same way, it'd be helpful when finding the relevant bits of code.

However I have encountered an issue, for reason whenever the new villages increase in prosperity the normal village icon becomes the Sarranid one.
 
Sorry to dig up an old thread. I followed this tutorial to get my villages in game. Unfortunately I am having an issue where it does not assign my new village to the town. The town simply says no one owns it when you go in game. Any ideas how to fix this?

The only portion of the code i could not follow is the very last step since that code no longer exists in the latest module_scripts.py



EDIT.... if anyone else is having this problem the solution is to simply start a new game and quit. The next game you start it works perfectly.
 
wld427 said:
Sorry to dig up an old thread. I followed this tutorial to get my villages in game. Unfortunately I am having an issue where it does not assign my new village to the town. The town simply says no one owns it when you go in game. Any ideas how to fix this?

The only portion of the code i could not follow is the very last step since that code no longer exists in the latest module_scripts.py



EDIT.... if anyone else is having this problem the solution is to simply start a new game and quit. The next game you start it works perfectly.

I've saw your message yet, so I want to answer it maybe someone wants to know. The reason of your problem is that the villages are given to faction when you start game firstly. So when you add a new village and load an old game, it isn't given to faction.

However, it can be possible in many ways. For example, in the Camp Menu you can add a new section like Update_new_villages and in this section you can give villages to the faction, for example;

Code:
("camp_update_village_faction, [], "Update Village Faction, [
        (party_set_slot, "p_village_91", slot_village_bound_center, "p_town_1"),
        (store_faction_of_party, ":town_faction", "p_town_1"),
        (call_script, "script_give_center_to_faction_aux", "p_village_91", ":town_faction"),
        (display_message, "@Your new village has been updated."),
]),

Or you can use simple_trigger and check all villages with villages_begin, villages_end and after check distance with walled_centers_begin, walled_centers_end, and you can link the villages, which don't have any faction, with the nearest walled center. Like;

Code:
(24, [
  (try_for_range, ":village_no", villages_begin, villages_end),
    (store_faction_of_party, ":faction_no", ":village_no"),
    (le, ":faction_no", 0),
    (try_for_range, ":town_no", walled_centers_begin, walled_centers_end),
      (store_distance_to_party_from_party, ":distance", ":town_no", ":village_no"),
      (try_begin),
        (le, ":dist" 0),
        (assign, ":dist", ":distance"),
        (assign, ":town", ":town_no"),
      (else_try),
        (lt, ":distance", ":dist"),
        (assign, ":town", ":town_no"),
      (try_end),
    (try_end),
    (party_set_slot, ":village_no", slot_village_bound_center, ":town"),
    (store_faction_of_party, ":town_faction", ":town"),
    (call_script, "script_give_center_to_faction_aux", ":village_no", ":town_faction"),
  (try_end),
]),

I didn't try that code just coded it now maybe it can give an error. Just example to you :smile:
 
Thanks for the helpful topic...this is a very old thread but thought I'd post here as this issue is related.

I've just added my first extra town to the warband map (entirely through python) and everything seems to have worked except for the scene interiors. The city streets are an empty field, as is the arena. The lord's hall and tavern scenes show up, but they are empty buildings without any props.

I've spent a couple of hours scouring all the python files to figure out what I'm missing, but can't figure it out.

I will note that I'm using the Floris Dev Suite 2.55 rather than vanilla module development, but I couldn't figure it out during a trial run of vanilla either.

Any thoughts? Thank you!!
 
Is there anyway you could include screenshots of how to do this and which files to open? i'm totally lost and really would like to make my own village  :!:
 
the files are listed in the tutorial, just read it again and follow it step by step

open this file, do this thingy, now to the next file...

keep in mind the tutorial is from 2012 as well.
 
Back
Top Bottom