SP Tutorial Module System Creating a faction.

Users who are viewing this thread

Nord Champion

Grandmaster Knight
M&BWBWF&SNW
New Tutorial: http://forums.taleworlds.com/index.php/topic,334271.0.html



Ok, so, there is no straight answer to creating a faction so I will put a tutorial.

Thanks to: Egbert, CryptoCactus, and Ziller for helping me!

First you need to create the faction.
Go to module factions.
Put this:
Code:
  ("culture_7",  "{!}culture_7", 0, 0.9, [], []),

Below this:
Code:
("culture_6",  "{!}culture_6", 0, 0.9, [], []),

also

Put this:
Code:
  ("kingdom_7",  "YourFactionName",  0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x254117),
Note: the 0x254117 is the kingdom's color.

Below this:
Code:
("kingdom_6",  "Sarranid Sultanate",  0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0xDDDD33),

Go to your module_scripts now.
Put this:
Code:
      (faction_set_slot, "fac_culture_7", slot_faction_town_walker_male_troop, "trp_town_walker_1"),
      (faction_set_slot, "fac_culture_7", slot_faction_town_walker_female_troop, "trp_town_walker_2"),
      (faction_set_slot, "fac_culture_7", slot_faction_village_walker_male_troop, "trp_village_walker_1"),
      (faction_set_slot, "fac_culture_7", slot_faction_village_walker_female_troop, "trp_village_walker_2"),
      (faction_set_slot, "fac_culture_7", slot_faction_town_spy_male_troop, "trp_spy_walker_1"),
      (faction_set_slot, "fac_culture_7", slot_faction_town_spy_female_troop, "trp_spy_walker_2"),	 
Note: This is just a copy of Swadia's town walkers.

Below this:
Code:
      (faction_set_slot, "fac_culture_6", slot_faction_town_walker_male_troop, "trp_sarranid_townsman"),
      (faction_set_slot, "fac_culture_6", slot_faction_town_walker_female_troop, "trp_sarranid_townswoman"),
      (faction_set_slot, "fac_culture_6", slot_faction_village_walker_male_troop, "trp_sarranid_townsman"),
      (faction_set_slot, "fac_culture_6", slot_faction_village_walker_female_troop, "trp_sarranid_townswoman"),
      (faction_set_slot, "fac_culture_6", slot_faction_town_spy_male_troop, "trp_spy_walker_1"),
      (faction_set_slot, "fac_culture_6", slot_faction_town_spy_female_troop, "trp_spy_walker_2"),

also

Put this:
Code:
	  (faction_set_slot, "fac_kingdom_7",  slot_faction_culture, "fac_culture_7"),      
     (faction_set_slot, "fac_kingdom_7",  slot_faction_leader, "trp_kingdom_7_lord"),
	  (troop_set_slot, "trp_kingdom_7_lord", slot_troop_renown, 1200),

Below this:
Code:
     (faction_set_slot, "fac_kingdom_6",  slot_faction_culture, "fac_culture_6"),
     (faction_set_slot, "fac_kingdom_6",  slot_faction_leader, "trp_kingdom_6_lord"),
	  (troop_set_slot, "trp_kingdom_6_lord", slot_troop_renown, 1200),

You need a king and a knight!
Go to your module_troops.
Put this:
Code:
  ["kingdom_7_lord",  "King YourName",  "YourName",  tf_hero, 0,reserved,  fac_kingdom_7,[itm_charger,   itm_rich_outfit,        itm_blue_hose,                  itm_plate_boots,               itm_plate_armor, itm_gauntlets,    itm_bastard_sword_b,      itm_tab_shield_heater_cav_b,       itm_great_helmet],          knight_attrib_5,wp(220),knight_skills_5|knows_trainer_5, 0x0000000f45041105241acd2b5a66a86900000000001e98310000000000000000,swadian_face_older_2],
Note: This is a copy of the Sawdian's king. And the 0x0000000f45041105241acd2b5a66a86900000000001e98310000000000000000 is the face code.

Below this:
Code:
  ["kingdom_6_lord",  "Sultan Hakim",  "Hakim",  tf_hero, 0,reserved,  fac_kingdom_6,[itm_warhorse_sarranid,     itm_mamluke_mail,          itm_sarranid_boots_c,       itm_sarranid_mail_coif,  itm_mail_mittens,      itm_sarranid_cavalry_sword,    itm_tab_shield_small_round_c],         knight_attrib_3,wp(220),knight_skills_4|knows_trainer_5, 0x0000000a4b103354189c71d6d386e8ac00000000001e24eb0000000000000000, rhodok_face_old_2],

There's your king!

Now put this:
Code:
  ["knight_7_1", "Lord YourName", "YourName", tf_hero, 0, reserved,  fac_kingdom_7, [itm_warhorse,          itm_nobleman_outfit,     itm_coat_of_plates,                 itm_leather_boots,          itm_splinted_leather_greaves,        itm_flat_topped_helmet, itm_gauntlets, itm_bastard_sword_b,   itm_tab_shield_heater_d],  knight_attrib_5,wp(260),knight_skills_5|knows_trainer_3, 0x000000002900200436db6d86db6db6db00000000001db6db0000000000000000, swadian_face_young_2 ],

Note: 0x000000002900200436db6d86db6db6db00000000001db6db0000000000000000 is MY facecode.  :lol:


Below this:
Code:
  ["knight_6_20", "Emir Biliya", "Biliya", tf_hero, 0, reserved,  fac_kingdom_6, [itm_warhorse_sarranid,     itm_sarranid_cavalry_robe,       itm_sarranid_boots_c,  itm_sarranid_boots_c,       itm_sarranid_veiled_helmet,   itm_lance,      itm_sarranid_cavalry_sword,   itm_tab_shield_small_round_c],  knight_attrib_5,wp(240),knight_skills_5|knows_trainer_6, 0x00000001bd0040c0281a899ac956b94b00000000001ec8910000000000000000, rhodok_face_older_2],

There's your knight! Also the prefix "itm" is item. So those are the items they are going to have ingame. The skills are on the last line.


Yeah you got a faction...now you need troops!
Go to your module_troops.
Here you can do whatever you want. For this, I will copy a Swadian Recruit.
Put your copied solder
Mine is:
Code:
  ["swadian_recruit","Swadian Recruit","Swadian Recruits",tf_guarantee_armor,0,0,fac_kingdom_1,
   [itm_scythe,itm_hatchet,itm_pickaxe,itm_club,itm_stones,itm_tab_shield_heater_a,itm_leather_cap,itm_felt_hat,itm_felt_hat,
    itm_shirt,itm_coarse_tunic,itm_leather_apron,itm_nomad_boots,itm_wrapping_boots],
   def_attrib|level(4),wp(60),knows_common,swadian_face_younger_1, swadian_face_middle_2],

Below this:
Code:
  ["relative_of_merchants_end","relative_of_merchants_end","relative_of_merchants_end",tf_hero, 0,0, fac_commoners,[],def_attrib|level(2),wp(20),knows_inventory_management_10,0], 
 
Note: Make sure it saids fac_kingdom_7 at the end!

Now you can mess with it! Here's my custom troop!
Code:
["nord_champion","Nord Champion","Nord Champion",tf_guarantee_armor,0,0,fac_kingdom_7,
   [itm_scythe,itm_hatchet,itm_pickaxe,itm_club,itm_stones,itm_tab_shield_heater_a,itm_leather_cap,itm_felt_hat,itm_felt_hat,
    itm_shirt,itm_coarse_tunic,itm_leather_apron,itm_nomad_boots,itm_wrapping_boots],
   def_attrib|level(4),wp(60),knows_common,swadian_face_younger_1, swadian_face_middle_2],

Note: If you want to upgrade troops, make sure you have two troops first. Then at the very bottom of the module_troops put
upgrade(troops,"trp_nord_champion","trp_nord_is_awesome"


ALSO!

You need messangers, deserters, and guards...

So copy some, I copied the Swadians
Code:
  ["swadian_messenger","Swadian Messenger","Swadian Messengers",tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_gloves|tf_guarantee_horse|tf_guarantee_ranged,0,0,fac_kingdom_1,
   [itm_sword_medieval_a,itm_leather_jerkin,itm_leather_boots,itm_courser,itm_leather_gloves,itm_light_crossbow,itm_bolts],
   str_7 | agi_21 | int_4 | cha_4|level(25),wp(130),knows_common|knows_riding_7|knows_horse_archery_5,swadian_face_young_1, swadian_face_old_2],
  ["swadian_deserter","Swadian Deserter","Swadian Deserters",tf_guarantee_ranged|tf_guarantee_boots|tf_guarantee_armor,0,0,fac_deserters,
   [itm_bolts,itm_light_crossbow,itm_hunting_crossbow,itm_dagger,itm_club,itm_voulge,itm_wooden_shield,itm_leather_jerkin,itm_padded_cloth,itm_hide_boots,itm_padded_coif,itm_nasal_helmet,itm_footman_helmet],
   def_attrib|level(14),wp(80),knows_common|knows_riding_2|knows_ironflesh_1,swadian_face_young_1, swadian_face_old_2],
  ["swadian_prison_guard","Prison Guard","Prison Guards",tf_guarantee_shield|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet,0,0,fac_kingdom_1,
   [itm_awlpike,itm_pike,itm_great_sword,itm_morningstar,itm_sword_medieval_b,itm_tab_shield_heater_c,itm_coat_of_plates,itm_plate_armor,itm_plate_boots,itm_guard_helmet,itm_helmet_with_neckguard,itm_bascinet,itm_guard_helmet,itm_leather_gloves],
   def_attrib|level(25),wp(130),knows_common|knows_shield_3|knows_ironflesh_3|knows_power_strike_3,swadian_face_young_1, swadian_face_old_2],
  ["swadian_castle_guard","Castle Guard","Castle Guards",tf_guarantee_shield|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet,0,0,fac_kingdom_1,
   [itm_awlpike,itm_pike,itm_great_sword,itm_morningstar,itm_sword_medieval_b,itm_tab_shield_heater_c,itm_tab_shield_heater_d,itm_coat_of_plates,itm_plate_armor,itm_plate_boots,itm_guard_helmet,itm_helmet_with_neckguard,itm_bascinet,itm_guard_helmet,itm_leather_gloves],
   def_attrib|level(25),wp(130),knows_common|knows_shield_3|knows_ironflesh_3|knows_power_strike_3,swadian_face_young_1, swadian_face_old_2],

and rename it to fit your faction


Now give your kingdom reinforcements:
Go to module_party_templates.
Put this:
Code:
  ("kingdom_7_reinforcements_a", "{!}kingdom_7_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_nord_champion,6,12),
Note: the 6,12 is how many Nord Champions they will get when they reinforce. So they'll get about 6 or 12

Below this:
Code:
  ("kingdom_6_reinforcements_c", "{!}kingdom_6_reinforcements_c", 0, 0, fac_commoners, 0, [(trp_sarranid_horseman,3,5)]),

Now we need to set the culture.
Got to module_scripts.
Put this:
Code:
	  (faction_set_slot, "fac_culture_7", slot_faction_tier_1_troop, "trp_nord_champion"),
Note: I used my custom troop, trp_nord_champion, in which you need to change it to your troop.

Below this:
Code:
       (faction_set_slot, "fac_culture_6", slot_faction_tier_5_troop, "trp_sarranid_mamluke"),

Now you need to activate them!
Go to module_scripts.
Put this:
Code:
        (else_try),
          (faction_slot_eq, ":faction_no", slot_faction_culture, "fac_culture_7"),
      
          (faction_set_slot, ":faction_no", slot_faction_deserter_troop, "trp_yourfaction_deserter"),
          (faction_set_slot, ":faction_no", slot_faction_guard_troop, "trp_yourfaction_guard"),
          (faction_set_slot, ":faction_no", slot_faction_messenger_troop, "trp_yourfaction_messenger"),
          (faction_set_slot, ":faction_no", slot_faction_prison_guard_troop, "trp_yourfaction_prison_guard"),
          (faction_set_slot, ":faction_no", slot_faction_castle_guard_troop, "trp_yourfaction_castle_guard"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_a, "pt_kingdom_7_reinforcements_a"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_b, "pt_kingdom_7_reinforcements_b"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_c, "pt_kingdom_7_reinforcements_c"),

Below this:
Code:
        (else_try),
          (faction_slot_eq, ":faction_no", slot_faction_culture, "fac_culture_6"),
      
          (faction_set_slot, ":faction_no", slot_faction_deserter_troop, "trp_sarranid_deserter"),
          (faction_set_slot, ":faction_no", slot_faction_guard_troop, "trp_sarranid_castle_guard"),
          (faction_set_slot, ":faction_no", slot_faction_messenger_troop, "trp_sarranid_messenger"),
          (faction_set_slot, ":faction_no", slot_faction_prison_guard_troop, "trp_sarranid_prison_guard"),
          (faction_set_slot, ":faction_no", slot_faction_castle_guard_troop, "trp_sarranid_castle_guard"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_a, "pt_kingdom_6_reinforcements_a"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_b, "pt_kingdom_6_reinforcements_b"),
          (faction_set_slot, ":faction_no",  slot_faction_reinforcements_c, "pt_kingdom_6_reinforcements_c"),

Now I think you need a town.
Go to module_parties. NOTE: IF YOU DO NOT CREATE VILLAGES AS WELL, YOUR CITY WILL TAKE THE NEAREST 3 VILLAGES FOR ITSELF!
Note: This is a copy of Praven

Put this: 
Code:
 ("town_23","Stronghold",   icon_town|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(176, -47),[],260),
Note: The 9176, -47),[],260) is the coordinates of where the city will be placed!

Below this:
Code:
  ("town_22","Bariyye", icon_town_desert|pf_town, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(165, -106.7),[], 225),

Now go to module_scenes.
Put this:
Code:
  ("town_23_center",sf_generate,"none", "none", (0,0),(100,100),-100,"0x00000002300491830004a529000036230000312a00003653",
    [],[],"outer_terrain_plain"),

Below this:
Code:
  ("town_22_center",sf_generate,"none", "none",(0,0),(100,100),-100,"0x000000025a03253200042d08000079d6000004fd00006910",
    [],[],"outer_terrain_desert"),

Put this:
Code:
  ("town_23_castle",sf_indoors, "interior_castle_z", "bo_interior_castle_z", (-100,-100),(100,100),-100,"0",
    ["exit"],["town_6_seneschal"]),

Below this:
Code:
  ("town_22_castle",sf_indoors, "arabian_interior_keep_a", "bo_arabian_interior_keep_a", (-100,-100),(100,100),-100,"0x00000007300005000002308c00004a840000624700004fda",
    ["exit"],["town_22_seneschal"]),

Put this:
Code:
  ("town_23_tavern",sf_indoors, "interior_tavern_g", "bo_interior_tavern_g", (-100,-100),(100,100),-100,"0",
    ["exit"],[]),

Below this:
Code:
  ("town_22_tavern",sf_indoors, "interior_town_house_steppe_c", "bo_interior_town_house_steppe_c", (-100,-100),(100,100),-100,"0",
    ["exit"],[]),

Put this:
Code:
   ("town_23_store",sf_indoors, "interior_town_house_j", "bo_interior_town_house_j", (-100,-100),(100,100),-100,"0",
    ["exit"],[]),

Below this:
Code:
  ("town_22_store",sf_indoors, "interior_town_house_steppe_d", "bo_interior_town_house_steppe_d", (-100,-100),(100,100),-100,"0",
    ["exit"],[]),

Put this:
Code:
  ("town_23_arena",sf_generate,"none", "none", (0,0),(100,100),-100,"0xa0001d9300031ccb0000156f000048ba0000361c",
    [],[],"outer_terrain_plain"),

Below this:
Code:
  ("town_22_arena",sf_generate,"none", "none", (0,0),(100,100),-100,"0x00000002200005000005f57b00005885000046bd00006d9c",
    [],[],"outer_terrain_desert"),

Put this:
Code:
  ("town_23_prison",sf_indoors,"interior_prison_e", "bo_interior_prison_e", (-100,-100),(100,100),-100,"0",
    ["exit"],[]),

Below this:
Code:
  ("town_22_prison",sf_indoors,"interior_prison_o", "bo_interior_prison_o", (-100,-100),(100,100),-100,"0",
    ["exit"],[]),

Put this:
Code:
  ("town_23_walls",sf_generate,"none", "none", (0,0),(100,100),-100,"0x00000002300015e300063d8800002757000055df00001b08",
    [],[],"sea_outer_terrain_1"),

Below this:
Code:
("town_22_walls",sf_generate,"none", "none", (0,0),(100,100),-100,"0x000000025a00723200046d1b00003e020000147600004387",
    [],[],"outer_terrain_desert"),
 

Put this:
Code:
  ("town_23_alley",sf_generate,"none", "none", (0,0),(100,100),-100,"0x300bc5430001e0780000448a0000049f00007932",
    [],[],"outer_terrain_plain"),

Below this:
Code:
  ("town_22_alley",sf_generate,"none", "none", (0,0),(100,100),-100,"0x000000025a00723200046d1b00003e0200001476000052ae",
    [],[],"outer_terrain_desert"),

Now after that, you need to do some browsing! Go to C:\Program Files (x86)\Mount&Blade Warband\Modules\YourMod\SceneObj. So basically go to your mod directory and click on SceneObj.
Ok when there you need to...
Copy the city folder you copied in the above step (the longest step). I copied Praven, p_town_6, so I need to copy
Code:
scn_town_6_alley.sco
scn_town_6_arena.sco
scn_town_6_castle.sco
scn_town_6_center.sco
scn_town_6_prison.sco
scn_town_6_room.sco
scn_town_6_store.sco
scn_town_6_tavern.sco
scn_town_6_walls.sco

and rename them

Code:
scn_town_23_alley.sco
scn_town_23_arena.sco
scn_town_23_castle.sco
scn_town_23_center.sco
scn_town_23_prison.sco
scn_town_23_room.sco
scn_town_23_store.sco
scn_town_23_tavern.sco
scn_town_23_walls.sco


Now go do the same thing to castles and towns!

Now you need to give that city to your kingdom lord..

Go to module_scripts
Put this:
Code:
      (call_script, "script_give_center_to_lord", "p_town_23", "trp_kingdom_7_lord", 0),

Below this:
Code:
      (call_script, "script_give_center_to_lord", "p_town_22", "trp_knight_6_3", 0),
 

Atamawood

Veteran
NW
This is excellent, I've always wanted to do this but as your stated never has there really been a strait answer. Thank you so much!
 

Nord Champion

Grandmaster Knight
M&BWBWF&SNW
Atamawood said:
This is excellent, I've always wanted to do this but as your stated never has there really been a strait answer. Thank you so much!

No problem, I'm glad that I'm helping someone.

Also I'm finished! And need help....look at the top question...
 

Egbert

Master Knight
M&BWB
Towns get starting troops from "script_cf_reinforce_party" which gives them troops from "slot_faction_reinforcements_a" and "slot_faction_reinforcements_b" which are set at script_initialize_faction_troop_types.
 

CryptoCactus

Sergeant Knight
M&BWB
Egbert said:
"slot_faction_reinforcements_b" which are set at script_initialize_faction_troop_types.

Yes! This is what I couldn't think of when you asked me yesterday, Nord Champion. I forgot you have to set the reinforcement slots. Hopefully that'll solve your problem.
 

JethroKirby

Knight at Arms
WB
Thanks for the tutorial. I'm currently working on splitting the current factions into 3 or 4 different ones (one for each town). That's 22 factions all together. It works, no script errors, compiles fine, etc, but there are weird anomalies on the notes screen. Some lords/ladies have negative numbers for ages and family members from other factions. I'm thinking it might be because I split up the existing lords among the different factions instead of adding more. Could that be the case?
 

Somebody

Code Pope
Baron
WBWF&S
script_initialize_aristocracy is where it's all at.
Each family basically needs a distinct ancestor seed.
In Native, there are 20 lords per faction. The first at last 8 are father-sons, with randomized fraternal relationships. The middle 4 are independent lords. As for ladies, those are mother-daughter relationships, assigned to each father-son pairs, with the last 4 being sisters to the 4 independent lords iirc.

Oh, and there are many more places you need to change for your faction to work properly, especially in multiplayer.
 

Nord Champion

Grandmaster Knight
M&BWBWF&SNW
JethroKirby said:
Thanks for the tutorial. I'm currently working on splitting the current factions into 3 or 4 different ones (one for each town). That's 22 factions all together. It works, no script errors, compiles fine, etc, but there are weird anomalies on the notes screen. Some lords/ladies have negative numbers for ages and family members from other factions. I'm thinking it might be because I split up the existing lords among the different factions instead of adding more. Could that be the case?

It happens to me as well. I'll figure it out asap...
 

SPD_Phoenix

Master Knight
You also need (some might not required):
- Faction banner (which appear in the diplomatic screen) if it is not player faction (module_map_icons, module_mesh, module_scene_props: same thing, different usage).
- Faction adjective string (might not need).
- Assign faction leader and lord(s) banners, renown, money.
- Initialize faction troop tier, reinforcement template, guard troops, town walkers (as egbert said and also in "game_start").
- Add new merchants and tavern keeper (module_troops).
- Set up town arena/tournament info.
- If copy scenes from town/castle that must be sieged with tower, then need to set that info.
- Initialize the new town (and its villages) economy, set up caravans if needed.
-
That's all I can remember for now.

 

JethroKirby

Knight at Arms
WB
Somebody said:
script_initialize_aristocracy is where it's all at.
Each family basically needs a distinct ancestor seed.
In Native, there are 20 lords per faction. The first at last 8 are father-sons, with randomized fraternal relationships. The middle 4 are independent lords. As for ladies, those are mother-daughter relationships, assigned to each father-son pairs, with the last 4 being sisters to the 4 independent lords iirc.

Oh, and there are many more places you need to change for your faction to work properly, especially in multiplayer.

SPD_Phoenix said:
You also need (some might not required):
- Faction banner (which appear in the diplomatic screen) if it is not player faction (module_map_icons, module_mesh, module_scene_props: same thing, different usage).
- Faction adjective string (might not need).
- Assign faction leader and lord(s) banners, renown, money.
- Initialize faction troop tier, reinforcement template, guard troops, town walkers (as egbert said and also in "game_start").
- Add new merchants and tavern keeper (module_troops).
- Set up town arena/tournament info.
- If copy scenes from town/castle that must be sieged with tower, then need to set that info.
- Initialize the new town (and its villages) economy, set up caravans if needed.
-
That's all I can remember for now.

That should help me out quite a bit guys. Without guys like you I wouldn't know a damn thing about modding. I really appreciate the help :grin:
 

Egbert

Master Knight
M&BWB
JethroKirby said:
I'm currently working on splitting the current factions into 3 or 4 different ones (one for each town). That's 22 factions all together. It works, no script errors, compiles fine, etc, but there are weird anomalies on the notes screen. Some lords/ladies have negative numbers for ages and family members from other factions. I'm thinking it might be because I split up the existing lords among the different factions instead of adding more. Could that be the case?

If you have less than 20 lords and ladies in a faction you'll want to change that script so the ":npc_seed" is based on the number of lords in the faction instead of exactly 20. I changed mine so it counts the lords and assigns the three groups by a ratio of the total lords.
 

mr.master

Count
Interesting tutorial. Seems that it still needs some information? But it basically works yes?Anyways, really needed this so thanks :grin:
 

JethroKirby

Knight at Arms
WB
I decided to post this here as it's related. I'm trying to understand the "initialize_aristocracy" script and I'm sure there are others who'd like it explained in more detail. I'm just getting into scripting - M&B pretty all I've messed with - so bear with me :smile:.

Here is what I'm getting from the script. The whole unmodified native script is in the spoiler...

("initialize_aristocracy",
[
  #LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND REPUTATIONS
 
  #King ages
  (try_for_range, ":cur_troop", kings_begin, kings_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(store_random_in_range, ":age", 50, 60),
(troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
(eq, ":cur_troop", "trp_kingdom_5_lord"),
(troop_set_slot, ":cur_troop", slot_troop_age, 47),
  (try_end),
   
  #The first thing - family structure
  #lords 1 to 8 are patriarchs with one live-at-home son and one daughter. They come from one of six possible ancestors, thus making it likely that there will be two sets of siblings
  #lords 9 to 12 are unmarried landowners with sisters
  #lords 13 to 20 are sons who still live in their fathers' houses
  #For the sake of simplicity, we can assume that all male aristocrats in prior generations either married commoners or procured their brides from the Old Country, thus discounting intermarriage

  (try_for_range, ":cur_troop", kingdom_ladies_begin, kingdom_ladies_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_lady),
  (try_end),
 
  (assign, ":cur_lady", "trp_kingdom_1_lady_1"),

  (try_for_range, ":cur_troop", lords_begin, lords_end), 
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),

(store_random_in_range, ":father_age_at_birth", 23, 26),
# (store_random_in_range, ":mother_age_at_birth", 19, 22),

(try_begin),
(is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"),
(assign, ":ancestor_seed", 1),

(else_try),
(is_between, ":cur_troop", "trp_knight_2_1", "trp_knight_3_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_2_1"),
(assign, ":ancestor_seed", 7),

(else_try),
(is_between, ":cur_troop", "trp_knight_3_1", "trp_knight_4_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_3_1"),
(assign, ":ancestor_seed", 13),

(else_try),
(is_between, ":cur_troop", "trp_knight_4_1", "trp_knight_5_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_4_1"),
(assign, ":ancestor_seed", 19),

(else_try),
(is_between, ":cur_troop", "trp_knight_5_1", "trp_knight_6_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_5_1"),
(assign, ":ancestor_seed", 25),

(else_try),
(is_between, ":cur_troop", "trp_knight_6_1", "trp_kingdom_1_pretender"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_6_1"),
(assign, ":ancestor_seed", 31),

(try_end),


(try_begin),
(lt, ":npc_seed", :cool:, #NPC seed is the order in the faction
(assign, ":reputation", ":npc_seed"),
(store_random_in_range, ":age", 45, 64),

(store_random_in_range, ":father", 0, 6), #six possible fathers
(val_add, ":father", ":ancestor_seed"),
(troop_set_slot, ":cur_troop", slot_troop_father, ":father"),

#wife
(troop_set_slot, ":cur_troop", slot_troop_spouse, ":cur_lady"),
(troop_set_slot, ":cur_lady", slot_troop_spouse, ":cur_troop"),
(store_random_in_range, ":wife_reputation", 20, 26),
(try_begin),
(eq, ":wife_reputation", 20),
(assign, ":wife_reputation", lrep_conventional),
(try_end),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":wife_reputation"),


(call_script, "script_init_troop_age", ":cur_lady", 49),
(call_script, "script_add_lady_items", ":cur_lady"),

(val_add, ":cur_lady", 1),

#daughter
(troop_set_slot, ":cur_lady", slot_troop_father, ":cur_troop"),
(store_sub, ":mother", ":cur_lady", 1),
(call_script, "script_init_troop_age", ":cur_lady", 19),
(troop_set_slot, ":cur_lady", slot_troop_mother, ":cur_lady"),
(store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived
(try_begin),
(le, ":lady_reputation", 25),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"),
(else_try),
(eq, ":lady_reputation", 26),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":lady_reputation", 27),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(else_try),
(assign, ":guardian_reputation", ":reputation"),
(try_begin),
(this_or_next|eq, ":guardian_reputation", lrep_martial),
(eq, ":guardian_reputation", 0),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":guardian_reputation", lrep_quarrelsome),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly),
(else_try),
(eq, ":guardian_reputation", lrep_selfrighteous),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_cunning),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_goodnatured),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_debauched),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_upstanding),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(try_end),
(try_end),

(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
#high renown

(else_try), #Older unmarried lords
(is_between, ":npc_seed", 8, 12),

(store_random_in_range, ":age", 25, 36),
(store_random_in_range, ":reputation", 0, :cool:,

(store_random_in_range, ":sister_reputation", 20, 26),
(try_begin),
(eq, ":sister_reputation", 20),
(assign, ":sister_reputation", lrep_conventional),
(try_end),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":sister_reputation"),

(troop_set_slot, ":cur_lady", slot_troop_guardian, ":cur_troop"),

(call_script, "script_init_troop_age", ":cur_lady", 21),
(call_script, "script_add_lady_items", ":cur_lady"),

(val_add, ":cur_lady", 1),

(else_try), #Younger unmarried lords
#age is father's minus 20 to 25
(store_sub, ":father", ":cur_troop", 12),
(troop_set_slot, ":cur_troop", slot_troop_father, ":father"),
(troop_get_slot, ":mother", ":father", slot_troop_spouse),
(troop_set_slot, ":cur_troop", slot_troop_mother, ":mother"),

(troop_get_slot, ":father_age", ":father", slot_troop_age),
(store_sub, ":age", ":father_age", ":father_age_at_birth"),

(try_begin), #50% chance of having father's rep
(store_random_in_range, ":reputation", 0, 16),

(gt, ":reputation", 7),
(troop_get_slot, ":reputation", ":father", slot_lord_reputation_type),
(try_end),
(try_end),

(try_begin),
(eq, ":reputation", 0),
(assign, ":reputation", 1),
(try_end),

        (troop_set_slot, ":cur_troop", slot_lord_reputation_type, ":reputation"),

(call_script, "script_init_troop_age", ":cur_troop", ":age"),
  (try_end),
 
  (try_begin),
    (eq, "$cheat_mode", 1),
    (assign, reg3, "$cheat_mode"),
    (display_message, "@{!}DEBUG -- Assigned lord reputation and relations"),

#     (display_message, "str_assigned_lord_reputation_and_relations_cheat_mode_reg3"), #This string can be removed
  (try_end),
 
  (try_for_range, ":cur_troop", pretenders_begin, pretenders_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_inactive_pretender),
(store_random_in_range, ":age", 25, 30),
(troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
(eq, ":cur_troop", "trp_kingdom_5_pretender"),
(troop_set_slot, ":cur_troop", slot_troop_age, 45),
  (try_end),
]),

If I halve the number of lords to 10 per faction instead of 20, all of the numbers/number ranges highlighted in green need to be halved as well right? I'm unsure what I need to do with what I've highlighted in purple (if anything), and I'm assuming the part I've highlighted in blue needs to be extended to include all of my factions. I've no clue what the :ancestor_seed and the associated number is for (highlighted in red), but I'm assuming I need to add six to the number for each faction added... or does that number need to change since the number of lords per faction is 10 instead of 20?
 

Egbert

Master Knight
M&BWB
Add the right code for any new factions:
          (is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"),
        (store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"),

You should have three places where it sets the range based on 20 lords:
      (try_begin),
        (lt, ":npc_seed", :cool:, #NPC seed is the order in the faction

      (else_try),  #Older unmarried lords
        (is_between, ":npc_seed", 8, 12),

      (else_try),  #Younger unmarried lords
        #age is father's minus 20 to 25
        (store_sub, ":father", ":cur_troop", 12),

Adjust this for the number of older lords:
        (store_random_in_range, ":father", 0, 6), #six possible fathers

I didn't figure out the "ancestor_seed".
 
Thank you for this tutorial. I have a problem with the files, though. While you are able to open these files and see words and phrases, I can only see numbers. What program are you opening them with? Does it have to be something other than Notepad?
 

Somebody

Code Pope
Baron
WBWF&S
You have to enchant your notepad by sacrificing your eldest offspring and dousing your monitor with it.
No, you'll need the module system.
 

Nord Champion

Grandmaster Knight
M&BWBWF&SNW
TheCleverPeasant said:
Thank you for this tutorial. I have a problem with the files, though. While you are able to open these files and see words and phrases, I can only see numbers. What program are you opening them with? Does it have to be something other than Notepad?

I use the module system, which this is for..
Big_Mac said:
Good tutorial, is deleting a faction close to reversing this process?
You should try :grin:
 
Top Bottom