• 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 Races, Firearms Melee, Voice Orders

Users who are viewing this thread

NicoleUK

Sergeant
Hey guys 😁

Im making a personal mod using 'gekokujo' as base (im making a mod about the boshin war era so this mod is the perfect base, just need to modernize it)

I have a few questions (and yes iv tried looking in the forums for answers but there really isnt anything) if anyone has the answers or can point me in the right direction id be so happy!!! Im not new to modding just a bit slow and computer challenged lol 🙈

- how do you add new races? I tried replacing the undead race and adding the other ones, the numbers in header_troops and the face keys and skin info in module_skins and it seems to build the mod fine but when i go to play the game i have a 'get_object failed for mesh' error message for one of the towns. adding races was the first thing i tried to do to the mod so i somehow got the error message from adding the race. not sure where i went wrong?

- im wanting to add some custom firearms, how do I make certain firearms use certain reload animations? im want to have old muskets that use muzzle loading and newer rifles that are breechloading. also, how do i make firearms have a melee version like hitting with the butt or using bayonet? I have the animations for the loading and melee just not sure how to implement them.

- How do i add sounds/voices to battle orders. For example, when i click '1' for 'infantry' and 'f4' for 'fire' or whatever i want my character to say 'infantry' and 'fire'... I know a few mods that do this but there not open source so not sure how its done. i have the sounds i want to use just dont know how to implement them.


Thanks for any help I really appreciate it! 🥰
 
Solution
i'm lazy but if you use the formation script for example search for (call_script, "script_player_order_formations", mordr_charge), in the mission template.
now you can assign a sound

Code:
       (call_script, "script_player_order_formations", mordr_charge),
        (get_player_agent_no, ":player_agent"), #look for player
        (agent_play_sound, ":player_agent", "snd_blabla"), #add charge sound


here the list from header mission templates
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
mordr_spread_out = 8
mordr_use_blunt_weapons =...

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
how do you add new races?
Have a look here: https://forums.taleworlds.com/index.php?threads/adding-a-new-race.42860/

how do I make certain firearms use certain reload animations?
Each weapon kind has it's own animation, at one weapon kind you cannot have multiple animations. One work around at this would be to classify one kind as firearm and the other one as crossbow and rework all the crossbowstuff to your likings. Not sure though if you also have crossbows.

how do i make firearms have a melee version like hitting with the butt or using bayonet?
This works with alternate weapon mode, read it up here: https://forums.taleworlds.com/index.php?threads/osp-wb-b-alternate-weapon-modes.292934/
If you want a special agent animation while switching the weapon, you need the flag itp_has_bayonet. Not sure at the moment though how you set the animation.

How do i add sounds/voices to battle orders.
Read first this here: https://forums.taleworlds.com/index...ipt-scheme-exchange.8652/page-17#post-1417460
Afterwards read here, that guy made a misstake while implementing it, maybe there are additional useful informations for you:
 
Upvote 0

NicoleUK

Sergeant

TYSM for your quick reply! and yes i checked out that tutorial il have another go at adding the races :grin:


This works with alternate weapon mode, read it up here: https://forums.taleworlds.com/index.php?threads/osp-wb-b-alternate-weapon-modes.292934/
If you want a special agent animation while switching the weapon, you need the flag itp_has_bayonet. Not sure at the moment though how you set the animation.

im not too fussed about having a fancy animation to attach a bayonet (i can have rifles with them already attached to make it easier) i was more on about the 'press x' thing to use the rifle as a melee (as a club or with bayonet). like you can with the muskets in NW.


Read first this here: https://forums.taleworlds.com/index...ipt-scheme-exchange.8652/page-17#post-1417460
Afterwards read here, that guy made a misstake while implementing it, maybe there are additional useful informations for you:

Iv been trying for the past 2 hours to try make this bloody tutorial work... Im 100% sure iv put everything where it should go and all that but its saying the orders arnt 'defined'


this is what i put in the module_sounds:

Code:
#male sounds
#group selection
("order_everyone_male", sf_2d|sf_priority_10|sf_vol_10, ["group_select_infantry.ogg"]),
("order_infantry_male", sf_2d|sf_priority_10|sf_vol_10, ["group_select_infantry2.ogg"]),
("order_archers_male", sf_2d|sf_priority_10|sf_vol_10, ["group_select_infantry3.ogg"]),
("order_cavalry_male", sf_2d|sf_priority_10|sf_vol_10, ["cav.ogg"]),
("order_others_male", sf_2d|sf_priority_10|sf_vol_10, ["group_select_infantry4.ogg"]),
#orders
("order_halt_male", sf_2d|sf_priority_10|sf_vol_10, ["HALT_1.ogg"]),
("order_follow_male", sf_2d|sf_priority_10|sf_vol_10, ["man_shout_jap_onme_01.wav"]),
("order_charge_male", sf_2d|sf_priority_10|sf_vol_10, ["man_shout_jap_charge_01.wav"]),
("order_advance_male", sf_2d|sf_priority_10|sf_vol_10, ["man_shout_jap_advance_01.wav"]),
("order_fall_back_male", sf_2d|sf_priority_10|sf_vol_10, ["RETREAT_1.ogg"]),
("order_stand_closer_male", sf_2d|sf_priority_10|sf_vol_10, ["CLOSE_RANKS_1.ogg"]),
("order_spread_out_male", sf_2d|sf_priority_10|sf_vol_10, ["SPREAD_OUT_1.ogg"]),
("order_dismount_male", sf_2d|sf_priority_10|sf_vol_10, ["cavalry_dismount_01.ogg"]),
("order_hold_fire_toggle_male", sf_2d|sf_priority_10|sf_vol_10, ["man_shout_jap_hold_fire_01.wav"]),
("order_blunt_toggle_male", sf_2d|sf_priority_10|sf_vol_10, ["man_shout_jap_hold_fire_02.wav"]),
#female sounds
#group selection
("order_everyone_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_INFANTRY.ogg"]),
("order_infantry_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_INFANTRY2.ogg"]),
("order_archers_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_INFANTRY3.ogg"]),
("order_cavalry_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_CAV.ogg"]),
("order_others_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_INFANTRY4.ogg"]),
#orders
("order_halt_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_HOLD.ogg"]),
("order_follow_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_ONME_01.wav"]),
("order_charge_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_CHARGE_01.ogg"]),
("order_advance_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_ADVANCE.wav"]),
("order_fall_back_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_MOVE_01.wav"]),
("order_stand_closer_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_MOVE_02.wav"]),
("order_spread_out_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_MOVE_03.wav"]),
("order_dismount_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_MOVE_04.wav"]),
("order_hold_fire_toggle_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_HOLD2.ogg"]),
("order_blunt_toggle_female", sf_2d|sf_priority_10|sf_vol_10, ["FEMALE_HOLD3.ogg"]),


this is what i put in Module_mission_templates:

Code:
voice_orders = (
 0, 0, 0, [(this_or_next|game_key_clicked, gk_infantry_hear),
           (this_or_next|game_key_clicked, gk_archers_hear),
           (this_or_next|game_key_clicked, gk_cavalry_hear),
           (this_or_next|game_key_clicked, gk_everyone_hear),
           (this_or_next|game_key_clicked, gk_reverse_order_group),
           (this_or_next|game_key_clicked, gk_order_halt),
           (this_or_next|game_key_clicked, gk_order_follow),
           (this_or_next|game_key_clicked, gk_order_charge),
           (this_or_next|game_key_clicked, gk_order_dismount),
           (this_or_next|game_key_clicked, gk_order_advance),
           (this_or_next|game_key_clicked, gk_order_fall_back),
           (this_or_next|game_key_clicked, gk_order_stand_closer),
           (this_or_next|game_key_clicked, gk_order_spread_out),
           (this_or_next|game_key_clicked, gk_order_hold_fire_toggle),
           (game_key_clicked, gk_order_blunt_weapons_toggle),
],
[(get_player_agent_no, ":player"),
(agent_get_troop_id,":player_id", ":player"),
(troop_get_type, ":gender", ":player_id"),
(val_mul, ":gender", 15), #sets to skip 15 sound files if player is female
(assign, ":command", "snd_group_select_infantry"), # here you enter the name of the FIRST sound file you added
(val_add,":command",":gender"), #skips 15 sound files if player is female - comment or delete this line if you added only male voices
#group selection begin here---------------------------------
(try_begin),
(game_key_clicked, gk_everyone_hear),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_infantry_hear),
(val_add, ":command",1),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_archers_hear),
(val_add, ":command",2),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_cavalry_hear),
(val_add, ":command",3),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_reverse_order_group),
(val_add, ":command",4),
(agent_play_sound, ":player", ":command"),
(else_try),
#orders begin here------------------------------------------
(game_key_clicked, gk_order_halt),
(val_add, ":command",5),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_follow),
(val_add, ":command",6),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_charge),
(val_add, ":command",7),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_advance),
(val_add, ":command",8),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_fall_back),
(val_add, ":command",9),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_stand_closer),
(val_add, ":command",10),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_spread_out),
(val_add, ":command",11),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_dismount),
(val_add, ":command",12),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_hold_fire_toggle),
(val_add, ":command",13),
(agent_play_sound, ":player", ":command"),
(else_try),
(game_key_clicked, gk_order_blunt_weapons_toggle),
(val_add, ":command",14),
(agent_play_sound, ":player", ":command"),
(try_end),
])

when i go to build the module i keep getting an error message saying 'gk_order_halt', 'gk_order_follow', 'gk_order_charge' (etc...) 'is not defined'

what am i doing wrong lol??? im literally going crazy here 😢
 
Upvote 0

Dj_FRedy

Archduke
M&BWBNWVCWF&S
Some key flags have changed since the code was written... Check 'header_triggers' to adapt the code with the appropriate flags.
 
Upvote 0

NicoleUK

Sergeant
this is the code in the header_triggers:

Code:
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

what exactly should i do here? I tried deleting the '##' before the '##gk_order_halt' (and the others) and tried to build the module again then got this error message 'error: unable to find object:snd_group_select_infantry / ERROR: Illegal Identifier:snd_group_select_infantry'

please does someone have any suggestions?
 
Upvote 0

NicoleUK

Sergeant
I DID IT!
i made a very simple mistake - intead of putting the main main of the sounds i was trying to put the .ogg file! silly me!
 
Upvote 0

Mauromagno Patriota

Sergeant Knight
WBNWVC
If something has a # in front of it, it's commented out, it's an inactive code. There is no problem with something like this being in there, repeating numbers of not outcommented code.

I understand that, but the point is that for the voice code to work, those lines must be active (without #) and with an order (I suppose)
I have tested the code with a copy of native, unmarking those lines and leaving the lines in the same place with the same number ... also putting them at the end and with a successive number to the existing ones, but in both cases, the sounds are hear, but not according to the code.
So I ask: the command lines in header_triggers should have a special order?
 
Upvote 0

Tocan

Sergeant Knight at Arms
I understand that, but the point is that for the voice code to work, those lines must be active (without #) and with an order (I suppose)
I have tested the code with a copy of native, unmarking those lines and leaving the lines in the same place with the same number ... also putting them at the end and with a successive number to the existing ones, but in both cases, the sounds are hear, but not according to the code.
So I ask: the command lines in header_triggers should have a special order?
If that not work for someone you can always assign the sounds manually after the respective order in the mission_template. The drawback is if you want that the sounds work with the battle order presentation too you also have to place them in module_presentations.
 
Upvote 0

Mauromagno Patriota

Sergeant Knight
WBNWVC
If that not work for someone you can always assign the sounds manually after the respective order in the mission_template. The drawback is if you want that the sounds work with the battle order presentation too you also have to place them in module_presentations.
but the code for the command orders does not have that code..... and don't tell me that I should create it because I have no idea hahaha
 
Upvote 0

Tocan

Sergeant Knight at Arms
i'm lazy but if you use the formation script for example search for (call_script, "script_player_order_formations", mordr_charge), in the mission template.
now you can assign a sound

Code:
       (call_script, "script_player_order_formations", mordr_charge),
        (get_player_agent_no, ":player_agent"), #look for player
        (agent_play_sound, ":player_agent", "snd_blabla"), #add charge sound


here the list from header mission templates
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
mordr_spread_out = 8
mordr_use_blunt_weapons = 9
mordr_use_any_weapon = 10
mordr_stand_ground = 11
mordr_hold_fire = 12
mordr_fire_at_will = 13
mordr_retreat = 14
mordr_use_melee_weapons = 15
mordr_use_ranged_weapons= 16
mordr_fire_at_my_command= 17
mordr_all_fire_now = 18
mordr_left_fire_now = 19
mordr_middle_fire_now = 20
mordr_right_fire_now = 21
mordr_form_1_row = 22
mordr_form_2_row = 23
mordr_form_3_row = 24
mordr_form_4_row = 25
mordr_form_5_row = 26
 
Upvote 0
Solution
Top Bottom