• Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

WB Coding How to add sound effect to battle commands?

Users who are viewing this thread

Kierby

Recruit
Hello, i was wondering, how can i add sound effects/files to battle commands like Charge, Follow me, or just selecting troop division. Some mods had it, so i tried to figure out the principle from their files, but without success. I´ve serched on modding forums. No result from that either. So i want to ask here, how it can be achieved? ( One of the mods i was testing this function: Medieval Conquest)
 

Kierby

Recruit
Thank you so much. I dont know how could i missed that. Both threads were very useful. But i´ve runned into one problem. As i followed whole tutorial and tried to made a new module, i got an error.
Traceback (most recent call last):
File "process_init.py", line 2, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined

Traceback (most recent call last):
File "process_global_variables.py", line 12, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
File "process_map_icons.py", line 6, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
File "process_items.py", line 66, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting scene data...
Traceback (most recent call last):
File "process_scenes.py", line 15, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
File "process_scene_props.py", line 7, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_tableau_materials.py", line 8, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_presentations.py", line 8, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting party_template data...
Traceback (most recent call last):
File "process_parties.py", line 6, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
File "process_scripts.py", line 7, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_mission_tmps.py", line 5, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_game_menus.py", line 8, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_simple_triggers.py", line 5, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_dialogs.py", line 9, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Traceback (most recent call last):
File "process_global_variables_unused.py", line 3, in <module>
from process_operations import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 21, in <module>
from module_mission_templates import *
File "G:\Games\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\module_mission_templates.py", line 44, in <module>
(this_or_next|game_key_clicked, gk_order_halt),
NameError: name 'gk_order_halt' is not defined
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

I dont know why, because i´ve copied that code and tripple checked him after that error. It seems like all "gk_orders" are not defined. I´m rookie in python coding, so i bet this is some trivial problem caused by my "skill".
 
Last edited:
Upvote 0

kalarhan

Python Saint
Count
WBNWVCWF&S
well you are checking a MB answer, not a WB one, so things can change after 11 years. Check header_triggers.py for the new names and update your code.
 
Upvote 0

Kierby

Recruit
Well, Kalarhan was right. The same thing is in the thread as well. I managed to make it partialy work. Sounds work just fine if i select some of the divison. Last problem is, that the flags for orders are a bit confusing. So now i dont precisely know, how to assign sounds to orders like "follow me" etc.
gk_move_forward = 0
gk_move_backward = 1
gk_move_left = 2
gk_move_right = 3
gk_action = 4
gk_jump = 5
gk_attack = 6
gk_defend = 7
gk_kick = 8
#gk_parry_then_attack = 8
gk_toggle_weapon_mode = 9
gk_equip_weapon_1 = 10
gk_equip_weapon_2 = 11
gk_equip_weapon_3 = 12
gk_equip_weapon_4 = 13
gk_equip_primary_weapon = 14
gk_equip_secondary_weapon = 15
gk_drop_weapon = 16
gk_sheath_weapon = 17
gk_leave = 18
gk_zoom = 19
gk_view_char = 20
gk_cam_toggle = 21
gk_view_orders = 22
gk_order_1 = 23
gk_order_2 = 24
gk_order_3 = 25
gk_order_4 = 26
gk_order_5 = 27
gk_order_6 = 28
##gk_order_halt = 22
##gk_order_follow = 23
##gk_order_charge = 24
##gk_order_dismount = 25
##gk_order_hold_fire_toggle = 26
##gk_order_advance = 27
##gk_order_fall_back = 28
##gk_order_stand_closer = 29
##gk_order_spread_out = 30
##gk_order_blunt_weapons_toggle = 31
gk_everyone_hear = 29
gk_infantry_hear = 30
gk_archers_hear = 31
gk_cavalry_hear = 32
gk_group0_hear = gk_infantry_hear
gk_group1_hear = gk_archers_hear
gk_group2_hear = gk_cavalry_hear
gk_group3_hear = 33
gk_group4_hear = 34
gk_group5_hear = 35
gk_group6_hear = 36
gk_group7_hear = 37
gk_group8_hear = 38
gk_reverse_order_group = 39
gk_everyone_around_hear = 40
gk_mp_message_all = 41
gk_mp_message_team = 42
gk_character_window = 43
gk_inventory_window = 44
gk_party_window = 45
gk_quests_window = 46
gk_game_log_window = 47
gk_quick_save = 48
gk_crouch = 49
gk_order_7 = 50
gk_order_8 = 51

Can anyone explain to me the architecture of these commands? I tried to assign orders 1-6 to six different sounds (charge, follow, halt, etc.), but no progress in that.
 
Upvote 0

kalarhan

Python Saint
Count
WBNWVCWF&S
Can anyone explain to me the architecture of these commands? I tried to assign orders 1-6 to six different sounds (charge, follow, halt, etc.), but no progress in that.

since MBF&S expansion (engine-wise) you need to look at another file, its header_mission_templates.py

Code:
mordr_hold                = 0
mordr_follow            = 1
mordr_charge            = 2
mordr_mount                = 3
mordr_dismount            = 4
mordr_advance            = 5
mordr_fall_back            = 6
mordr_stand_closer        = 7

check examples on module_mission_templates.py to see how they are used

Python:
  (ti_on_order_issued, 0, 0,
    [
      (store_trigger_param, ":order_no", 1),
      (eq, ":order_no", mordr_charge),
    ],
    [
      # do something when order charge is called
  ]),
 
Upvote 0
Top Bottom