SP Tutorial Module System Changing AI lords' age

Users who are viewing this thread

John25-

Sergeant at Arms
Hi everyone, this is how to change AI lords' age

As you probably know, AI lords and ladies can be:
- A king (between 50 and 60 years old)
- A father (between 45 and 64 years old) and his spouse (aged 49)
- A son (between 22 and 39 years old) and his sister (aged 19)
- An unaffiliated lord (between 25 and 36 years old) and his sister (aged 21)

Their age can be edited in module_scripts.py (module system required)

#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"),

(try_begin),
(lt, ":npc_seed", 8*), #NPC seed is the order in the faction
(assign, ":reputation", ":npc_seed"),
(store_random_in_range, ":age", 45, 64),
You will have to remove the * - this was to prevent the creation of a smiley :cool:

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

#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),

(store_random_in_range, ":age", 22, 39),

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

(store_random_in_range, ":age", 25, 36),

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


So now what you have to do is to
- Change the figures, or
- If you want female characters to also have a random age:
Select this line (I have put "0" as an example, to be changed with your own figures) :
(call_script, "script_init_troop_age", ":cur_lady", 0),

And replace with:
(store_random_in_range, ":age", 0, 0),
(call_script, "script_init_troop_age", ":cur_lady", ":age"),

I hope this has been helpful, please let me know if you face any issues
 
Back
Top Bottom