WB Coding How to do dynamic renaming?

Users who are viewing this thread








Hi guys. I'm working on an advanced headquarters system. I want to change the name of the headquarters whenever I want. But I don't know how to do it. In some modes, we can change the city/fortress names by changing the "Rename Kingdom" codes in our game. I tried to do this but failed. Could you help?

Code:
("quarters","Ordugah",pf_disabled|icon_camp|pf_always_visible, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(20,60),[]),

Code:
("camp_leave_troops",[(neg|party_is_active, "p_quarters"),],"Leave some of your troops here.",[(jump_to_menu, "mnu_quarters_built"),]),
("camp_action_4",[],"Back to camp menu.", [(jump_to_menu, "mnu_camp"),]),
      ]
  ),

("quarters_built",mnf_disable_all_keys,"The quarters are ready.","none",
        [
            (enable_party, "p_quarters"),
            (set_background_mesh, "mesh_pic_recruits"),
            (party_get_position, pos50, "p_main_party"),
            (party_set_position, "p_quarters", pos50),
        ],
        [
            ("quarters_leave",[],"Leave.",
                [
                    (party_add_members, "p_quarters", "trp_quartermaster",1),
                    (change_screen_return),
                ]
            ),
        ]
    ),
  ##
    ("quarters",mnf_disable_all_keys,"You can leave troops in your quarters and take them later.","none",
        [
            (set_background_mesh, "mesh_pic_camp"),
        ],
        [
          ###Kampa Girme Baslangic
            ("kampa_gir",[],"Kampa Gir",
                [
                    (jump_to_scene, "scn_quarters"),
                    (change_screen_mission),
                ]
            ),
          ###Kampa Girme Bitis
            ("quarters_manage_troops",[],"Manage your troops.",
                [
                    (change_screen_exchange_members,0),
                ]
            ),
            ("quarters_destroy",[],"Disband the quarters.",
                [
                    (party_get_num_companion_stacks, ":num_stacks", "p_quarters"),
                    (party_get_num_companions, ":num_companions", "p_quarters"),
                    (party_get_free_companions_capacity, ":party_room", "p_main_party"),
                    (try_begin),
                        (le, ":num_companions", ":party_room"),
                        (try_for_range, ":i_stack", 0, ":num_stacks"),
                            (party_stack_get_troop_id, ":stack_troop", "p_quarters", ":i_stack"),
                                (try_begin),
                                    (neq, ":stack_troop", "trp_quartermaster"),
                                    (party_stack_get_size, ":stack_size", "p_quarters", ":i_stack"),
                                    (party_remove_members, "p_quarters", ":stack_troop", ":stack_size"),
                                    (party_add_members, "p_main_party", ":stack_troop", ":stack_size"),
                                    (disable_party, "p_quarters"),
                                    (change_screen_return),
                                (else_try),
                                    (jump_to_menu, "mnu_quarters_are_you_sure"),
                                (try_end),
                        (try_end),
                    (try_end),
                ]
            ),
            ("quarters_leave_2",[],"Leave.",
                [
                    (change_screen_return),
                ]
            ),
     ]
    ),
 
    ("quarters_are_you_sure",mnf_disable_all_keys,"Your party doesn't have room for {reg1} of your soldiers. These troops will be destroyed. Do you still want to continue?","none",
        [
            (set_background_mesh, "mesh_pic_defeat"),
        ],
        [
            ("quarters_yes",[],"Yes.",
                [
                    (party_get_num_companion_stacks, ":num_stacks", "p_quarters"),
                    (party_get_free_companions_capacity, ":party_room", "p_main_party"),
                    (try_for_range_backwards, ":selected_stack", 0, ":num_stacks"),
            (party_stack_get_troop_id, ":stack_troop", "p_quarters", ":selected_stack"),
            (party_stack_get_size, ":stack_size", "p_quarters", ":selected_stack"),
            (try_begin),
                        (neq, ":stack_troop", "trp_quartermaster"),
                        (try_begin),
                            (le, ":stack_size", ":party_room"),
                            (party_remove_members, "p_quarters", ":selected_stack", ":stack_size"),
                            (party_add_members, "p_main_party", ":stack_troop", ":stack_size"),
                        (else_try),
                            (gt, ":stack_size", ":party_room"),
                            (val_sub, ":stack_size", ":party_room"),
                            (party_remove_members, "p_quarters", ":stack_troop", ":stack_size"),
                            (party_add_members, "p_main_party", ":stack_troop", ":stack_size"),
                        (try_end),
                        (else_try),
                            (eq, ":party_room", 0),
                            (change_screen_return),           
                        (try_end),
                    (try_end),
                    (change_screen_return),
                ]
            ),
            ("quarters_no",[],"No.",
                [
                    (jump_to_menu, "mnu_quarters"),
                ]
            ),
        ]
    ),

Code:
(else_try),
           (eq, "$g_encountered_party", "p_zendar"),
           (jump_to_menu, "mnu_zendar"),
##Oğuz Karargah
         (else_try),
           (eq, "$g_encountered_party", "p_quarters"),
       (jump_to_menu, "mnu_quarters"),
##Oğuz Karargah

(try_begin),
        (is_between, ":troop_id", companions_begin, companions_end),
        (val_mul, ":wage", 2),
      (try_end),

##Oğuz Karargah
      (try_begin),
    (eq, ":troop_id", "trp_quartermaster"),
    (assign, ":wage", 0),
      (try_end),
##Oğuz Karargah

Code:
["quartermaster","Quartermaster","Quartermaster",tf_hero|tf_unmoveable_in_party_window, scn_quarters|entry(1), reserved, fac_commoners,[itm_coarse_tunic, itm_hide_boots],  str_20|agi_20|int_20|cha_20|level(30),wp(90), knows_riding_2|knows_horse_archery_3|knows_power_draw_3|knows_leadership_2|knows_weapon_master_1,0x0000000f5b1052c61ce1a9521db1375200000000001ed31b0000000000000000],

Code:
(try_begin),
        (party_is_active, "p_quarters"),
    (assign, ":total_wage", 0),
        (party_get_num_companion_stacks, ":num_stacks", "p_quarters"),
        (try_for_range, ":i_stack", 0, ":num_stacks"),
          (party_stack_get_troop_id, ":stack_troop", "p_quarters", ":i_stack"),
          (party_stack_get_size, ":stack_size", "p_quarters", ":i_stack"),
          (call_script, "script_game_get_troop_wage", ":stack_troop", "p_quarters"),
          (assign, ":cur_wage", reg0),
          (val_mul, ":cur_wage", ":stack_size"),
          (val_add, ":total_wage", ":cur_wage"),
    (try_end),
    (val_mul, ":total_wage", -1),
    (val_add, ":net_change", ":total_wage"),
    (str_store_party_name, s0, "p_quarters"),
    (create_text_overlay, reg1, "str_wages_for_s0", 0),
    (position_set_x, pos1, 900),
    (position_set_y, pos1, 900),
    (overlay_set_size, reg1, pos1),
    (position_set_x, pos1, 25),
    (position_set_y, pos1, ":cur_y"),
    (overlay_set_position, reg1, pos1),
    (try_begin),
          (lt, ":total_wage", 0),
          (assign, reg0, ":total_wage"),
          (create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
          (overlay_set_color, reg1, 0xFF0000),
    (else_try),
          (create_text_overlay, reg1, "[USER=542972]@none[/USER]", tf_right_align|tf_single_line),
    (try_end),
          (position_set_x, pos1, 900),
          (position_set_y, pos1, 900),
          (overlay_set_size, reg1, pos1),
          (position_set_x, pos1, 500),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg1, pos1),
          (val_sub, ":cur_y", 27),
    (try_end),

 
Last edited:
Top Bottom