Search results for query: *

  1. SP Tutorial Module System How to make troops recruitable from castle/towns.

    I followed the tutorial perfectly and maked all the changes I saw in the 7 pages of comments.

    I using the last version of MB Warband (1.170) and the last version of MS (1.171).

    The following errors appeared:

    Initializing...
    Compiling all global variables...
    Exporting strings...
    Exporting skills...
    Exporting tracks...
    Exporting animations...
    Exporting meshes...
    Exporting sounds...
    Exporting skins...
    Exporting map icons...
    Creating new tag_uses.txt file...
    Creating new quick_strings.txt file...
    Exporting faction data...
    Exporting item data...
    Exporting scene data...
    Exporting troops data
    Exporting particle data...
    Exporting scene props...
    Exporting tableau materials data...
    Exporting presentations...
    Exporting party_template data...
    Exporting parties
    Exporting quest data...
    Exporting info_page data...
    Exporting scripts...
    Exporting mission_template data...
    Exporting game menus data...
    Traceback (most recent call last):
      File "process_game_menus.py", line 47, in <module>
        save_game_menus(variables,variable_uses,tag_uses,quick_strings)
      File "process_game_menus.py", line 31, in save_game_menus
        save_game_menu_item(ofile,variable_list,variable_uses,menu_item,tag_uses,qui
    ck_strings)
      File "process_game_menus.py", line 13, in save_game_menu_item
        ofile.write(" %s "%(string.replace(menu_item[2]," ","_")))
      File "C:\Python27\lib\string.py", line 521, in replace
        return s.replace(old, new, maxreplace)
    AttributeError: 'tuple' object has no attribute 'replace'
    exporting simple triggers...
    exporting triggers...
    exporting dialogs...
    Checking global variable usages...
    WARNING: Global variable never used: g_enemy_surrenders
    WARNING: Global variable never used: g_player_surrenders
    WARNING: Global variable never used: g_private_battle_with_troop
    WARNING: Global variable never used: cant_leave_encounter
    WARNING: Global variable never used: g_leave_town_outside
    WARNING: Global variable never used: character_gender
    WARNING: Global variable never used: g_player_troop
    WARNING: Global variable never used: g_camp_mode
    WARNING: Global variable never used: g_prisoner_recruit_troop_id
    WARNING: Global variable never used: g_prisoner_recruit_last_time
    WARNING: Global variable never used: playerparty_postbattle_regulars
    WARNING: Global variable never used: routed_party_added
    WARNING: Global variable never used: thanked_by_ally_leader
    WARNING: Global variable never used: last_freed_hero
    WARNING: Global variable never used: capture_screen_shown
    WARNING: Global variable never used: g_prison_heroes
    WARNING: Global variable never used: g_siege_force_wait
    WARNING: Global variable never used: g_siege_sallied_out_once
    WARNING: Global variable never used: g_siege_join
    WARNING: Global variable never used: qst_train_peasants_against_bandits_currentl
    y_training
    WARNING: Global variable never used: qst_eliminate_bandits_infesting_village_num
    _villagers
    WARNING: Global variable never used: g_player_raid_complete
    WARNING: Global variable never used: quest_auto_menu
    WARNING: Global variable never used: g_tournament_player_team_won
    WARNING: Global variable never used: g_tournament_bet_placed
    WARNING: Global variable never used: g_tournament_bet_win_amount
    WARNING: Global variable never used: g_tournament_last_bet_tier
    WARNING: Global variable never used: g_last_assassination_attempt_time
    WARNING: Global variable never used: g_train_peasants_against_bandits_num_peasan
    ts
    WARNING: Global variable never used: last_sneak_attempt_town
    WARNING: Global variable never used: last_sneak_attempt_time
    WARNING: Global variable never used: g_training_ground_training_count
    WARNING: Global variable never used: g_presentation_marshall_selection_max_renow
    n_2
    WARNING: Global variable never used: g_tutorial_entered
    WARNING: Global variable never used: g_dont_give_marshalship_to_player_days
    Exporting postfx_params...

    EDIT:

    Here are my code lines:

    (module_game_menus).

          ("castle_wait",
          [
            #(party_slot_eq,"$current_town",slot_party_type, spt_castle),
            (this_or_next|ge, "$g_encountered_party_relation", 0),
            (eq,"$castle_undefended",1),
            (assign, ":can_rest", 1),
            (str_clear, s1),
            (try_begin),
              (neg|party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
      (troop_get_slot, ":player_spouse", "trp_player", slot_troop_spouse),
              (neg|party_slot_eq, "$current_town", slot_town_lord, ":player_spouse"),

              (party_slot_ge, "$current_town", slot_town_lord, "trp_player"), #can rest for free
              (store_faction_of_party, ":current_town_faction", "$current_town"),
              (neq, ":current_town_faction", "fac_player_supporters_faction"),
              (party_get_num_companions, ":num_men", "p_main_party"),
              (store_div, reg1, ":num_men", 4),
              (val_add, reg1, 1),
              (str_store_string, s1, "@ ({reg1} denars per night)"),
              (store_troop_gold, ":gold", "trp_player"),
              (lt, ":gold", reg1),
              (assign, ":can_rest", 0),
            (try_end),
            (eq, ":can_rest", 1),
          ],

          ("recruit_nobles",[(is_between, "$current_town",
            castles_begin, castles_end), (call_script,
          "script_cf_town_castle_recruit_volunteers_cond"),]
          ,"Recruit Nobles.",
          [
            (try_begin),
              (call_script, "script_cf_enter_center_location_bandit_check"),
            (else_try),
              (jump_to_menu, "mnu_recruit_nobles"),
            (try_end),
          ]),

          ("recruit_normals",[(is_between, "$current_town",
            towns_begin, towns_end), (call_script,
          "script_cf_town_recruit_volunteers_cond"),]
          ,"Recruit Volunteers.",
          [
            (try_begin),
              (call_script, "script_cf_enter_center_location_bandit_check"),
            (else_try),
              (jump_to_menu, "mnu_recruit_normales"),
            (try_end),
          ]),


          "Wait here for some time{s1}.",
          [
            (assign, "$auto_enter_town", "$current_town"),
            (assign, "$g_town_visit_after_rest", 1),
            (assign, "$g_last_rest_center", "$current_town"),
            (assign, "$g_last_rest_payment_until", -1),

            (try_begin),
              (party_is_active, "p_main_party"),
              (party_get_current_terrain, ":cur_terrain", "p_main_party"),
              (try_begin),
                (eq, ":cur_terrain", rt_desert),
                (unlock_achievement, ACHIEVEMENT_SARRANIDIAN_NIGHTS),
              (try_end), 
            (try_end), 

            (rest_for_hours_interactive, 24 * 7, 5, 0), #rest while not attackable
            (change_screen_return),
          ]),

      (
        "recruit_nobles",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", 160),#160 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", 160),#160 denars per man #again was 40
          (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_town"),
          ]),
         
          ("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_town"),
          ]),
         
          ("recruit_them",
          [
            (eq, reg7, 0),
            (gt, reg5, 0),
          ],
          "Recruit them ({reg6} denars).",
          [
            (call_script, "script_town_castle_recruit_nobles_recruit"),
                           
      (jump_to_menu, "mnu_town"),
          ]),
         
          ("forget_it",
          [
            (eq, reg7, 0),
            (gt, reg5, 0),
          ],
          "Forget it.",
          [
      (jump_to_menu, "mnu_town"),
          ]),
        ],
      ),

      (
      "recruit_normales",0,
        "{s18}",
        "none",
        [(store_faction_of_party, ":cur_faction", "$current_town"),
        (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_3_troop),  #Tier 3
        (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_town"),
          ]),
         
          ("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_town"),
          ]),
         
          ("recruit_them",
          [
            (eq, reg7, 0),
            (gt, reg5, 0),
          ],
          "Recruit them ({reg6} denars).",
          [
            (call_script, "script_town_recruit_nobles_recruit"),
                         
      (jump_to_menu, "mnu_town"),
          ]),
       
          ("forget_it",
          [
            (eq, reg7, 0),
            (gt, reg5, 0),
          ],
          "Forget it.",
          [
      (jump_to_menu, "mnu_town"),
          ]),
        ],
      ),


    ]

    (module_scripts).

      #script_cf_town_castle_recruit_volunteers_cond
      # INPUT: none
      # OUTPUT: none
      ("cf_town_castle_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_cf_town_recruit_volunteers_cond
      # INPUT: none
      # OUTPUT: none
      ("cf_town_recruit_volunteers_cond",  #renamed
        [(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"),
        (store_div, ":gold_capacity", ":gold", 10),#10 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", 10),#10 denars per man
        (troop_remove_gold, "trp_player", ":cost"),
        ]),

      #script_town_castle_recruit_nobles_recruit
      # INPUT: none
      # OUTPUT: none
      ("town_castle_recruit_nobles_recruit",
        [(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"),
        (val_min, ":volunteer_amount", ":free_capacity"),
        (store_troop_gold, ":gold", "trp_player"),
        (store_div, ":gold_capacity", ":gold", 160),#160 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", 160),#160 denars per man
        (troop_remove_gold, "trp_player", ":cost"),
        ]),

      #script_town_recruit_nobles_recruit
      # INPUT: none
      # OUTPUT: none
      ("town_recruit_nobles_recruit", #renamed
        [(store_faction_of_party, ":cur_faction", "$current_town"),
        (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_3_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", 40),#40 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", 40),#40 denars per man
        (troop_remove_gold, "trp_player", ":cost"),
        ]),

    (module_simple_triggers).

      # Adding mercenary troops to the towns
      (72,
      [
        (call_script, "script_update_mercenary_units_of_towns"),
        #(call_script, "script_start_update_mercenary_units_of_towns"),
        #NPC changes begin
        # removes  (call_script, "script_update_companion_candidates_in_taverns"),
        #NPC changes end
        (call_script, "script_update_ransom_brokers"),
        (call_script, "script_update_tavern_travellers"),
        (call_script, "script_update_tavern_minstrels"),
        (call_script, "script_update_booksellers"),
        (call_script, "script_update_villages_infested_by_bandits"),
        (try_for_range, ":village_no", villages_begin, villages_end),
          (call_script, "script_update_volunteer_troops_in_village", ":village_no"),
          (call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
        (try_end),
        ]),
      (72,
      [
        (call_script, "script_update_mercenary_units_of_towns"),
      # (call_script, "script_start_update_mercenary_units_of_towns"),
        #NPC changes begin
        # removes  (call_script, "script_update_companion_candidates_in_taverns"),
        #NPC changes end
        (call_script, "script_update_ransom_brokers"),
        (call_script, "script_update_tavern_travellers"),
        (call_script, "script_update_tavern_minstrels"),
        (call_script, "script_update_booksellers"),
        (call_script, "script_update_villages_infested_by_bandits"),
        (try_for_range, ":village_no", centers_begin, centers_end),
          (call_script, "script_update_volunteer_troops_in_village", ":village_no"),
          #(call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
        (try_end),
        ]),

    Really appreciate some help!  :wink:
  2. SP Native [WB][OSP] Tama's Enchanced Native Mod (attackable townsfolk and stuff)

    Hi! :grin: Great mod, but i have a suggestion:

    Maybe you can implement the 'attakable-citizens' feature in villages, and the 'garrisoned-guards' feature in castles, because both are still native. And give to village citizens a low cost faction weapon for self-defense.

    PD: My english is too bad, sorry if my comment is hard to understand.

    Thanks you!
Back
Top Bottom