Dynamic Settlements
[size=24pt]WIP
Download:
Dynamic Settlements Alpha 1.1
Features:
- Build new villages, castles & towns
- upgrade village to town
- downgrade town to village
- Building new villages will reduce prosperity and population of the center building it. Reduction depending on original prosperity
- new village prosperity depends on prosperity of center building it, and will always be slightly lower.
- centers upgraded to a town will lose some prosperity and start with relatively low population.
- village scenes will be set according to their terrain location. Desert scenes for desert villages! Snow scenes in snow terrain!
Screenshots: (all adjustments to the settlements is done live ingame)
It will be fairly easy to implement and use:
- it works with the existing constants: towns_begin, towns_end, etc. So any new settlement is immediately active and functional.
- This also means amazing performance, as it doesn't add any triggers. The scripts only run once, when a settlement is changed or built.
- It just requires to call one of the following scripts, with the parameter (-1, if player is building; ":center_no" if the AI is building it)
Code:
script_build_village
script_upgrade_to_town
script_downgrade_to_village
script_build_castle
script_build_town
Why this is WIP:
- Can only be used via cheats
- AI currently doesn't use this, though player can built/upgrade AI fiefs in cheat mode.
- doesn't include delayed building, yet.
- Fixed:
- the terrain code doesn't work for castles and towns yet. So towns&castles get random scenes.
- Fixed:
- Fixed:
How does it work:
The game uses constants towns_begin, towns_end, villages_begin, villages_end, castles_begin, castles_end, as well as the slot_party_type, to determine, which settlement is which.
The problem with freely upgrading, building new upgrading fiefs used to be, the lack of continuous ranges.
Imagine this scenario, where each letter stands for a settlement in the parties_list (e=empty, t=town, c=castle, v=village),
eeeeeeeeeettttttttccccccccccvvvvvvvvvvvvvvvvvvvveeeeeeeeee
When building a new town, you take the e fief to the left of the leftmost t, assign it as a town and set towns_begin -1
When building a new village, you take the e fief to the right of the rightmost v, assign it as a village and set villages_end +1. Easy stuff
However, when you upgrade a village to town, you remove a v fief from the middle and suddenly villages_begin, villages_end is not continously filled with villages. This is where the scripts come in. They take the last active village, clone it onto the v fief, that is getting moved to the towns range and suddenly you have continous ranges again! Sweet stuff.
Below is the current code used. Code has not been updated to Alpha 1
Code:
towns_begin = "$g_towns_begin"
villages_begin = "$g_villages_begin"
towns_end = "$g_towns_end"
castles_begin = towns_end
castles_end = villages_begin
villages_end = "$g_villages_end"
Code:
## F&B
("kingdom_100","Ghost",0, 0.9, [], []),
("kingdoms_end","{!}kingdoms_end", 0, 0,[], []),
Code:
### Place new fiefs before town_1 ##################
("fief_1","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
("fief_2","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
("fief_3","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
("town_1","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
##### And place new fiefs below the last village ####################
("village_110","Rushdigh", icon_village_c|pf_village, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(38, -104),[], 40),
("fief_101","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
("fief_102","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
("fief_103","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
("fief_104","Sargoth", icon_town_nord_sargoth|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-17.6, 79.7),[], 170),
Code:
#F&B extra we go for 60 towns 100 castles 250 villages
["town_23_seneschal", "{!}Town 23 Seneschal", "{!}Town 23 Seneschal", tf_hero|tf_randomize_face|tf_is_merchant, 0,reserved, fac_neutral, [ itm_ar_rho_tun_vest ,itm_bo_rho_t2_highlander ],def_attrib|level(2),wp(20),knows_common,rhodok_man_face_middle_1,rhodok_man_face_older_2],
["town_24_seneschal", "{!}Town 24 Seneschal", "{!}Town 24 Seneschal", tf_hero|tf_randomize_face|tf_is_merchant, 0,reserved, fac_neutral, [ itm_ar_swa_tun_tabard ,itm_bo_swa_t2_hose ],def_attrib|level(2),wp(20),knows_common,swadian_man_face_middle_1,swadian_man_face_older_2],
################## .............. ####################################
#F&B extra
["castle_49_seneschal", "{!}Castle 49 Seneschal", "{!}Castle 49 Seneschal", tf_hero|tf_is_merchant, 0,reserved, fac_neutral, [ itm_ar_rho_tun_vest_a ,itm_bo_rho_t2_highlander ],def_attrib|level(2),wp(20),knows_common,rhodok_man_face_middle_3,rhodok_man_face_older_4], #Jamiche Castle, Rhodok, Utrehd's Castle Pack 0.32
["castle_50_seneschal", "{!}Castle 50 Seneschal", "{!}Castle 50 Seneschal", tf_hero|tf_is_merchant, 0,reserved, fac_neutral, [ itm_ar_nor_tun_green ,itm_bo_nor_t2_shoes ],def_attrib|level(2),wp(20),knows_common,nord_man_face_middle_3,nord_man_face_older_4], #Alburq Castle, Nord, El Arte de la Guerre 1.71, corrected by Smarmellows
######################.......................................#######################
["town_23_arena_master", "Tournament Master","{!}Tournament Master",tf_hero|tf_randomize_face|tf_guarantee_boots|tf_guarantee_armor, scn_town_3_arena|entry(52),reserved, fac_commoners, [ itm_ar_rho_t3_aketon_a ,itm_bo_rho_t3_highlander ],def_attrib|level(22),wp(20),knows_common,rhodok_man_face_middle_1,rhodok_man_face_older_2], #Veluca, Rhodok
["town_24_arena_master", "Tournament Master","{!}Tournament Master",tf_hero|tf_randomize_face|tf_guarantee_boots|tf_guarantee_armor, scn_town_4_arena|entry(52),reserved, fac_commoners, [ itm_ar_swa_tun_tabard ,itm_bo_swa_t2_hose ],def_attrib|level(22),wp(20),knows_common,swadian_man_face_middle_1,swadian_man_face_older_2], #Suno, Swadia
###########.........................................#################################
["town_23_crook","Town 23 Crook","Town 23 Crook",tf_hero, 0,0, fac_neutral, [ itm_ar_rho_shi_capegreen ,itm_bo_rho_t1_bear ],def_attrib|level(2),wp(20),knows_inventory_management_10,rhodok_man_face_middle_1,rhodok_man_face_older_2],
["town_24_crook","Town 24 Crook","Town 24 Crook",tf_hero, 0,0, fac_neutral, [ itm_ar_swa_shi_linen ,itm_bo_swa_t1_sandal ],def_attrib|level(5),wp(20),knows_inventory_management_10,swadian_man_face_middle_1,swadian_man_face_older_2],
####################........................##########################
["town_23_armorer","Armorer", "{!}Armorer", tf_hero|tf_randomize_face| tf_is_merchant, 0, 0, fac_commoners, [ itm_ar_rho_tun_vest ,itm_bo_rho_t2_highlander ],def_attrib|level(2),wp(20),knows_inventory_management_10,rhodok_man_face_young_1,rhodok_man_face_older_2],
["town_24_armorer","Armorer", "{!}Armorer", tf_hero|tf_randomize_face| tf_is_merchant, 0, 0, fac_commoners, [ itm_ar_swa_tun_tabard ,itm_bo_swa_t2_hose ],def_attrib|level(5),wp(20),knows_inventory_management_10,swadian_man_face_young_1,swadian_man_face_older_4],
#########################...........................#########################
["town_23_weaponsmith", "Weaponsmith","{!}Weaponsmith",tf_hero|tf_randomize_face| tf_is_merchant, 0, 0, fac_commoners, [ itm_ar_rho_mer_highlandergreen ,itm_bo_rho_t2_highlander ],def_attrib|level(5),wp(20),knows_inventory_management_10,rhodok_man_face_young_1,rhodok_man_face_older_4],
["town_24_weaponsmith", "Weaponsmith","{!}Weaponsmith",tf_hero|tf_randomize_face| tf_is_merchant, 0, 0, fac_commoners, [ itm_ar_swa_shi_linen ,itm_bo_swa_t1_sandal ],def_attrib|level(5),wp(20),knows_inventory_management_10,swadian_man_face_young_2,swadian_man_face_older_3],
################.............................####################################
["town_23_tavernkeeper", "Tavern_Keeper","{!}Tavern_Keeper",tf_hero|tf_randomize_face|tf_female, scn_town_3_tavern|entry(9),0, fac_commoners, [ itm_dress_rhodok_common_a ,itm_bo_rho_t1_bear ],def_attrib|level(2),wp(20),knows_common,rhodok_woman_face_young_1,rhodok_woman_face_older_2],
["town_24_tavernkeeper", "Tavern_Keeper","{!}Tavern_Keeper",tf_hero|tf_randomize_face, scn_town_4_tavern|entry(9),0, fac_commoners, [ itm_ar_swa_shi_linen ,itm_bo_swa_t1_sandal ],def_attrib|level(2),wp(20),knows_common,swadian_man_face_young_2,swadian_man_face_older_3],
#############............................................########################
["town_23_merchant","Merchant","{!}Merchant",tf_female|tf_hero|tf_randomize_face|tf_is_merchant, scn_town_3_store|entry(9),0, fac_commoners, [ itm_dress_rhodok_common_b ,itm_bo_rho_t1_bear ,itm_he_rho_lad_common_a ],def_attrib|level(2),wp(20),knows_inventory_management_10,rhodok_woman_face_young_1,rhodok_woman_face_older_3],
["town_24_merchant", "Merchant","{!}Merchant", tf_hero|tf_randomize_face|tf_is_merchant, scn_town_4_store|entry(9),0, fac_commoners, [ itm_ar_swa_mer_outfit ,itm_bo_swa_t2_hose ],def_attrib|level(2),wp(20),knows_inventory_management_10,swadian_man_face_young_1,swadian_man_face_older_3],
##############........................#############################
["town_23_horse_merchant","Horse Merchant","{!}Town 23 Horse Merchant",tf_hero|tf_randomize_face|tf_is_merchant, 0, 0, fac_commoners, [ itm_ar_pla_mer_leatherapron ,itm_bo_rho_t1_bear ],def_attrib|level(5),wp(20),knows_inventory_management_10,rhodok_man_face_middle_1,rhodok_man_face_older_2],
["town_24_horse_merchant","Horse Merchant","{!}Town 24 Horse Merchant",tf_hero|tf_randomize_face|tf_is_merchant, 0, 0, fac_commoners, [ itm_ar_pla_mer_leatherapron ,itm_bo_swa_t1_sandal ],def_attrib|level(5),wp(20),knows_inventory_management_10,swadian_man_face_middle_1,swadian_man_face_older_2],
#############...................................#################################
["town_23_mayor", "Guild_Master", "{!}Guild_Master", tf_hero|tf_randomize_face, 0,reserved, fac_neutral, [ itm_ar_rho_tun_vest ,itm_bo_rho_t2_highlander ],def_attrib|level(2),wp(20),knows_common,rhodok_man_face_middle_3,rhodok_man_face_older_4],
["town_24_mayor", "Guild_Master", "{!}Guild_Master", tf_hero|tf_randomize_face, 0,reserved, fac_neutral, [ itm_ar_swa_tun_tabard ,itm_bo_swa_t2_hose ],def_attrib|level(2),wp(20),knows_common,swadian_man_face_middle_1,swadian_man_face_older_4],
#############...........................######################
["village_111_elder","Village_Elder", "{!}village_11_elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners, [ itm_ar_khe_tun_furcoat_a ,itm_bo_khe_t2_boots ],def_attrib|level(2),wp(20),knows_inventory_management_10,khergit_man_face_old_1,khergit_man_face_older_2], #Dusturil
["village_112_elder","Village_Elder", "{!}village_11_elder",tf_hero|tf_randomize_face|tf_is_merchant, 0,0, fac_commoners, [ itm_ar_pla_pri_robe ,itm_bo_pla_t1_priest ,itm_he_rho_t1_common_a ],def_attrib|level(2),wp(20),knows_inventory_management_10,rhodok_man_face_old_3,rhodok_man_face_older_4], #Emer
#############..........................############################
["town_23_master_craftsman", "{!}Town 3 Craftsman", "{!}Town 3 Craftsman", tf_hero|tf_is_merchant, 0,reserved, fac_neutral, [ itm_ar_rho_tun_vest ,itm_bo_rho_t2_highlander ],def_attrib|level(2),wp(20),knows_common,rhodok_man_face_young_1], ##Floris: Joseph Louis Lagrange
["town_24_master_craftsman", "{!}Town 4 Craftsman", "{!}Town 4 Craftsman", tf_hero|tf_is_merchant, 0,reserved, fac_neutral, [ itm_ar_pla_mer_leatherapron ,itm_bo_swa_t1_sandal ],def_attrib|level(2),wp(20),knows_common,swadian_man_face_older_1], ##Floris: Alfred Hitchcock
##########.............................###################
Code:
("game_start",
[
#F&B begin assigning global variables. IMPORTANT! This needs to be at the very start.
(assign, "$g_towns_begin", "p_town_1"),
(assign, "$g_towns_end", "p_castle_1"),
(assign, "$g_villages_begin", "p_village_1"),
(assign, "$g_villages_end", "p_fief_101"),
#F&B end
######## ...........Put below code anywhere in script_game_start ................###############
#F&B begin disable the empty settlement
(try_for_range, ":center_no", "p_fief_1", "p_town_1"),
(call_script, "script_give_center_to_faction_aux", ":center_no", "fac_kingdom_100"),
(disable_party, ":center_no"),
(party_set_note_available, ":center_no", 0),
(try_end),
(try_for_range, ":center_no", "p_fief_101", "p_salt_mine"),
(call_script, "script_give_center_to_faction_aux", ":center_no", "fac_kingdom_100"),
(disable_party, ":center_no"),
(party_set_note_available, ":center_no", 0),
(try_end),
(faction_set_slot, "fac_kingdom_100", slot_faction_state, sfs_inactive), #make kingdom 100 inactive
(faction_set_note_available, "fac_kingdom_100", 0),
#F&B end
Code:
############# place this above town_leave
#F&B begin Dynamic World cheats
("cheat_downgrade_to_village",
[
(party_slot_eq, "$g_encountered_party", slot_party_type, spt_town),
(eq, "$cheat_mode", 1),
],
"Downgrade to village",
[
(call_script, "script_downgrade_to_village", "$g_encountered_party"),
(change_screen_return),
]),
("cheat_build_village",
[
(party_slot_eq, "$g_encountered_party", slot_party_type, spt_town),
(eq, "$cheat_mode", 1),
],
"Build new village",
[
(try_begin),
(party_get_slot, ":town_lord", "$g_encountered_party", slot_town_lord),
(eq, ":town_lord", "trp_player"),
(call_script, "script_build_village", -1),
(else_try),
(call_script, "script_build_village", "$g_encountered_party"),
(try_end),
(change_screen_return),
]),
("cheat_build_castle",
[
(party_slot_eq, "$g_encountered_party", slot_party_type, spt_town),
(eq, "$cheat_mode", 1),
],
"Build new Castle",
[
(try_begin),
(party_get_slot, ":town_lord", "$g_encountered_party", slot_town_lord),
(eq, ":town_lord", "trp_player"),
(call_script, "script_build_village", -1),
(else_try),
(call_script, "script_build_castle", "$g_encountered_party"),
(try_end),
(change_screen_return),
]),
("cheat_rename",
[
(party_get_slot, ":town_lord", "$g_encountered_party", slot_town_lord),
(this_or_next|eq, ":town_lord", "trp_player"),
(eq, "$cheat_mode", 1),
],
"Rename fief",
[
(start_presentation, "prsnt_name_fief"),
]),
#F&B end Dynamic World Cheats
("town_leave",[],"Leave...",
##########..................... Add the code between #F&B begin and F&B end to the cheat menu ##############
("camp_cheat",
[(ge, "$cheat_mode", 1)
], "CHEAT MENU!",
[(jump_to_menu, "mnu_camp_cheat"),
],
),
#F&B begin
("fb_cheat",
[(ge, "$cheat_mode", 1)
], "Dynamic World Cheats",
[(jump_to_menu, "mnu_fb_cheat"),
],
),
#F&B end
("resume_travelling",[],"Resume travelling.",
##################..............Place this somewhere in game_menus###############
#F&B begin Dynamic World Cheat Menu
("fb_cheat",0,
"Behold the wonders of infinite power and use it wisely",
"none",
[
],
[
("fb_cheat_build_village",[], "Build new village here",
[
(call_script, "script_build_village", -1),
(change_screen_return),
]
),
("fb_cheat_build_castle",[], "Build new castle here",
[
(call_script, "script_build_castle", -1),
(change_screen_return),
]
),
("fb_cheat_build_town",[], "Build new town here",
[
(call_script, "script_build_town", -1),
(change_screen_return),
]
),
("fb_cheat_camp",[],"{!}Camp for 1 year at 50x speed",
[
(assign,"$g_camp_mode", 1),
(assign, "$g_infinite_camping", 1),
(assign, "$g_player_icon_state", pis_camping),
(rest_for_hours_interactive, 24 * 365, 50), #1 year rest while not attackable with 50x speed
(change_screen_return),
]
),
("fb_cheat_return",[], "Return",
[
(jump_to_menu, "mnu_camp"),
]
),
]
),
#F&B end Dynamic World Cheat Menu
Credits:
- everyone who was involved in the Floris mod and any of the OSP's it includes
- Q&A Thread members. Notable mention: kalarhan