Modding VC: basic tutorials and Q&A thread

Users who are viewing this thread

AfLIcTeD

Sergeant at Arms
I'm having a few issues with modding. I'm trying to make it so the my kingdom's center reinforcements are based off of my culture rather than the original faction's.

I have pretty much zero coding experience bar changing a few numbers.

("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"),
      (party_get_slot, ":party_type",":party_no", slot_party_type),
     
      #Rebellion changes begin:
      (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
      (try_end),
      #Rebellion changes end
     
      (try_begin),
        (eq, ":party_no", "p_main_party"),
        (try_begin),
          (is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
          (assign, ":party_faction", "$players_kingdom"),
        (else_try),
          (assign, ":party_faction", "fac_player_supporters_faction"),
        (try_end),
       
      (else_try),
        (eq, ":party_faction", "fac_player_supporters_faction"),
        (is_between, ":party_no", walled_centers_begin, walled_centers_end),
        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
        (try_begin),
          (gt, ":town_lord", 0),
          (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction),
        (else_try),
          (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
        (try_end),
      (try_end),

I think it is this part in scripts.py, could be wrong. Was wondering if someone could help. Thx
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Download VC Tweaks Tool and you can find that tweak there (how and where to change)

You can then apply it to your own mod (even if you don’t want the tool)
 

AfLIcTeD

Sergeant at Arms
I have the tweak tool and tried using that tweak for it, but wouldn't compile properly. Was thinking of using Slot_faction_culture, but not sure what other inputs to use.

Just to clarify by center reinforcements I meant the auto garisson you get, not recruits from villages/towns.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
towns are static parties. Soldiers (garrison) are part of the town as stacks. The script used to add soldiers to a party is "script_cf_reinforce_party"

party#1
  stacks
  stack#1
    troop_id=XX, quantity=YY
  stack#2
  ....
 

King Yngvar

Squire
WBVC
I've found that it is possible to change it so that defected lords start recruiting troops from their new faction's culture and it works fine, until you as the player start your own faction. "script error on opcode", some lords not recruiting any units, some hero npc lords recruiting random troops based on where I gave them a fief, some recruiting their original troops. I wonder why the lords can't get the player culture while they can get the culture of npc kings. Is the culture not properly set by the start selection screen, could it work better if we could find a way to add a popup culture selection once we create a kingdom?

There are a couple of other alternatives I've considered but I know no way of implementing them.

Alternative 1: Force AI lords to only consider factions of the same culture when they defect to other AI controlled factions.

Alternative 2: Put on the tweaks for village and center recruits from current faction and find a way to force lords to recruit from villages and centers instead of giving them auto reinforcements.


EDIT: This is the one I tried most recently that worked for AI factions (added line in red), something extra for "fac_player_supporters_faction" that could be added?

      (troop_set_faction, ":troop_no", ":faction_no"),
      (troop_set_slot, ":troop_no", slot_troop_recruitment_random, 0),
      (troop_set_slot, ":troop_no", slot_lord_recruitment_argument, 0),
      (troop_set_slot, ":troop_no", slot_lord_recruitment_candidate, 0),
      (troop_set_slot, ":troop_no", slot_troop_promised_fief, 0),

#test
      (troop_set_slot, ":troop_no", slot_troop_original_faction, ":faction_no"),   
#test
     
      #Give new title
      (call_script, "script_troop_set_title_according_to_faction", ":troop_no", ":faction_no"), #new title system
     
      (try_begin),
        (this_or_next|eq, ":faction_no", "$players_kingdom"),
        (eq, ":faction_no", "fac_player_supporters_faction"),
        (call_script, "script_check_concilio_calradi_achievement"),
      (try_end),
 

AfLIcTeD

Sergeant at Arms
Thats because the players faction doesn't have any slot_faction_reinforcments to recruit from. You can add them using the save editor, can even add new party templates to recruit from.

When the players faction is created you would need to get it to set those slots based on your culture.

I think it would take alot of coding to do it all via scripting, thats why i do it with save editor, I also removed the player kingdom specific part of cf_reinforce_party, this was the only way I could have garrisons of the culture I chose.

I'm thinking and I could be wrong something like.

Code:
(try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
(this_or_next|eq, ":faction_no", "$players_kingdom"),
(eq, ":faction_no",  "fac_player_supporter_faction"),
(try_begin),
  (slot_faction_eq, ":faction_no", slot_faction_culture, "fac_norse_culture),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_a, "pt_norse_reinforcements_a),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_b, "pt_norse_reinforcements_b),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_c, "pt_norse_reinforcements_c),
(else_try),
etc... (do this for each culture)

Like I said i could be wrong.

 

AfLIcTeD

Sergeant at Arms
So I've been doing alot more modding lately and I'm beginning to get an understanding of it (if you look at it long enough stuff starts to make sense).
So I'm trying to get it so the scriptorium will apply it's bonus to all lords that have a town with one including the player, but it doesn't seem to work.
This is what i have so far.

#SCRIPTORIUM
          (try_begin),
            (party_slot_eq, ":center_no", slot_center_has_university, 1),
            (str_store_party_name_link, s1, ":center_no"),
(is_between, ":center_no", walled_centers_begin, walled_centers_end),
(party_get_slot, ":town_lord", ":center_no", slot_town_lord),
            #(troop_get_slot, ":player_renown", "trp_player", slot_troop_renown),
            #(le, ":player_renown", 15000),
            #(store_random_in_range, ":rand", 0, 100),#JuJu70
            #(le, ":rand", 50),#JuJu70
    (try_begin),    
  (gt, ":town_lord", 0),
  (store_random_in_range, ":renown_change", 10, 30),
(else_try) ,
    (store_random_in_range, ":renown_change", 100, 300),
(try_end),
(troop_get_slot, ":eek:ld_renown", ":town_lord", slot_troop_renown),
(store_add, ":new_renown", ":eek:ld_renown", ":renown_change"),
(troop_set_slot, ":town_lord", slot_troop_renown, ":new_renown"),
            #(store_random_in_range, ":renown_change", 10, 30), # 1, 2 or 3  
            #(troop_get_slot, ":eek:ld_renown", "trp_player", slot_troop_renown),
            #(store_add, ":new_renown", ":eek:ld_renown", ":renown_change"),
            #(troop_set_slot, "trp_player", slot_troop_renown, ":new_renown"),
            (display_message, "@The scriptorium in {s1} adds to your renown."),
            #(call_script, "script_change_troop_renown", "trp_player", 4), #MOTO this should probably be a one-shot addition; from 6 to 3
          (try_end),

I tried just targeting the troop ids before and it worked, it gave them renown, but it gave all my lords renown, not just the ones with towns. It also wouldn't work for me, so I tried it this way and targeted the slot_town_lord, but still won't work.
I have commented out some of the original for easy reverting. So am I on the right track or am I way off and going completely off rails? Any help would be really appreciated.
 

King Yngvar

Squire
WBVC
AfLIcTeD said:
Thats because the players faction doesn't have any slot_faction_reinforcments to recruit from. You can add them using the save editor, can even add new party templates to recruit from.

When the players faction is created you would need to get it to set those slots based on your culture.

I think it would take alot of coding to do it all via scripting, thats why i do it with save editor, I also removed the player kingdom specific part of cf_reinforce_party, this was the only way I could have garrisons of the culture I chose.

I'm thinking and I could be wrong something like.

Code:
(try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
(this_or_next|eq, ":faction_no", "$players_kingdom"),
(eq, ":faction_no",  "fac_player_supporter_faction"),
(try_begin),
  (slot_faction_eq, ":faction_no", slot_faction_culture, "fac_norse_culture),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_a, "pt_norse_reinforcements_a),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_b, "pt_norse_reinforcements_b),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_c, "pt_norse_reinforcements_c),
(else_try),
etc... (do this for each culture)

Like I said i could be wrong.

If this works, you could just compile different files depending on which culture you intend to play as. I'm going to give it another shot, thanks.

Edit: Just to be sure, when you said you removed the player kingdom specific part of cf_reinforce_party, I'm guessing you commented out all in green here, what about that bit in red?

  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"),
      (party_get_slot, ":party_type",":party_no", slot_party_type),
     
      #Rebellion changes begin:
      (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
      (try_end),
      #Rebellion changes end
     
      (try_begin),
        (eq, ":party_no", "p_main_party"),
        (try_begin),
          (is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
          (assign, ":party_faction", "$players_kingdom"),
        (else_try),
          (assign, ":party_faction", "fac_player_supporters_faction"),
        (try_end),

       
      (else_try),
        (eq, ":party_faction", "fac_player_supporters_faction"),
        (is_between, ":party_no", walled_centers_begin, walled_centers_end),
        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
        (try_begin),
          (gt, ":town_lord", 0),
          (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction),
        (else_try),
          (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
        (try_end),
      (try_end),
     
      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),
 

kalarhan

Python Saint
Count
WBNWVCWF&S
RyanMan12 said:
Is there away to modify weapon stats? Or change if they can be used on horseback?

see file module_items.py, you can change the stats and flags (like usable on horseback) there. If you didnt yet you can check basic modding instructions on the initial posts of this thread (what is modsys, where to download, links, etc)
 

AfLIcTeD

Sergeant at Arms
King Yngvar said:
AfLIcTeD said:
Thats because the players faction doesn't have any slot_faction_reinforcments to recruit from. You can add them using the save editor, can even add new party templates to recruit from.

When the players faction is created you would need to get it to set those slots based on your culture.

I think it would take alot of coding to do it all via scripting, thats why i do it with save editor, I also removed the player kingdom specific part of cf_reinforce_party, this was the only way I could have garrisons of the culture I chose.

I'm thinking and I could be wrong something like.

Code:
(try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
(this_or_next|eq, ":faction_no", "$players_kingdom"),
(eq, ":faction_no",  "fac_player_supporter_faction"),
(try_begin),
  (slot_faction_eq, ":faction_no", slot_faction_culture, "fac_norse_culture),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_a, "pt_norse_reinforcements_a),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_b, "pt_norse_reinforcements_b),
  (faction_set_slot, ":faction_no", slot_faction_reinforcements_c, "pt_norse_reinforcements_c),
(else_try),
etc... (do this for each culture)

Like I said i could be wrong.

If this works, you could just compile different files depending on which culture you intend to play as. I'm going to give it another shot, thanks.

Edit: Just to be sure, when you said you removed the player kingdom specific part of cf_reinforce_party, I'm guessing you commented out all in green here, what about that bit in red?

  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"),
      (party_get_slot, ":party_type",":party_no", slot_party_type),
     
      #Rebellion changes begin:
      (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
      (try_end),
      #Rebellion changes end
     
      (try_begin),
        (eq, ":party_no", "p_main_party"),
        (try_begin),
          (is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
          (assign, ":party_faction", "$players_kingdom"),
        (else_try),
          (assign, ":party_faction", "fac_player_supporters_faction"),
        (try_end),

       
      (else_try),
        (eq, ":party_faction", "fac_player_supporters_faction"),
        (is_between, ":party_no", walled_centers_begin, walled_centers_end),
        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
        (try_begin),
          (gt, ":town_lord", 0),
          (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction),
        (else_try),
          (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
        (try_end),
      (try_end),

     
      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),

The second part too. Your reinforcements will be whatever you set as your slot_faction_reinforcements.
So make sure you have those set or you will get nothing.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Vikingur said:
this ton of thrust only weapons that are listed after the item_end place holder. Can I delete all that stuff to tidy up my items list without breaking the game, or is all those things needed for game mechanics? Tanx in advance.

they are created via code (not manually) for use on the special formations feature. It forces NPCs to use normal or thrusting weapons depending on the situation.

see module_items.py. You will not find those weapon in there. Instead you have this at the end of the file

Code:
#MOTO generate no-swing versions of weapons
#Warning: this makes additions to item table non-save compatible, as the system only reads in the "new" ones, effectively overwriting the real new ones
#It may be best to comment out until the table is set
append_noswing_items(items)
 

Vikingur

Sergeant at Arms
kalarhan said:
Vikingur said:
this ton of thrust only weapons that are listed after the item_end place holder. Can I delete all that stuff to tidy up my items list without breaking the game, or is all those things needed for game mechanics? Tanx in advance.

they are created via code (not manually) for use on the special formations feature. It forces NPCs to use normal or thrusting weapons depending on the situation.

see module_items.py. You will not find those weapon in there. Instead you have this at the end of the file

Code:
#MOTO generate no-swing versions of weapons
#Warning: this makes additions to item table non-save compatible, as the system only reads in the "new" ones, effectively overwriting the real new ones
#It may be best to comment out until the table is set
append_noswing_items(items)

Cheers for that! So I assume it’s auto generated upon loading the module.py. So if I delete it and carry on, it will come back when a new game is started as long as it’s not removed from the module.py? Sorry for noob questions.
 

Vikingur

Sergeant at Arms
delete what?
Right, so I’ve added custom items armours and weapons. I want to test their, looks, reach, hand positions. So I’ve added them to the cheat menu. For testing purposes I’ve deleted all those items so I can quickly access the new items for testing. Otherwise I have to get them in game other ways, which takes longer. If you want to add them in the cheat menu, you have to account for all those items for the total items in the list. So it’s easier for me to do away with them at this time. I was asking, will they come back after I’ve finished and reload to modules script, or do I have to add them manually?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Vikingur said:
So it’s easier for me to do away with them at this time. I was asking, will they come back after I’ve finished and reload to modules script, or do I have to add them manually?

if you run the build_module.bat they will be created again, or just keep a backup (copy) of your item_kinds1.txt and create a new game (cant load a old save file).

if you want to test stuff why not include your new items on the player character inventory? No need to search for them using the cheat menu (faster).
 

Blooorp

Recruit
Hey !

I am trying to add recruitment to the player lair in VC.

Tried to do it two ways, first by basically duplicating the village recruitment code to use it in the lair :

To do this I added the "recruit_volunteers" from the "village" entry in module_game_menus.py to the "player_lair_menus" and added
Code:
(store_random_in_range, ":test_lair", 0, 149),
(try_begin),
  (eq, ":test_lair", 0),
  (call_script, "script_update_npc_volunteer_troops_in_village", "p_yourlair"),
(try_end),
just after
Code:
(call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
in module_simple_triggers.py

Second was by using forums.taleworlds.com/index.php/topic,202029.0.html and replacing some parts to make it work for "p_yourlair" and not castles or towns.

Sadly none of these worked, with the first try it either didn't show any recruitment menu in the refuge or showed it all the time with no recruits available(Got this when I tried to tweak the conditions for the menu appearance). The second try didn't ever make the recruitment menu appear.

I believe I may have 2 issues, first I don't have a clue on how to set up or tweak conditions for the appearance of a menu and second is the number of available troops in the refuge that doesn't seem to ever update.

I'm pretty new to all this but I'm having quite a lot of fun, if anyone could help, would be really nice !  :grin:
 

Blooorp

Recruit
Sorry, there it is :smile:

In module_scripts.py
Code:
  #script_cf_lair_recruit_volunteers_cond
  # INPUT: none
  # OUTPUT: none
  ("cf_lair_recruit_volunteers_cond",
    [(store_faction_of_party, ":town_faction", "$current_town"),
      (party_get_slot, ":center_relation", "$current_town", slot_center_player_relation),
      (store_relation, ":town_faction_relation", ":town_faction", "fac_player_faction"),
      (ge, ":center_relation", 0),
      (this_or_next|ge, ":center_relation", 5),
      (this_or_next|eq, ":town_faction", "$players_kingdom"),
      (this_or_next|ge, ":town_faction_relation", 0),
      (this_or_next|eq, ":town_faction", "$supported_pretender_old_faction"),
      (eq, "$players_kingdom", 0),
      (party_slot_ge, "$current_town", slot_center_volunteer_troop_amount, 0),
      (party_slot_ge, "$current_town", slot_center_volunteer_troop_type, 1),
      (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
      (ge, ":free_capacity", 1),
    ]),
  
  #script_village_recruit_volunteers_recruit
  # INPUT: none
  # OUTPUT: none
  ("village_recruit_volunteers_recruit",
    [(party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
      (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
      (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
      (val_min, ":volunteer_amount", ":free_capacity"),
      (store_troop_gold, ":gold", "trp_player"),
      (call_script, "script_cost_per_village_recruit"),  #MOTO chief variable cost
      (assign, ":recruit_cost", reg0),
      (store_div, ":gold_capacity", ":gold", ":recruit_cost"),#10 denars per man MOTO chief change to variable cost
      (val_min, ":volunteer_amount", ":gold_capacity"),
      (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
      (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
      (store_mul, ":cost", ":volunteer_amount", ":recruit_cost"),#10 denars per man MOTO chief change to variable cost
      (troop_remove_gold, "trp_player", ":cost"),
  ]),
  
  #script_lair_recruit
  # INPUT: none
  # OUTPUT: none
  ("lair_recruit",
    [(store_faction_of_party, ":cur_faction", "$current_town"),
     (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_1_troop),
    (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 200),#200 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 200),#200 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

In module_simple_triggers.py
Code:
    # Adding mercenary troops to the towns tri-daily ON AVERAGE
    (8,
      [
        (store_random_in_range, ":switch", 0, 9),
        
        (try_begin),
          (eq, ":switch", 0),
          (call_script, "script_update_mercenary_units_of_towns"),
          #NPC changes begin
          # removes   (call_script, "script_update_companion_candidates_in_taverns"),
          #NPC changes end
        (else_try),
          (eq, ":switch", 1),
          (call_script, "script_update_ransom_brokers"),
        (else_try),
          (eq, ":switch", 2),
          (call_script, "script_update_tavern_travellers"),
        (else_try),
          (eq, ":switch", 3),
          (call_script, "script_update_tavern_minstrels"),
        (else_try),
          (eq, ":switch", 4),
          (call_script, "script_update_booksellers"),
        (else_try),
          (eq, ":switch", 5),
          (call_script, "script_update_companion_candidates_in_taverns"),
        (else_try),
          (call_script, "script_update_other_taverngoers"), #happens once a day ON AVERAGE
        (try_end),
		
		(store_random_in_range, ":test_lair", 0, 8),
		(try_begin),
		  (eq, ":test_lair", 0),
		  (call_script, "script_update_npc_volunteer_troops_in_village", "p_yourlair"),
		  (call_script, "script_update_volunteer_troops_in_village", ":p_yourlair"),
		(try_end),
    ]),

In module_game_menus
Code:
(
    "player_lair_menus",mnf_enable_hot_keys,
    "You are at {s10}, your very own refuge, a hidden retreat free from enemies, where you can hide when things go badly, rest from your travels, or save your most personal of treasures. " +
    "^^{s11}^^{s13}",
    "none",
    [
      (str_clear, s10),
      (str_clear, s11),
      (str_clear, s13),
      (store_encountered_party, "$current_town"),
      # ## player photo
      # (try_begin),
        # (set_fixed_point_multiplier, 100),
        # (position_set_x, pos0, 70),
        # (position_set_y, pos0, 5),
        # (position_set_z, pos0, 75),
        # (set_game_menu_tableau_mesh, "tableau_troop_note_mesh", "trp_player", pos0),
      # (try_end),
      # ## player photo
      (str_store_party_name, s10, "$current_town"),
      (party_get_num_companions, reg5 , "$g_encountered_party"),
      (call_script,"script_game_get_lair_garrison_limit","$g_encountered_party"),
      (str_store_string,s11,"@Garrison: {reg5} (limit: {reg0})^^ Having your men garrison the refuge, like for castles and cities, allows them to rest away from the dangers of road and battle and reduces their maintenance cost."),
      (set_background_mesh, "mesh_pic_thing"),
      (assign, "$talk_context", 0),
    #],
	
	#[
	  (call_script, "script_check_village_menu_conditions"),
	  (assign, "$curr_menu_slot", 30),
    ],
	
    [
      
      ("banquete_refugemead",
        [(eq, "$banquete_refuge", 0),
          (party_slot_eq, "$g_encountered_party", slot_lair_improve, 4), #max improvement need to
        ],
        "My men deserve a banquet in my refuge.",
        [
          (try_begin),
            (eq, "$hire_cook1", hire_cook1),
            (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
            (reset_visitors), #entry points
            (set_visitor,0,"trp_player"),
            (set_visitor,17,"trp_cook_lair"),
            (set_jump_mission,"mt_conversation_encounter"),
            (jump_to_scene,"scn_conversation3people_scene"),
            (change_screen_map_conversation, "trp_cook_lair"),
          (else_try),
            (display_message,"@You need to hire a cook first."),
          (try_end),
        ]
      ),
      
      ("guarida_rename", [],
        "Rename your refuge.",
        [
          (start_presentation, "prsnt_set_playerlair_name")
      ]),
      
      ("lair_interior",
        [
          (party_get_slot, ":stage", "$g_encountered_party", slot_lair_improve),
          (ge, ":stage", 2),
        ],"Go to the refuge's hall.", #chief
        [
          (set_jump_mission, "mt_lair_interior"),
          
          (modify_visitors_at_site,"scn_player_hideout_house"),
          
          (reset_visitors),
          (try_begin),
            (eq, "$hire_barber1", hire_barber1),
            (set_visitor, 39, "trp_lair_barber1"),
          (try_end),
          (try_begin),
            (eq, "$hire_barber1", hire_barber2),
            (set_visitor, 39, "trp_lair_barber2"),
          (try_end),
          (try_begin),
            (eq, "$hire_barber1", hire_barber3),
            (set_visitor, 39, "trp_lair_barber3"),
          (try_end),
          (try_begin),
            (eq, "$hire_barber1", hire_barber4),
            (set_visitor, 39, "trp_lair_barber4"),
          (try_end),
          
          (try_begin),
            (eq, "$hire_cook1", hire_cook1),
            (set_visitor, 40, "trp_cook_lair"),
          (try_end),
          
          (try_begin),
            (eq, "$hire_priest1", hire_priest2),
            (set_visitor, 41, "trp_pagano_lair"),
          (try_end),
          (try_begin),
            (eq, "$hire_priest1", hire_priest1),
            (set_visitor, 41, "trp_sacerdote_lair"),
          (try_end),
          
          (try_begin),
            (eq, "$bard_type", hire_bard1),
            (set_visitor, 42, "trp_skald_lair"),
          (try_end),
          (try_begin),
            (eq, "$bard_type", hire_bard2),
            (set_visitor, 42, "trp_bardo_lair"),
          (try_end),
          
          (assign, ":cur_entry", 10),
          (try_for_range, ":companion_candidate", companions_begin, companions_end),
            
            (party_get_num_companion_stacks, ":num_stacks", "$g_encountered_party"),
            (try_for_range, ":troop_iterator", 0, ":num_stacks"),
              
              (party_stack_get_troop_id, ":cur_troop_id", "$g_encountered_party", ":troop_iterator"),
              (eq, ":companion_candidate", ":cur_troop_id"),
              #(troop_is_hero, ":cur_troop_id"),
              (set_visitor, ":companion_candidate", ":cur_entry"),
              
              (val_add, ":cur_entry", 1),
            (try_end),
          (try_end),
          
          (set_jump_entry, 0),
          #  (scene_set_slot, "scn_lair_exterior", slot_scene_visited, 1),
          (jump_to_scene,"scn_player_hideout_house"),
          (change_screen_mission),
      ], "Gate to your refuge."),
      
      ("visit_tavern_lair",
        [
          (party_get_slot, ":stage", "$g_encountered_party", slot_lair_improve),
          (ge, ":stage", 2),
        ],"Go to the mead hall.", #chief
        [
          (set_jump_mission, "mt_lair_interior"),
          (assign, "$talk_context", tc_tavern_talk),
          
          (modify_visitors_at_site,"scn_player_hideout_tavern"),
          (reset_visitors),
          (try_begin),
            (eq, "$hire_whore1", hire_whore1),
            (set_visitor, 21, "trp_quastuosa_lair1"),
          (try_end),
          (try_begin),
            (eq, "$hire_whore1", hire_whore2),
            (set_visitor, 21, "trp_quastuosa_lair2"),
          (try_end),
          (try_begin),
            (eq, "$hire_whore1", hire_whore3),
            (set_visitor, 21, "trp_quastuosa_lair3"),
          (try_end),
          (try_begin),
            (eq, "$hire_whore1", hire_whore4),
            (set_visitor, 21, "trp_quastuosa_lair4"),
          (try_end),
          
          (try_begin),
            (eq, "$hire_tavernkeeper1", hire_tavernkeeper1),
            (set_visitor, 20, "trp_town_30_tavernkeeper"),
          (try_end),
          
          (set_jump_entry, 0),
          #  (scene_set_slot, "scn_lair_exterior", slot_scene_visited, 1),
          
          (jump_to_scene,"scn_player_hideout_tavern"),
          (change_screen_mission),
      ], "Door to the mead hall."),
      
      ("lair_buildings_improve",
        [  (eq, "$captain_ok", hire_captainok),
        ],"Talk to your captain.", #chief
        [
          (modify_visitors_at_site,"scn_conversation3people_scene"),#player entry point 16, and then 17, 18, 19 for NPC's, opposite the player. 17 must be g_talk troop
          (reset_visitors), #entry points
          (set_visitor,0,"trp_player"),
          (set_visitor,17,"trp_lair_captain"),
          (set_jump_mission,"mt_conversation_encounter"),
          (jump_to_scene,"scn_conversation3people_scene"),
          (change_screen_map_conversation, "trp_lair_captain")
      ], "Gate to your refuge."),
      
      
      ("hirelair_staff",
        [
          ##		(party_get_slot, ":stage", "$g_encountered_party", slot_lair_improve),
          ##		(ge, ":stage", 1),
        ],
        "Hire staff.",
        [
          (start_presentation, "prsnt_lair_hire_staff"),
          #(jump_to_menu, "mnu_contratar_personal")
      ]),
      
      
      ("lair_inspect", [
          (try_begin),  #forbidden to enter?
            (store_time_of_day,reg(12)),
            (ge,reg(12),5),
            (lt,reg(12),21),
            (assign,":lair_nighttime",0),
          (else_try),
            (assign,":lair_nighttime",1),
            (str_store_string, s13, "@It is night, and your refuge seems quiet, with some men watching while others are asleep."),
          (try_end),
          (eq,":lair_nighttime",0),
        ],
        "Take a walk around your refuge.",
        [
          (try_begin),
            (party_slot_eq, "$g_encountered_party", slot_lair_improve, 4), #Refuge
            (assign, ":lair_scene", "scn_player_hideout_5"),
          (else_try),
            (party_slot_eq, "$g_encountered_party", slot_lair_improve, 3), #Refuge
            (assign, ":lair_scene", "scn_player_hideout_4"),
          (else_try),
            (party_slot_eq, "$g_encountered_party", slot_lair_improve, 2), #hideout
            (assign, ":lair_scene", "scn_player_hideout_3"),
          (else_try),
            (party_slot_eq, "$g_encountered_party", slot_lair_improve, 1), #hideout
            (assign, ":lair_scene", "scn_player_hideout_2"),
          (else_try),
            (assign, ":lair_scene", "scn_player_hideout_1"),#permanent camp
          (try_end),
          
          (modify_visitors_at_site,":lair_scene"),
          (reset_visitors, 0),
          (set_visitor,0,"trp_player"),
          
          (try_begin),
            (eq, "$captain_ok", hire_captainok),
            (set_visitor, 11, "trp_lair_captain"),
          (try_end),
          
          (try_begin),
            (eq, "$hire_smith1", hire_smith1),
            (set_visitor, 12, "trp_town_30_weaponsmith"),
          (try_end),
          (try_begin),
            (eq, "$hire_armorer1", hire_armorer1),
            (set_visitor, 13, "trp_town_30_armorer"),
          (try_end),
          (try_begin),
            (eq, "$hire_trainer1", hire_trainer1),
            (set_visitor, 9, "trp_trainer_2"),
          (try_end),
          ###garrison troops
          (assign, ":party", "p_yourlair"),
          (assign,":count",18),
          
          ##           (assign, ":archer_no", 17),
          ##           (assign, ":cavalry_no", 26),
          ##          (assign, ":infantry_no", 30),
          
          (party_get_num_companion_stacks, ":num_stacks", ":party"), #1 man each troop type
          (try_for_range, ":troop_iterator", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":cur_troop_id", ":party", ":troop_iterator"),
            (neg|troop_is_hero, ":cur_troop_id"),##
            (assign, ":total_valor", 0),
            (call_script, "script_count_troops_inparty", ":party", ":cur_troop_id"),
            (val_add, ":total_valor", reg0),
            
            (try_begin),
              (party_slot_eq, "$g_encountered_party", slot_lair_improve, 4), #Refuge
              (ge,":total_valor",2),
              (assign,":total_valor",2),
            (else_try),
              (party_slot_eq, "$g_encountered_party", slot_lair_improve, 3), #Refuge
              (ge,":total_valor",2),
              (assign,":total_valor",2),
            (else_try),
              (party_slot_eq, "$g_encountered_party", slot_lair_improve, 2), #hideout
              (ge,":total_valor",1),
              (assign,":total_valor",1),
            (else_try),
              (party_slot_eq, "$g_encountered_party", slot_lair_improve, 1), #hideout
              (ge,":total_valor",1),
              (assign,":total_valor",1),
            (else_try),
              (ge,":total_valor",1),
              (assign,":total_valor",1),
            (try_end),
            
            
            (try_begin),
              (le,":count",56),
              (set_visitors,":count",":cur_troop_id", ":total_valor"),
              (store_random_in_range, ":esposas", 0, 100),
              (try_begin),
                (ge,":esposas",80),
                (set_visitor, ":count", "trp_fighter_woman",1),
              (else_try),
                (ge,":esposas",30),
                (set_visitor, ":count", "trp_follower_woman",1),
              (else_try),
                (ge, ":esposas", 15),
                (set_visitor, ":count", "trp_nino_varon",1),
              (else_try),
                (set_visitor, ":count", "trp_nina_chica",1),
              (try_end),
            (try_end),
            (val_add,":count",1),
          (try_end),
          
          ##
          
          (set_jump_mission,"mt_lair_visit"),
          ##             (try_begin),
          ##               (eq, "$town_entered", 0),
          ##               (assign, "$town_entered", 1),
          ##               (eq, "$town_nighttime", 0),
          ##             (try_end),
          (set_jump_entry, 1),
          (jump_to_scene, ":lair_scene"),
          (change_screen_mission),
      ], "Go to the square."),
      
      ("mylair_station_troops",
        [
        ],
        "Manage the garrison.",
        [
          (party_get_num_companions,":companions", "$g_encountered_party"),
          (call_script,"script_game_get_lair_garrison_limit","$g_encountered_party"),
          (assign, ":limit", reg0),
          (try_begin),
            (gt, ":companions", ":limit"),
            (display_message,"@Your garrison size exceeds the maximum allowed number of soldiers that can be stationed at your refuge. This will produce discontent among men and desertions!",0xFFFF0000),
          (try_end),
          (change_screen_exchange_members,1),
          (display_message,"@Garrison limit: {reg0}",0xFFFF0000),
          (display_message,"@The ramshackle prison at your refuge is not very secure. Your captain suggests not to keep lords here!",0xFFFF0000),
          ##	     (else_try),
          ## 		(display_message,"@It is impossible to garrison more men here. All spots are occupied!",0xFFFF0000),
          ##            (try_end),
      ]),
      
      ("demoler_lair", [(eq, "$lair_on", 1),], "Demolish your personal refuge.",
        [
          (jump_to_menu, "mnu_demoler_lairm")
      ]),
      
      ("lair_wait",[],
        "Wait here for some time.",
        [
          (assign, "$auto_enter_town", "p_yourlair"),
          (assign,"$g_camp_mode", 1),
          (assign, "$g_player_icon_state", pis_camping),
          (assign, "$g_infinite_camping", 0),
          #(assign, "$g_town_visit_after_rest", 1),
          (assign, "$g_last_rest_center", "$current_town"),
          
          #(assign, "$auto_enter_town", "p_yourlair"),
          #(assign, "$g_town_visit_after_rest", 1),
          # (assign, "$g_last_rest_center", "$current_town"),
          
          (rest_for_hours_interactive, 24 * 365, 5, 1), #rest while attackable, batalla lair. Player deffend his lair.
          
          #(rest_for_hours_interactive, 24 * 365, 5, 0), #rest while not attackable
          (change_screen_return),
      ]),
      
      #VC-1878 begins
      
      ("see_ships",
        [
          (party_slot_eq, "$current_town", slot_town_port, 1),
          (party_slot_ge, "$current_town", slot_party_1_ship_type, 1),
        ],
        "See the ships.",
        [
          # (assign, "$vc_menu_active", "prsnt_vc_submenu_ships"),
          # (assign, "$ship_menu_state", 1),
          # (assign, "$current_landed_ships_party", -1),
          # (set_jump_mission,"mt_camp_on_sea"),
          # (jump_to_scene,"scn_camp_on_sea"),
          # (change_screen_mission),
          
          (assign, "$vc_menu_active", "prsnt_vc_submenu_ships"),
          (assign, "$ship_menu_state", 1),
          (set_jump_mission,"mt_town_center"),
          #(set_jump_mission,"mt_camp_on_sea"),
          (set_jump_entry, 1),
          # (party_get_slot, ":town_scene", "$current_town", slot_town_center),
          # (jump_to_scene,":town_scene"),
          (jump_to_scene, "scn_port"),
          (change_screen_mission,0),
      ]),
      
      ("embarkre",
        [
          (party_slot_eq, "$current_town", slot_town_port, 1),
          (party_slot_ge, "$current_town", slot_party_1_ship_type, 1),
        ],
        "Embark.",
        [
          (try_begin),
            (call_script, "script_cf_crew_fit_in_ships", "$current_town"),
            (assign, "$vc_menu_active", 0),
            #(assign,"$g_leave_town",1),	#?
            (call_script, "script_give_player_ships_from_party_to_party", "$current_town", "p_main_party"),
            (party_get_slot, ":curr_port", "$current_town", slot_party_port_party),
            (party_get_position, pos2, ":curr_port"),
            (party_set_position, "p_main_party", pos2),
            (call_script, "script_switch_to_water_consequences"),
            (change_screen_map),
          (else_try),
            (display_message, "str_cant_set_sail"),
          (try_end),
          
      ]),
      #VC-1878 ends
      
	  # ("recruit_volunteers",#2
        # [
		  # (val_add, "$curr_menu_slot", 1),(quest_slot_ge, "qst_vc_menu", "$curr_menu_slot", 1),
		# ],
		# "Recruit Volunteers.",
        # [(call_script, "script_execute_village_menu_cosequence", slot_quest_menu_2),]),
	  
	  ("recruit_lair",[(call_script, "script_cf_lair_recruit_volunteers_cond"),]
        ,"Recruit Volunteers.",
        [
          (try_begin),
            (call_script, "script_cf_enter_center_location_bandit_check"),
          (else_try),
            (jump_to_menu, "mnu_recruit_lair"),
          (try_end),
      ]),
	  
      ("lair_leave",[],"Leave...",
        [
          (leave_encounter),
          #(change_screen_map),
          (jump_to_menu, "mnu_auto_return_to_map"),#phaiak
      ],"Leave Area."),
  ]),
  #demoler
  ("demoler_lairm", 0, "Are you sure you want to demolish your refuge?", "none", [(set_background_mesh, "mesh_pic_thing"),],
    [
      ("demoler_yes", [
        (party_get_slot, ":stage", "$g_encountered_party", slot_lair_improve),
        (try_begin),
          (ge, ":stage", 3),
          (assign, reg1, 1000),
        (else_try),
          (assign, reg1, 500),
        (try_end),
      ], "Yes ({reg1} peningas).", [
          (store_troop_gold, ":gold_amount", "trp_player"),
          (try_begin),
            (lt, ":gold_amount", reg1),
            (display_message, "@You do not have enough money to pay men to demolish your refuge."),
          (else_try),
            (troop_remove_gold, "trp_player", reg1),
            (assign, "$g_move_heroes", 1),
            (call_script, "script_party_add_party", "p_main_party", "p_yourlair"),
            (party_clear, "p_yourlair"),
            
            #VC-3245, VC-3630
            (party_get_slot, ":port_party", "p_yourlair", slot_party_port_party),
            (try_begin),
              (gt, ":port_party", "p_spawn_points_end"),
              (party_set_flags, ":port_party", pf_no_label, 0),
              (remove_party, ":port_party"),
              (party_set_slot, "p_yourlair", slot_party_port_party, 0),
              (party_set_slot, "p_yourlair", slot_town_port, 0),
              (val_sub, "$g_number_of_map_ports", 1),
            (try_end),
            
            (try_begin),
              (neg|party_slot_eq, "p_yourlair", slot_party_player_ships_type_begin, 0),
              (party_get_position, pos1, "p_landing_point"),
              (call_script, "script_get_next_land_position", 1),
              (set_spawn_radius, 0),
              (spawn_around_party, "p_landing_point", "pt_landet_ships"),
              (assign, ":landet_ship_party", reg0),
              (str_store_troop_name, s1, "trp_player"),
              (party_set_name, ":landet_ship_party", "@{s1}'s Ships"),
              (party_set_slot, ":landet_ship_party", slot_party_type, spt_ship),
              (party_set_position, ":landet_ship_party", pos2),
              (call_script, "script_give_player_ships_from_party_to_party", "p_yourlair", ":landet_ship_party"),
            (try_end),
            
            (disable_party, "p_yourlair"),
            (display_message, "@Refuge demolished!"),
            (assign, "$lair_on", 0),
            (party_set_slot, "$g_encountered_party", slot_lair_improve, 0),
            (party_set_slot, "$current_town", slot_town_port, 0),	#VC-1878
            
            (assign, "$captain_ok", hire_captainno),
            (assign, "$hire_priest1", hire_priest3),
            (assign, "$bard_type", hire_bard3),
            (assign, "$hire_tavernkeeper1", hire_tavernkeeper2),
            (assign, "$hire_whore1", hire_whore5),
            (assign, "$hire_trainer1", hire_trainer2),
            (assign, "$hire_barber1", hire_barber5),
            (assign, "$hire_smith1", hire_smith2),
            (assign, "$hire_armorer1", hire_armorer2),
            (assign, "$hire_cook1", hire_cook2),
            ###no hired
            (assign, "$captain_hired_on", 0), # no contratado chief, hired
            (assign, "$priest_hired_on", 0), #contratado chief, hired
            (assign, "$bard_hired_on", 0), # no contratado chief, hired
            (assign, "$tavernkeeper_hired_on", 0), # no contratado chief, hired
            (assign, "$whore_hired_on", 0), #contratado chief, hired
            (assign, "$trainer_hired_on", 0), #contratado chief, hired
            
            (assign, "$smith_hired_on", 0), #contratado chief, hired
            (assign, "$armorer_hired_on", 0), #contratado chief, hired
            (assign, "$barber_hired_on", 0), #contratado chief, hired
            (assign, "$cook_hired_on", 0), #contratado chief, hired
            ###
            
            (leave_encounter),
            #(change_screen_map),
            (jump_to_menu, "mnu_auto_return_to_map"),#phaiak
          (try_end),
      ]),
      
      ("demoler_no", [], "Return.",
        [(jump_to_menu, "mnu_player_lair_menus"),
      ]),
  ]),

(
    "recruit_lair",0,
    "{s18}",
    "none",
    [(store_faction_of_party, ":cur_faction", "$current_town"),
      (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_5_troop),
      (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
      (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
      (store_troop_gold, ":gold", "trp_player"),
      (store_div, ":gold_capacity", ":gold", 40),#40 denars per man
      (assign, ":party_capacity", ":free_capacity"),
      (val_min, ":party_capacity", ":gold_capacity"),
      (try_begin),
        (gt, ":party_capacity", 0),
        (val_min, ":volunteer_amount", ":party_capacity"),
      (try_end),
      (assign, reg5, ":volunteer_amount"),
      (assign, reg7, 0),
      (try_begin),
        (gt, ":volunteer_amount", ":gold_capacity"),
        (assign, reg7, 1), #not enough money
      (try_end),
      (try_begin),
        (eq, ":volunteer_amount", 0),
        (str_store_string, s18, "@No one here seems to be willing to join your party."),
      (else_try),
        (store_mul, reg6, ":volunteer_amount", 40),#40 denars per man
        (str_store_troop_name_by_count, s3, ":volunteer_troop", ":volunteer_amount"),
        (try_begin),
          (eq, reg5, 1),
          (str_store_string, s18, "@One {s3} volunteers to follow you."),
        (else_try),
          (str_store_string, s18, "@{reg5} {s3} volunteer to follow you."),
        (try_end),
        (set_background_mesh, "mesh_pic_recruits"),
      (try_end),
    ],
    [
      ("continue_not_enough_gold",
      [
        (eq, reg7, 1),
      ],
      "I don't have enough money...",
      [
        (jump_to_menu, "mnu_player_lair_menus"),
      ]),
       
      ("continue",
      [
        (eq, reg7, 0),
        (eq, reg5, 0),
      ], #noone willing to join                   
      "Continue...",
      [
        (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
        (jump_to_menu, "mnu_player_lair_menus"),
      ]),
       
      ("recruit_them",
      [
        (eq, reg7, 0),
        (gt, reg5, 0),
      ],
      "Recruit them ({reg6} denars).",
      [
        (call_script, "script_lair_recruit"),
        (jump_to_menu, "mnu_player_lair_menus"),
      ]),
     
      ("forget_it",
      [
        (eq, reg7, 0),
        (gt, reg5, 0),
      ],
      "Forget it.",
      [
        (jump_to_menu, "mnu_player_lair_menus"),
      ]),
    ],
  ),

That's the code when following the guide I linked.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
there are several issues with your code, so for start review those lines

Code:
(store_random_in_range, ":test_lair", 0, 8),
Code:
(call_script, "script_update_npc_volunteer_troops_in_village", "p_yourlair"),
Code:
(call_script, "script_update_volunteer_troops_in_village", ":p_yourlair"),

explain what you are trying to do and/or fix the error on each of them
 
Top Bottom