• 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.

Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.

kalarhan

Python Saint
Count
WBNWVCWF&S
Ramaraunt said:
Hey, I have a question...

If I understood your problem I would suggest another approach. As mentioned above you should start by looking at the game for inspiration. Is there any situation for missions (scenes) that the game needs to handle special conditions before assuming it is finished/concluded?

The answer is yes. In fact, there are more than one case there.

For the hunting you could use the combat system as a example. Set some rules, like:
1) Can't leave until got the animal or it escaped. So block TAB, etc
2) Once mission is a success display a congratz message, and after a couple seconds exit to a menu
3) If mission is a failure, do similar to (2)

The basic template for a battle is "lead_charge", used on field battles (not a siege, etc). Its a good place to start looking for triggers. Few of note for you:

common_battle_tab_press
common_battle_check_victory_condition
common_battle_inventory
 

gdwitt

Knight at Arms
Placehold:
This mod tutorial claims to have this working: https://forums.taleworlds.com/index.php/topic,341518.0.html
I miss have broke this setup somehow.
///////
Insight: I explored whether the 2nd troop is trying to be a "slot_center_npc_volunteer_troop_type". I found this in module_constants. It doesn't lead me to any insights. Why would there be a shared constant for such similar category?
Code:
slot_center_npc_volunteer_troop_type   = 90
slot_center_npc_volunteer_troop_amount = 91
slot_center_mercenary_troop_type  = 90
slot_center_mercenary_troop_amount= 91
slot_center_volunteer_troop_type  = 92
slot_center_volunteer_troop_amount= 93

====================================
I've been comparing all the module file elements that the above tutorial pointed at. All my scripts have been restored to the defaults from Bryt 1.41.
I don't think I can solve the problem. Every 8th or so tavern has the strange 2nd troop in the tavern. The players are quite turned off by this bug.
 

troycall

Squire
WB
Hi,

Is there a way for store_mission_timer operation timer to continue even when the player paused the game by pressing ESC?

Thanks.

A possible workaround would be by storing the mission timer in a global variable, and adding the value of the esc independent mission timer, as well as resetting the value everytime the user opens the ESC menu.

However I do not know where the code for the ESC menu is, infact I think it is hardcoded, any assistance on either matter would be appreciated.
 

Dazzer

Sergeant Knight at Arms
WBNWVCWF&S
Dangerdude said:
Arch3r said:
Dangerdude said:
I havent come here to ask for a new OSP, because its not really an OSP and not new, I came here to question someone how to do it. And I dont really get those steps in your original post.

"I want the pike to automatically drop when drawing another weapon"
Thats what I asked for

Code:
mp_large_weapon_drop = ( 
    ti_on_item_unwielded, 0, 0, [],
    [(store_trigger_param_1, ":agent_no"),
     (store_trigger_param_2, ":item_no"),

     (try_begin),
       (multiplayer_is_server), #check is done serverside, as well as spawning the dropped item on the ground
       (neg|agent_is_non_player, ":agent_no"), #not for bots, only players
       (is_between, ":item_no", "itm_scythe", "itm_wooden_shield"),
       (agent_unequip_item,":agent_no",":item_no"),

       (agent_get_position, pos0, ":agent_no"),
       (set_spawn_position, pos0),
       (spawn_item, ":item_no", 120), #despawns after 120 seconds.
     (else_try),
       (neg|multiplayer_is_server), #client, only for displaying the message.
       (multiplayer_get_my_player, ":my_player"),
       (player_get_agent_id, ":my_agent", ":my_player"),
       (eq, ":my_agent", ":agent_no"),
       (is_between, ":item_no", "itm_scythe", "itm_wooden_shield"),
       (display_message, "@Weapon too large to sheath - weapon dropped", 0xDB7304),
     (try_end),
     ])
Should be easy to turn into a SP if that's what you were looking for.
Hi. Sadly it doesnt work form me. I dont know what could be the problem
Do I have to create a trigger or something like that?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
TheZweihander said:
hi,
how can i increase relation by a pressing a selection in game menu?(with kingdom)

1) https://forums.taleworlds.com/index.php/topic,240255.0.html
2) https://forums.taleworlds.com/index.php/topic,142422.0.html
3) https://forums.taleworlds.com/index.php/topic,16211.0.html
4) http://forums.taleworlds.com/index.php/topic,324874.0.html
5)
Code:
set_relation                    = 1270  # (set_relation, <faction_id_1>, <faction_id_2>, <value>),
                                        # Sets relation between two factions. Relation is in -100..100 range.
 
hi there,
i am making a diplomacy pannel.But i need a offer.This is game_menus:
Code:
 ("diplomacy",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "Welcome to the Diplomacy Pannel.Work in progress.",
    "none",
    [],
    [
     ("peace",[],"Make a peace",##continue menusu daha onceden var oldugu icin farkli bir ad kullan
     [(troop_remove_gold, "trp_player", 100), ##bu kisim boyle olacak yalniz paran olmadiginda isler bu.
    (call_script, "script_change_player_relation_with_faction", "fac_kingdom_1", 5),(call_script, "script_event_kingdom_make_peace_with_kingdom", "fac_kingdom_1", "fac_player_supporters_faction"),(jump_to_menu, "mnu_peace"),  ##+5 yazmana gerek yok 5 yeterli bu sekilde iliskin artar baris olmaz. Baris icin sunu kullan (call_script, "script_event_kingdom_make_peace_with_kingdom", ":kingdom_b", "fac_player_supporters_faction"),sadece kingdom_1 degil fac_kingdom_1 yazacaksin.  
        ]
       ),
	("war",[],"WAR!!",
    [(call_script, "script_change_player_relation_with_faction", "fac_kingdom_1", -10),(jump_to_menu, "mnu_war"),   
        ]
       ),
      ("go_back",[],"Leave",
       [
         (change_screen_quit),
       ]),
    ]
  ),
  
  ("Peace",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "You are maked peace with (kingdom name).",
    "none",
    [],
   [
      ("go_back",[],"Go back",
       [
         (jump_to_menu, "mnu_diplomacy"),  ##yada (change_screen_return),
       ]),
    ]
  ),
  
  
 ("War",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "You are now war with Kingdom Of Svadia.Preapare to War.",
    "none",
    [],
   [
      ("go_back",[],"Go back",
       [
         (jump_to_menu, "mnu_diplomacy"),
       ]),
    ]
  ),
 

HyperCharge

Section Moderator
M&BWBWF&SNWVC
Is it possible to change "main_menu_nord" material with another material while "in game" ?

Code:
(update_material, <material_name>, <new_material_name>), #Updates <material_name> with <new_material_name>

I think this wse op should work. Just change  "(update_material, "@main_menu_nord", "@new_main_menu_nord"), " I hope thats the way. But I can find how it is working from wse source.

And here another one;

How can I blackout the main screen in one second, and make it normal in one second again ? with an "invisible" overlay ?

What should I do to make my overlay invisible and covering entire screen ?

I want to add a series of pictures that shows up at intervals of 30 seconds. Interval things is simple. But I don't know the positioning in presentations so much. At least could you give an example for this (making an overlay that covers entire screen)?
 

Quintillius

Master Knight
WB
I don't think you can dynamically edit the main screen. You either need a trigger or mission trigger, but these don't run when having the main menu in front of you.
I advice you to do this stuff when the player creates a game. It's done before by someone around here.

---

Quintillius said:
Just a question, can I safely add these lines?

Code:
mtf_sit_fight                          = 0x00000400
mtf_sit_multiplayer_fight              = 0x00000800
mtf_sit_ambushed                       = 0x00001000
mtf_sit_town                           = 0x00002000
mtf_sit_town_infiltrate                = 0x00004000
mtf_sit_killed                         = 0x00008000
mtf_sit_travel                         = 0x00010000
mtf_sit_arena                          = 0x00020000
mtf_sit_siege                          = 0x00040000
mtf_sit_night                          = 0x00080000
mtf_sit_day                            = 0x00100000
mtf_sit_encounter_hostile              = 0x00200000
mtf_sit_main_title                     = 0x00400000
mtf_sit_victorious                     = 0x00800000
mtf_sit_feast                          = 0x01000000
mtf_sit_church                         = 0x01100000 # this one

and

Code:
itp_type_two_handed_wpn  = 0x0000000000000003
itp_type_polearm         = 0x0000000000000004
itp_type_arrows          = 0x0000000000000005
itp_type_bolts           = 0x0000000000000006
itp_type_shield          = 0x0000000000000007
itp_type_bow             = 0x0000000000000008
itp_type_crossbow        = 0x0000000000000009
itp_type_thrown          = 0x000000000000000a
itp_type_goods           = 0x000000000000000b
itp_type_head_armor      = 0x000000000000000c
itp_type_body_armor      = 0x000000000000000d
itp_type_foot_armor      = 0x000000000000000e
itp_type_hand_armor      = 0x000000000000000f
itp_type_pistol          = 0x0000000000000010
itp_type_musket          = 0x0000000000000011
itp_type_bullets         = 0x0000000000000012
itp_type_animal          = 0x0000000000000013
itp_type_book            = 0x0000000000000014
itp_type_resources       = 0x0000000000000015 # Quintillius - Nova Aetas
itp_type_materials       = 0x0000000000000016 # Quintillius - Nova Aetas
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Quintillius said:
I don't think you can dynamically edit the main screen.

Static: you can edit the UI elements on your game_variables.txt. That allows you to move elements around, disable some (like tutorial, credits, multiplayer, etc)

For a dynamic way: use the presentation (module_presentation.py) that runs on that screen. It allows you to add elements to the main screen. See "game_start"
^ VC Beta had a temporary message about the tests printed there using the presentation. VC also uses the presentation to print the game version (2.023) at the screen, and also to add it to rgl_log.txt

WSE may be another alternative, but I don't use it so won't comment further on that.
 
hi everyone,
i am trying to make a diplomacy panel.But i need a offer.What can i add?
Code:
 ("diplomacy",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "Welcome to the Diplomacy Pannel.Work in progress.",
    "none",
    [],
    [
     ("peace",[],"Make a peace",
     [(troop_remove_gold, "trp_player", 100), 
    (call_script, "script_change_player_relation_with_faction", "fac_kingdom_1", 5),(call_script, "script_event_kingdom_make_peace_with_kingdom", "fac_kingdom_1", "fac_player_supporters_faction"),(jump_to_menu, "mnu_peace"),
        ]
       ),
	("war",[],"WAR!!",
    [(call_script, "script_change_player_relation_with_faction", "fac_kingdom_1", -30),(jump_to_menu, "mnu_war"),   
        ]
       ),
	("Reinforcements",[],"Call Reinforcements",
    [(party_add_members, "p_main_party","trp_hired_blade",10),(jump_to_menu, "mnu_reinforcements"),
        ]
       ),
      ("go_back",[],"Leave",
       [
         (change_screen_quit),
       ]),
    ]
  ),

  
  ("Peace",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "You are maked peace with (kingdom name).",
    "none",
    [],
   [
      ("go_back",[],"Go back",
       [
         (jump_to_menu, "mnu_diplomacy"), 
       ]),
    ]
  ),
  
  
 ("War",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "You are now war with Kingdom Of Svadia.Preapare to War.",
    "none",
    [],
   [
      ("go_back",[],"Go back",
       [
         (jump_to_menu, "mnu_diplomacy"),
       ]),
    ]
  ),
  
 ("Reinforcements",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "You are called Swadia for sending reinforcements",
    "none",
    [],
   [
      ("go_back",[],"Go back",
       [
         (jump_to_menu, "mnu_diplomacy"),
       ]),
    ]
  ),
I know this is so basic but i'm still novice.
 
kalarhan said:
TheZweihander said:
.But i need a offer.What can i add?

You need to be more specific. Explain to us what you are trying to do and why. Details on your current problem, what you did and what is blocking you (not working)
i have not got a problem.I am trying to make a diplomacy panel like a in total war.I am trying to add peace,war,call reinforcements,trade rights etc. altarnatives
 

wrwlf

Sergeant
I have a couple of more "exploratory" questions.

1) How are the backgrounds for scenes/battlemaps selected? (Ie. the border panoramas) Are these hardcoded with each particular scene? Can I change them prior to a battle?
2) Is there a way to get the worldmap coordinates before entering a battle? I plan to use these to select a random scene/battlemap from a specific list based on worldmap coordinates.
3) If 2) is not possible, can I get the terrain type prior to a battle and basically use it for the same purpose?

Basically, this should allow me to craft custom battlemaps/scenes, and then pop in the appropriate background panorama depending if for example, the battle is taking place in front of some mountains/coastline/forest/etc.

Thanks!
 

kalarhan

Python Saint
Count
WBNWVCWF&S
wrwlf said:
I have a couple of more "exploratory" questions.

1) module_scenes.py
Code:
  ("random_scene_steppe",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x000000033c6005004006c62500003efe00004b34000059be",
    [],[], "outer_terrain_steppe"),
see the "outer_xxxx" above

2) Download Lav's module system and check header_operation.py for the PARTY section. You belong to the "p_main_party" and using operations you can get your coordinate (map X, Y, Z)

3) Same as above

VC has a few examples. If you fight near a bridge it selects a special map with river+bridge. Also special locations like ruins use that custom map for battles, etc. So all you plan to do is doable for sure.
 

wrwlf

Sergeant
kalarhan said:
wrwlf said:
I have a couple of more "exploratory" questions.

1) module_scenes.py
Code:
  ("random_scene_steppe",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x000000033c6005004006c62500003efe00004b34000059be",
    [],[], "outer_terrain_steppe"),
see the "outer_xxxx" above

2) Download Lav's module system and check header_operation.py for the PARTY section. You belong to the "p_main_party" and using operations you can get your coordinate (map X, Y, Z)

3) Same as above

VC has a few examples. If you fight near a bridge it selects a special map with river+bridge. Also special locations like ruins use that custom map for battles, etc. So all you plan to do is doable for sure.

Awesome! Thanks again kalarhan!
This means I can actually use a two-tiered approach:

1) randomly select an existing "base" scene/battlemap based on terrain type
2) determine the backdrop using the coordinates
3) play battle...
 

Ramaraunt

I'm trying to add a mod using mod-merger, and its throwing sytnax errors, pointing to the block of modmerger code at the end of each module. I'm a bit confused about this.

Mod merger is saying GameMenuOptionWrapper is not definned. I don't get it. Luckily I have a backup of my ms, but still, I'd like to get this merge working
.

Solved it.

https://forums.taleworlds.com/index.php?topic=295792.0
 

Ramaraunt

What is the "item get difficulty" operation? Its present in Custom Commander, but it doesnt work.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Ramaraunt said:
What is the "item get difficulty" operation? Its present in Custom Commander, but it doesnt work.

it returns the item difficulty  :razz: (as long it is working with 1.16:cool:

For a sword that would be the STR requirement, etc. Check module_items.py for the functions applied to items.
Code:
difficulty(10)
 

kraggrim

Marquis
WBM&BWF&SNWVC
So the talk in the Bannerlord thread got me thinking, would it be possible to assign the "show banners over friendly troops" option to a keyboard shortcut you could press while actually playing?
 
Status
Not open for further replies.
Top Bottom