Recent content by Blooorp

  1. Modding VC: basic tutorials and Q&A thread

    Took me a while but finally managed to view the value of slots x)
    I checked the lair slots and it had no culture, so I added two lines to the lair creation menu :
    Code:
              (faction_get_slot, ":lair_culture", "fac_player_faction", slot_faction_culture),
              (party_set_slot, "p_yourlair", slot_center_culture, ":lair_culture"),
    Code:
      ("build_refuge_new",0,
        "Your men await your orders to start building the refuge. There is enough material collected so far, and what may be missing can be purchased in nearby villages.^^" +
        "Total Cost: 1000 peningas.^" +
        "Time need: 6 hours.",
        "none",
        [(set_background_mesh, "mesh_pic_camp"),
        ],
        [
          ("refuge_here",[(eq, "$lair_on", 0),],"So order.",
            [
              (str_clear,s1),
              
              (troop_remove_gold, "trp_player", 1000),
              (party_relocate_near_party, "p_yourlair", "p_main_party"),
              (call_script, "script_give_center_to_lord", "p_yourlair", "trp_player", 0),
              #(party_set_slot, "p_yourlair", slot_party_type, spt_castle),
              (faction_get_slot, ":lair_culture", "fac_player_faction", slot_faction_culture),
              (party_set_slot, "p_yourlair", slot_center_culture, ":lair_culture"),
              (enable_party, "p_yourlair"),
              (display_message, "@After you buy the materials, your men build a permanent shelter for you."),
              (assign, "$lair_on", 1),
              (party_set_slot, "$g_encountered_party", slot_lair_improve, 0),
              #personal
              (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
              ###
              
              #tiempo de construccion
              (assign,"$g_presentations_next_presentation",-1),
              (presentation_set_duration,0),
              (assign,"$g_camp_mode", 1),
              (assign, "$g_infinite_camping", 0),
              (assign, "$g_player_icon_state", pis_camping),
              
              (rest_for_hours, 6, 5, 1), #rest while no attackable
              (assign,"$temp",6), #Obliga descanso al salir
              (change_screen_return),
              ##
              ##                 (leave_encounter),
              ##                 #(change_screen_map),
              ##		 (jump_to_menu, "mnu_auto_return_to_map"),#phaiak
            ]
          ),
          
          ("resume_travelling",[],"Back.",
            [
              (change_screen_return),
            ]
          ),
        ]
      ),

    And now it works !
    Thanks kalarhan for hinting me towards the right direction, I was thinking about a lot of things but not that x)
  2. Modding VC: basic tutorials and Q&A thread

    Updated the code to update the recruits
    Code:
    	# lair recruits update
    	(72,
    	  [
    		(call_script, "script_update_volunteer_troops_in_village", "p_yourlair"),
        ]),

    Also tried to add the "pf_village" flag to the lair without improvement so ended up copying a village, changing the essential parts to what it is on the lair and still nothing.
    Code:
          # Original lair line
          ("yourlair","My Refuge",icon_camp_refuge|pf_disabled|pf_is_static|pf_always_visible|pf_label_medium, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1, 1),[]),
          # Same with "pf_village" added to the flags
          ("yourlair","My Refuge",icon_camp_refuge|pf_disabled|pf_is_static|pf_always_visible|pf_label_medium|pf_village, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1, 1),[]),
          # Last try, copied a village line, changed ID, name, added "pf_disabled", changed faction from neutral to player supporters faction and changed the coordinates.
          ("yourlair","My Refuge",  icon_camp_refuge|pf_disabled|pf_village, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1,1),[]),
  3. Modding VC: basic tutorials and Q&A thread

    Looks like "update_npc_volunteer_troops_in_village" is only for NPCs so yeah quite useless for me, thanks x)
    Tho "update_volunteer_troops_in_village" is pretty long and complicated, having a hard time finding out if it's this script that doesn't like to give troops to the refuge.

    Most of the flags are not really explained in the header_parties.py, I guess that maybe removing "pf_disabled" or adding "pf_village" could help?
    Code:
    ("yourlair","My Refuge",icon_camp_refuge|pf_disabled|pf_is_static|pf_always_visible|pf_label_medium, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1, 1),[]),
  4. Modding VC: basic tutorials and Q&A thread

    Code:
    (store_random_in_range, ":test_lair", 0, 8),
    I was trying to have the lair's volunteers update every 3 days more or less. So as the code runs every 8 hours I added a check that would succeed approximately once every 9 tries.

    Code:
    (call_script, "script_update_npc_volunteer_troops_in_village", "p_yourlair"),
    
    (call_script, "script_update_volunteer_troops_in_village", ":p_yourlair"),
    Oops, just noticed the ":p_yourlair", that's not what it was meant to be haha, was meant to be "p_yourlair" instead of the random village from the VC code.

    Edit : fixed ":p_yourlair" with "p_yourlair" but still doesn't work.
  5. Modding VC: basic tutorials and Q&A thread

    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.
  6. Modding VC: basic tutorials and Q&A thread

    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:
Back
Top Bottom