Modding Q&A [For Quick Questions and Answers]

正在查看此主题的用户

状态
不接受进一步回复。
Hi,
When I write these codes:
插入代码块:
("soldier_creating_screen", 0, mesh_load_window, [
    (ti_on_presentation_load,
     [
      (presentation_set_duration, 999999),
      (set_fixed_point_multiplier, 1000),#create_text_overlay  (create_mesh_overlay_with_item_id, reg0, ":item_id"),
      (assign, ":cur_y", 700),
#      (assign, "$unit_armor_or_civilian", 0),
      (create_check_box_overlay, "$enabledisablearmors"),
      (position_set_x, pos1, 850),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$enabledisablearmors", pos1),
      (create_combo_button_overlay, "$type_of_unit"),
      (try_for_range, ":unit_will_be_selected", "trp_ct_inf_1", "trp_traveller"),
      (str_store_string, s12, ":unit_will_be_selected"),
      (overlay_add_item, "$type_of_unit", ":unit_will_be_selected"),
      (position_set_x, pos1, 200),
      (position_set_y, pos1, 850),
      (try_end),
      (try_begin),
      (eq, "$player_custom_unit_faction", "fac_tsai"),
      (try_begin),
      (eq, "$unit_armor_or_civilian", 0),
      (try_for_range, ":items", "itm_helm_tsai_a", "itm_turret_hat_blue"),
      (val_sub, ":cur_y", 100),
      (create_mesh_overlay_with_item_id, "$item_of_unit_helmet", ":items"),
      (position_set_x, pos1, 300),
      (position_set_y, pos1, ":cur_y"),
      (overlay_set_position, "$item_of_unit_helmet", pos1),
      (try_end),
      (else_try),
      (try_for_range, ":items", "itm_turret_hat_blue", "itm_straw_hat"),
      (val_sub, ":cur_y", 100),
      (create_mesh_overlay_with_item_id, "$item_of_unit_helmet", ":items"),
       (position_set_x, pos1, 300),
      (position_set_y, pos1, ":cur_y"),
       (overlay_set_position, "$item_of_unit_helmet", pos1),
      (try_end),
      (try_end),
      (try_end),
      (try_begin),
      (gt, "$chosen_helmet", 0),
      (create_mesh_overlay_with_item_id, "$chosen_item_slot", "$chosen_helmet"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 800),
      (overlay_set_position, "$chosen_item_slot", pos1),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 500),
      (overlay_set_size, "$chosen_item_slot", pos1),
      (try_end),
#      (try_for_range, ":cur_troop", quick_battle_troops_begin, quick_battle_troops_end),
#        (str_store_troop_name, s0, ":cur_troop"),
#        (overlay_add_item, "$g_presentation_obj_custom_battle_designer_18", s0),
#      (try_end),
#      (store_sub, ":cur_troop", "$g_quick_battle_troop", quick_battle_troops_begin),
#      (overlay_set_val, "$g_presentation_obj_custom_battle_designer_18", ":cur_troop"),

      (store_mul, ":cur_troop", ":unit_will_be_selected", 2), #with weapons
      (create_mesh_overlay_with_tableau_material, "$image_warrior", -1, "tableau_game_party_window", ":cur_troop"),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 370),
      (overlay_set_position, "$image_warrior", pos1),
      (position_set_x, pos1, 1000),
      (position_set_y, pos1, 1000),
      (overlay_set_size, "$image_warrior", pos1),

      (create_button_overlay, "$tamam_artik_cik_allahin_belasi", "@Done"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 200),
      (overlay_set_position, "$tamam_artik_cik_allahin_belasi", pos1),

      (create_text_overlay, "$enable_disable_civic_armors", "@Show Civic Items", tf_center_justify),
      (position_set_x, pos1, 700),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$enable_disable_civic_armors", pos1),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 800),
      (overlay_set_size, "$enable_disable_civic_armors", pos1),

      ]),
    (ti_on_presentation_event_state_change,
     [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":val"),

      (try_begin),
      (eq, ":object", "$tamam_artik_cik_allahin_belasi"),
      (presentation_set_duration, 0),
      (else_try),
      (eq, ":object", "$enabledisablearmors"),
      (try_begin),
      (eq, ":val", 1),
      (assign, "$unit_armor_or_civilian", 1),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (else_try),
      (assign, "$unit_armor_or_civilian", 0),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (try_end),
      (else_try),
      (eq, ":object", "$item_of_unit_helmet"),
      (assign, "$chosen_helmet", "$item_of_unit_helmet"),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (try_end),
      ]),
    ]),
Being like this:
There s no checkbox as you see. What's wrong?
 
Kortlcha 说:
Hi,
When I write these codes:
插入代码块:
("soldier_creating_screen", 0, mesh_load_window, [
    (ti_on_presentation_load,
     [
      (presentation_set_duration, 999999),
      (set_fixed_point_multiplier, 1000),#create_text_overlay  (create_mesh_overlay_with_item_id, reg0, ":item_id"),
      (assign, ":cur_y", 700),
#      (assign, "$unit_armor_or_civilian", 0),
      (create_check_box_overlay, "$enabledisablearmors"),
      (position_set_x, pos1, 850),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$enabledisablearmors", pos1),
      (create_combo_button_overlay, "$type_of_unit"),
      (try_for_range, ":unit_will_be_selected", "trp_ct_inf_1", "trp_traveller"),
      (str_store_string, s12, ":unit_will_be_selected"),
      (overlay_add_item, "$type_of_unit", ":unit_will_be_selected"),
      (position_set_x, pos1, 200),
      (position_set_y, pos1, 850),
      (try_end),
      (try_begin),
      (eq, "$player_custom_unit_faction", "fac_tsai"),
      (try_begin),
      (eq, "$unit_armor_or_civilian", 0),
      (try_for_range, ":items", "itm_helm_tsai_a", "itm_turret_hat_blue"),
      (val_sub, ":cur_y", 100),
      (create_mesh_overlay_with_item_id, "$item_of_unit_helmet", ":items"),
      (position_set_x, pos1, 300),
      (position_set_y, pos1, ":cur_y"),
      (overlay_set_position, "$item_of_unit_helmet", pos1),
      (try_end),
      (else_try),
      (try_for_range, ":items", "itm_turret_hat_blue", "itm_straw_hat"),
      (val_sub, ":cur_y", 100),
      (create_mesh_overlay_with_item_id, "$item_of_unit_helmet", ":items"),
       (position_set_x, pos1, 300),
      (position_set_y, pos1, ":cur_y"),
       (overlay_set_position, "$item_of_unit_helmet", pos1),
      (try_end),
      (try_end),
      (try_end),
      (try_begin),
      (gt, "$chosen_helmet", 0),
      (create_mesh_overlay_with_item_id, "$chosen_item_slot", "$chosen_helmet"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 800),
      (overlay_set_position, "$chosen_item_slot", pos1),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 500),
      (overlay_set_size, "$chosen_item_slot", pos1),
      (try_end),
#      (try_for_range, ":cur_troop", quick_battle_troops_begin, quick_battle_troops_end),
#        (str_store_troop_name, s0, ":cur_troop"),
#        (overlay_add_item, "$g_presentation_obj_custom_battle_designer_18", s0),
#      (try_end),
#      (store_sub, ":cur_troop", "$g_quick_battle_troop", quick_battle_troops_begin),
#      (overlay_set_val, "$g_presentation_obj_custom_battle_designer_18", ":cur_troop"),

      (store_mul, ":cur_troop", ":unit_will_be_selected", 2), #with weapons
      (create_mesh_overlay_with_tableau_material, "$image_warrior", -1, "tableau_game_party_window", ":cur_troop"),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 370),
      (overlay_set_position, "$image_warrior", pos1),
      (position_set_x, pos1, 1000),
      (position_set_y, pos1, 1000),
      (overlay_set_size, "$image_warrior", pos1),

      (create_button_overlay, "$tamam_artik_cik_allahin_belasi", "@Done"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 200),
      (overlay_set_position, "$tamam_artik_cik_allahin_belasi", pos1),

      (create_text_overlay, "$enable_disable_civic_armors", "@Show Civic Items", tf_center_justify),
      (position_set_x, pos1, 700),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$enable_disable_civic_armors", pos1),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 800),
      (overlay_set_size, "$enable_disable_civic_armors", pos1),

      ]),
    (ti_on_presentation_event_state_change,
     [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":val"),

      (try_begin),
      (eq, ":object", "$tamam_artik_cik_allahin_belasi"),
      (presentation_set_duration, 0),
      (else_try),
      (eq, ":object", "$enabledisablearmors"),
      (try_begin),
      (eq, ":val", 1),
      (assign, "$unit_armor_or_civilian", 1),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (else_try),
      (assign, "$unit_armor_or_civilian", 0),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (try_end),
      (else_try),
      (eq, ":object", "$item_of_unit_helmet"),
      (assign, "$chosen_helmet", "$item_of_unit_helmet"),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (try_end),
      ]),
    ]),
Being like this:
There s no checkbox as you see. What's wrong?
You forgot to set a value for the checkbox, use overlay_set_val.
 
Is there a way to guarantee that ranged units will have more than one of their ammo type using the module system?

For example, I can put an extra bag of arrows in the Nord Archer's item pool but they're still running out after thirty. I don't want to change the actual number of arrows in a bag.

Cheers.  :wink:
 
Initialize an agent slot with the amount of extra quivers, run a trigger every 10 second or so to refill them (see siege defender refills) and decrement the slot by one.
 
@Sebastian still the same:
Codes are these:
插入代码块:
("soldier_creating_screen", 0, mesh_load_window, [
    (ti_on_presentation_load,
     [
      (presentation_set_duration, 999999),
      (set_fixed_point_multiplier, 1000),#create_text_overlay  (create_mesh_overlay_with_item_id, reg0, ":item_id"),
      (assign, ":cur_y", 700),
#      (assign, "$unit_armor_or_civilian", 0),
      (create_check_box_overlay, "$enabledisablearmors"),
      (position_set_x, pos1, 850),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$enabledisablearmors", pos1),
      (create_combo_button_overlay, "$type_of_unit"),
      (try_for_range, ":unit_will_be_selected", "trp_ct_inf_1", "trp_traveller"),
      (str_store_string, s12, ":unit_will_be_selected"),
      (overlay_add_item, "$type_of_unit", ":unit_will_be_selected"),
      (position_set_x, pos1, 75),
      (position_set_y, pos1, 450),
      (overlay_set_position, "$type_of_unit", pos1),
      (try_end),
     (overlay_set_val, "$enabledisablearmors", 0),      (try_begin),
      (eq, "$player_custom_unit_faction", "fac_tsai"),
      (try_begin),
      (eq, "$unit_armor_or_civilian", 0),
      (try_for_range, ":items", "itm_helm_tsai_a", "itm_turret_hat_blue"),
      (val_sub, ":cur_y", 100),
      (create_mesh_overlay_with_item_id, "$item_of_unit_helmet", ":items"),
      (position_set_x, pos1, 300),
      (position_set_y, pos1, ":cur_y"),
      (overlay_set_position, "$item_of_unit_helmet", pos1),
      (try_end),
      (else_try),
      (try_for_range, ":items", "itm_turret_hat_blue", "itm_straw_hat"),
      (val_sub, ":cur_y", 100),
      (create_mesh_overlay_with_item_id, "$item_of_unit_helmet", ":items"),
       (position_set_x, pos1, 300),
      (position_set_y, pos1, ":cur_y"),
       (overlay_set_position, "$item_of_unit_helmet", pos1),
      (try_end),
      (try_end),
      (try_end),
      (try_begin),
      (gt, "$chosen_helmet", 0),
      (create_mesh_overlay_with_item_id, "$chosen_item_slot", "$chosen_helmet"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 800),
      (overlay_set_position, "$chosen_item_slot", pos1),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 500),
      (overlay_set_size, "$chosen_item_slot", pos1),
      (try_end),
#      (try_for_range, ":cur_troop", quick_battle_troops_begin, quick_battle_troops_end),
#        (str_store_troop_name, s0, ":cur_troop"),
#        (overlay_add_item, "$g_presentation_obj_custom_battle_designer_18", s0),
#      (try_end),
#      (store_sub, ":cur_troop", "$g_quick_battle_troop", quick_battle_troops_begin),
#      (overlay_set_val, "$g_presentation_obj_custom_battle_designer_18", ":cur_troop"),

      (store_mul, ":cur_troop", ":unit_will_be_selected", 2), #with weapons
      (create_mesh_overlay_with_tableau_material, "$image_warrior", -1, "tableau_game_party_window", ":cur_troop"),
      (position_set_x, pos1, 50),
      (position_set_y, pos1, 370),
      (overlay_set_position, "$image_warrior", pos1),
      (position_set_x, pos1, 1000),
      (position_set_y, pos1, 1000),
      (overlay_set_size, "$image_warrior", pos1),

      (create_button_overlay, "$tamam_artik_cik_allahin_belasi", "@Done"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 200),
      (overlay_set_position, "$tamam_artik_cik_allahin_belasi", pos1),

      (create_text_overlay, "$enable_disable_civic_armors", "@Show Civic Items", tf_center_justify),
      (position_set_x, pos1, 700),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$enable_disable_civic_armors", pos1),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 800),
      (overlay_set_size, "$enable_disable_civic_armors", pos1),

      ]),
    (ti_on_presentation_event_state_change,
     [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":val"),

      (try_begin),
      (eq, ":object", "$tamam_artik_cik_allahin_belasi"),
      (presentation_set_duration, 0),
      (else_try),
      (eq, ":object", "$enabledisablearmors"),
      (try_begin),
      (eq, ":val", 1),
      (assign, "$unit_armor_or_civilian", 1),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (else_try),
      (assign, "$unit_armor_or_civilian", 0),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_soldier_creating_screen"),
      (try_end),
      (else_try),
      (eq, ":object", "$item_of_unit_helmet"),
      (assign, "$val_helm", "$item_of_unit_helmet"),
#      (presentation_set_duration, 0),
#      (start_presentation, "prsnt_soldier_creating_screen"),
      (try_end),
      ]),
    (ti_on_presentation_mouse_press, [
        (store_trigger_param, ":object", 1),
        (store_trigger_param, ":click", 2),

        (try_begin),
        (eq, ":object", "$item_of_unit_helmet"),
        (assign, "$chosen_helmet", "$val_helm"),
        (display_message, "@A helmet has chosen."),
        (presentation_set_duration, 0),
        (start_presentation, "prsnt_manage_buildings"),
        (try_end),
        ]),
    ]),

And codes choose only item at the bottom. (head wrapping) How can I make other items selectable?
Plus, in other presentations, some overlays doesn't appear. How can I solve this problem?
EDIT: I solved the check box problem. But still game is choosing last added item(head_wrapping). How can I solve this?
 
Hello I am attempting to change some stuff with giving commands and add a sound effect to all of the commands (hold, follow me, charge) given in game, but considering how new I am to modding I am completely lost.

I don't really want to be hold how to do it, I just want to know where I can find the code that is run when you give a command and the script that plays sounds (if there is one?)

Thanks in advance
 
Bustah 说:
Hello I am attempting to change some stuff with giving commands and add a sound effect to all of the commands (hold, follow me, charge) given in game, but considering how new I am to modding I am completely lost.

I don't really want to be hold how to do it, I just want to know where I can find the code that is run when you give a command and the script that plays sounds (if there is one?)

Thanks in advance

http://forums.taleworlds.com/index.php/topic,8652.msg1417460.html#msg1417460
 
Hernanxd16 说:
Bustah 说:
Hello I am attempting to change some stuff with giving commands and add a sound effect to all of the commands (hold, follow me, charge) given in game, but considering how new I am to modding I am completely lost.

I don't really want to be hold how to do it, I just want to know where I can find the code that is run when you give a command and the script that plays sounds (if there is one?)

Thanks in advance

http://forums.taleworlds.com/index.php/topic,8652.msg1417460.html#msg1417460

Hi thanks for the response however this is for Mount and Blade and I am currently trying to mod Warband. I should have said, sorry. Also I would prefer it if I wasn't just copying someone else's work, because then I don't honestly understand what's going on.
 
Bustah 说:
Hi thanks for the response however this is for Mount and Blade and I am currently trying to mod Warband. I should have said, sorry. Also I would prefer it if I wasn't just copying someone else's work, because then I don't honestly understand what's going on.

That code should work in Warband too.

Read this to understand the module system:

https://forums.taleworlds.com/index.php/topic,240255.0.html
https://forums.taleworlds.com/index.php/topic,142422.0.html

 
Somebody 说:
Initialize an agent slot with the amount of extra quivers, run a trigger every 10 second or so to refill them (see siege defender refills) and decrement the slot by one.

I've seen this refill script mentioned a few times on here but I can't find it anywhere in the module system.

 
Hernanxd16 说:
That code should work in Warband too.

The code does not work in Warband. There is no such thing as gk_charge as it has been replaced by gk_order_1 followed by gk_order_3, which poses problems.

I managed to get some of my own code to work, but only when ordering from the panel.
 
What does mean "unregonize opcode" and what i should to check/do to solve problems with it


P.S When i run game though WSE , in game error sounds as " WSE Error on opcode ....."
 
Bustah 说:
There is no such thing as gk_charge

see header_xxx.py for the engine options

header_triggers.py
插入代码块:
ti_on_order_issued            = -71.0 # An agent has issued a tactical order
    # trigger param 1 = order_code (see mordr_* constants in header_mission_templates.py)
    # trigger param 2 = agent_id
 
Hey everyone! Got a bit of a doozy for you all, I'm sure you'll appreciate it...  :wink:

I'm making a presentation to manage captured enemies after a battle. You get to see the troops you've captured, and can assign their fates individually. They can be taken prisoner, ransomed, released, or executed. Below is a very basic mock-up of what I'm going for.

EBS3tvx.jpg

The important bits are marked up. So, the basic workings of it are that I have 8 array troops, 2 for each category. The first array troop stores the troops that are in that category, the second stores the number of those troops in the category.

In the above image, I check the arrays for the "Take Prisoner" category, and for each troop type I'll have 3 important overlays: a combo label drop-down menu that will set the newly-assigned category, a number box to choose how many will be assigned to that category, and a confirm button to put the desired number of troops into the chosen category. I know how to build presentations, but the issue that I'm having is as follows:

I have no idea how to make the number box, combo label, and confirm button all work in tandem to produce the desired effect if I'll be generating one of each for each troop type in the category. When I'm assigning the overlays' destination, how can I make them each unique so that in my "ti_on_presentation_event_state_change" trigger, I can figure out which number boxes correspond to which confirm buttons/combo labels etc? Even more important than that, I've got no clue how to make the confirm button recognize which troop type I want to assign when I press it, as far as I know I can't assign values to buttons. My only real idea would be to somehow have a whole other set of array troops involved to keep track of each individual overlay as they're generated so that in my "ti_on_presentation_event_state_change" trigger I can just loop through their slots to find out which overlays are related to what troop.

I'm in a real pickle, and if there's no real way to get around this issue without something like the solution I've considered above, I might scrap this sleek, sexy presentation idea for something a bit uglier and less navigable, but more functional. Love to hear what any of you think! Please let me know if I need to clarify anything/if I'm making 0 sense at all. Thanks in advance.  :mrgreen:
 
overlays made one after the other are sequential

so, if you do something like:

插入代码块:
(create_text_overlay, "@aaa", "$first_overlay"),
#set overlay pos
(try_for_range, ":troop", first_troop, last_troop),
    (str_store_troop_name, s0, ":troop"),
    (create_text_overlay, "@A {s0}", reg0),
    #set overlay pos
    (create_text_overlay, "@B do something", reg0),
    #set overlay pos
    (create_text_overlay, "@C do something", reg0),
    #set overlay pos
(try_end),

then if you want to get the overlay_id from the troop id, you do:
插入代码块:
(store_sub, ":troop_offset", ":troop_id", first_troop),
(store_mul, ":overlay_id", ":troop_offset", 3),#3 overlays per troop
(val_add, ":overlay_id", "$first_overlay"),
(val_add, ":overlay_id", 1),#1 for A, 2 for B, 3 for C

and if you want troop_id from overlay_id:
插入代码块:
(store_add, ":begin", "$first_overlay", 1),
(store_sub, ":end", last_troop, first_troop),
(val_mul, ":end", 3),#3 overlays per troop
(val_add, ":end", ":begin"),
(try_begin),
    (is_between, ":overlay_id", ":begin", ":end"),
    (val_sub, ":overlay_id", ":begin"),
    (store_div, ":troop_id", ":overlay_id", 3),
    (val_add, ":troop_id", first_troop),
    (store_mod, ":overlay_type", ":overlay_id", 3),
    (try_begin),#A
        (eq, ":overlay_type", 0),
        #do something
    (else_try),#B
        (eq, ":overlay_type", 1),
        #do something
    (else_try),#C
        #do something
    (try_end),
(try_end),

 
bentguisarme 说:
I have no idea how to make the number box, combo label, and confirm button all work in tandem

presentation is a screen refreshed every frame. It is a canvas. You control what is "painted" in there. And you can add widgets (buttons, checkbox, etc) that can fire events.

you have 5 basic triggers to manage the life cycle. From start-up (frame 0), to event handling (mouse click).

Use global variables, registers and slots to keep data from 1 frame to the next. And to use them on the triggers.

插入代码块:
load = ti_on_presentation_load
run = ti_on_presentation_run
event = ti_on_presentation_event_state_change
hover = ti_on_presentation_mouse_enter_leave
click = ti_on_presentation_mouse_press

# Shows coordinates on a presentation for easy development
# Set debug_show_presentation_coordinates on module_constants.py
coord_helper = [
  (load, [
      (eq, debug_show_presentation_coordinates, 1),
      (create_text_overlay, "$mouse_coordinates", "str_empty_string"),
      (overlay_set_color, "$mouse_coordinates", 0xFF0000),
      (position_set_x, pos1, 10),
      (position_set_y, pos1, 700),
      (overlay_set_position, "$mouse_coordinates", pos1),
  ]),
  (run, [
      (eq, debug_show_presentation_coordinates, 1),
      (set_fixed_point_multiplier, 1000),
      
      (mouse_get_position, pos1),
      (position_get_x, reg1, pos1),
      (position_get_y, reg2, pos1),
      (overlay_set_text, "$mouse_coordinates", "@{reg1}, {reg2}"),
  ])
]
prsnt_escape_close = [
  (run,
    [
      (try_begin),
        (this_or_next|key_clicked, key_escape),
        (key_clicked, key_pad_start),
        (presentation_set_duration, 0),
        (change_screen_return,0),
      (try_end),
  ]),
]

You can find utility scripts (libraries) on mods like Floris, or write your own. They make it easier to create widgets like a button. WRECK also comes with code for them.

Study the header_operations.py section for presentations (Lav's)
 
I'm trying to find information about the combat mechanics. I'm using the search function but I can't find in my head a good term for the search. I want to understand troops AI in battles, like how they choose to chase or shoot the nearest enemy, or they stay in formation. For instance. when they are in formation and enemies get nearby the do a short run and then retreat. Or when chasing the player they do some random deviations left or right. I think the latter is somehow new because years ago they just chased in a narrow row. I don't know if this is hardcoded stuff that was changed in the last warband update. Or if there is some mod that I can study to learn.

Thanx for any help
 
LanceShield 说:
I'm trying to find information about the combat mechanics.

Native behavior is mostly hardcoded.

you can look at Formations code on VC modsys for a way to override it and implement your own custom behaviors. Other kits can be found on OSP section.
 
Ikaguia 说:
overlays made one after the other are sequential

so, if you do something like:

插入代码块:
(create_text_overlay, "@aaa", "$first_overlay"),
#set overlay pos
(try_for_range, ":troop", first_troop, last_troop),
    (str_store_troop_name, s0, ":troop"),
    (create_text_overlay, "@A {s0}", reg0),
    #set overlay pos
    (create_text_overlay, "@B do something", reg0),
    #set overlay pos
    (create_text_overlay, "@C do something", reg0),
    #set overlay pos
(try_end),

then if you want to get the overlay_id from the troop id, you do:
插入代码块:
(store_sub, ":troop_offset", ":troop_id", first_troop),
(store_mul, ":overlay_id", ":troop_offset", 3),#3 overlays per troop
(val_add, ":overlay_id", "$first_overlay"),
(val_add, ":overlay_id", 1),#1 for A, 2 for B, 3 for C

and if you want troop_id from overlay_id:
插入代码块:
(store_add, ":begin", "$first_overlay", 1),
(store_sub, ":end", last_troop, first_troop),
(val_mul, ":end", 3),#3 overlays per troop
(val_add, ":end", ":begin"),
(try_begin),
    (is_between, ":overlay_id", ":begin", ":end"),
    (val_sub, ":overlay_id", ":begin"),
    (store_div, ":troop_id", ":overlay_id", 3),
    (val_add, ":troop_id", first_troop),
    (store_mod, ":overlay_type", ":overlay_id", 3),
    (try_begin),#A
        (eq, ":overlay_type", 0),
        #do something
    (else_try),#B
        (eq, ":overlay_type", 1),
        #do something
    (else_try),#C
        #do something
    (try_end),
(try_end),

Thank you so much! This is likely exactly what I need.  :mrgreen:
 
Is it possible to do something like str_equals without using WSE?
Should the eq command work when comparing two strings?

插入代码块:
(eq, s9, s8),
 
状态
不接受进一步回复。
后退
顶部 底部