Modding VC: basic tutorials and Q&A thread

Users who are viewing this thread

This is less of a question, but more of a request :smile:

Request: A tutorial on how to recreate the Scenic Menu for other mods.

I've delved deep into VC code and there are a lot of parts!

VC Menu Presentation
Mission template for the camera
The usage of Quest slots (ingenious!)
New Scripts for the execution of the menu items
Calling the above scripts in game_menus
globals, globals, everywhere! :smile:

And because of so much moving parts, it is quite difficult to separate it and use it on other mods..

So I was wondering if the implementer (i think it was Phaiak, based on the comments?) or anyone else who is interested would share/create a tutorial on the process? :smile:

Im sure a lot of modders would be quite grateful

(I for one would love to implement it for TLD, as we have amazing scenes that would be great to showcase this way)

Thanks!

 
Hi Khamukkamu, thanks for the interest on the code of VC.

I can't write a complete tutorial with all details in the moment but here is short description of the concept:
Mnu_town is a game menu. Each game menu contains menu options. Each menu option contains a conditions block and a consequences block. In VC all condition blocks of mnu_town are moved to script_check_town_menu_conditions and all consequences blocks are moved to script_execute_town_menu_cosequence.
If you call script_check_town_menu_conditions it will check the condition block of each menu option (which originally was) in mnu_town and save the results in the slots of qst_vc_menu (after slot 30).
Example for checking the result:
Code:
(quest_slot_ge, "qst_vc_menu", 31, 1), # if the condition block of menu option 1 is fulfilled
(quest_slot_ge, "qst_vc_menu", 32, 1), # if the condition block of menu option 2 is fulfilled
...
In addition it will fill the string (name) of the menu option in the string register (s31, s32, ...)
If you call script_execute_town_menu_cosequence it will execute the consequences block of the menu option you define with the first script parameter.
Example:
Code:
(call_script, "script_execute_town_menu_cosequence", 31),# execute the consequences block of menu option 1
As soon as this works we need to add a code at the end of the operations block in mnu_town to jump in the town scene and start a presentation. And this presentation needs the following code to create all available buttons:
Code:
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_ge, "qst_vc_menu", ":menu_slot", 1), # if the condition block of this menu option is fulfilled
          (str_store_string_reg, s1,":menu_slot"), #store the name (string) of this menu option
          (create_button_overlay, reg1, s1, tf_center_justify), # create a button with this string
          (quest_set_slot, "qst_vc_menu", ":menu_slot", reg1), # reuse the slot of qst_vc_menu to save the object_id of the button
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", ":button_distance"),
          (overlay_set_position, reg1, pos1),
        (end_try),
With ti_on_presentation_event_state_change you can check the button that was clicked and start the consequences:
Code:
        (store_trigger_param_1, ":object"),
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_eq, "qst_vc_menu", ":menu_slot", ":object"),#if equal then we know that the menu option with number ":menu_slot" was clicked
          (call_script, "script_execute_town_menu_cosequence", menu_slot),# execute consequences of the menu option with number ":menu_slot" 
        (end_try),
All the other code is mainly handling exceptions and problems which makes the code for the scenic menu much more complicated :sad:
This are the basics. I hope it helps a bit.
 
Is there a quick and easy way to mod VC so that I can force companions to always stay.

I got the option for "no you can never leave or I'll kill you" once, but then I haven't seen it since and all companions are leaving etc.

If adding the option in is too difficult, then just a simple modification so that they never leave at all.

Cheers
 
kalarhan said:
Stildawn said:
Is there a quick and easy way to mod VC so that I can force companions to always stay.

check [VC Tweaks Tool] thread

Are you refering to this tweak:

Change the negative effect companions have on each other's morale Reforged/2.0/2.004

I read that one, and it seems it just removed the other companion negatives, but they can still leave? Or is there another tweak in there I'm not seeing?
 
kalarhan said:
Stildawn said:
I read that one, and it seems it just removed the other companion negatives, but they can still leave? Or is there another tweak in there I'm not seeing?

Lets try again  :smile:

Tweaks thread has a collection of small changes for the game, including the one you want to stop companions from leaving. However, many of them are not updated to 2.023, so you would need to figure out how to apply them on a new version

Tweaks Tool is the game source WITH tweaks that you can choose, again, including that one. It is based on 2.023 (as of this post), and it will be updated to next patch when released. You can choose either to change your game.
Tweaks Tool
# TWEAK 3: STOP THEM FROM LEAVING
TWEAK_STOP_COMPANIONS_LEAVING = 0 # 0: can leave, 1: won't leave. Default: 0
Tweaks configuration file from github.com (preview)


This thread is for modding. Read the first posts and learn how to mod the game yourself if you want more particular changes, or use the Tweaks already know from the other threads.

And if you want ask about a tweak, as a example, post on the tweaks thread, instead of here.

Cheers

Ah thanks dude, missed that thread. Cheers will give it a go.
 
Hello all! New face here on the forum. Interested in the creation of a proper three kingdoms period mod using the viking conquest engine (if thats even a remote possibility). Too colorful and interesting a time period to be left in the dark imo..hoping to hear some sagacious opinions of the pros.
 
Jrossp said:
Hello all! New face here on the forum. Interested in the creation of a proper three kingdoms period mod

hi @Jrossp. Warband Engine (the core) is quite open, as long you invest enough time to learn it. Check my initial posts for links and some examples on how to start.

Main forum for modding is the Forge, and feel free to post specific questions on VC module system here once you are working on your mod
https://forums.taleworlds.com/index.php/board,64.0.html

Have fun modding!
 
Phaiak said:
Hi Khamukkamu, thanks for the interest on the code of VC.

I can't write a complete tutorial with all details in the moment but here is short description of the concept:
Mnu_town is a game menu. Each game menu contains menu options. Each menu option contains a conditions block and a consequences block. In VC all condition blocks of mnu_town are moved to script_check_town_menu_conditions and all consequences blocks are moved to script_execute_town_menu_cosequence.
If you call script_check_town_menu_conditions it will check the condition block of each menu option (which originally was) in mnu_town and save the results in the slots of qst_vc_menu (after slot 30).
Example for checking the result:
Code:
(quest_slot_ge, "qst_vc_menu", 31, 1), # if the condition block of menu option 1 is fulfilled
(quest_slot_ge, "qst_vc_menu", 32, 1), # if the condition block of menu option 2 is fulfilled
...
In addition it will fill the string (name) of the menu option in the string register (s31, s32, ...)
If you call script_execute_town_menu_cosequence it will execute the consequences block of the menu option you define with the first script parameter.
Example:
Code:
(call_script, "script_execute_town_menu_cosequence", 31),# execute the consequences block of menu option 1
As soon as this works we need to add a code at the end of the operations block in mnu_town to jump in the town scene and start a presentation. And this presentation needs the following code to create all available buttons:
Code:
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_ge, "qst_vc_menu", ":menu_slot", 1), # if the condition block of this menu option is fulfilled
          (str_store_string_reg, s1,":menu_slot"), #store the name (string) of this menu option
          (create_button_overlay, reg1, s1, tf_center_justify), # create a button with this string
          (quest_set_slot, "qst_vc_menu", ":menu_slot", reg1), # reuse the slot of qst_vc_menu to save the object_id of the button
          (position_set_x, pos1, 850),
          (position_set_y, pos1, ":button_y_position"),
          (val_sub, ":button_y_position", ":button_distance"),
          (overlay_set_position, reg1, pos1),
        (end_try),
With ti_on_presentation_event_state_change you can check the button that was clicked and start the consequences:
Code:
        (store_trigger_param_1, ":object"),
        (try_for_range, ":menu_slot", slot_quest_menu_begin, slot_quest_menu_end),
          (quest_slot_eq, "qst_vc_menu", ":menu_slot", ":object"),#if equal then we know that the menu option with number ":menu_slot" was clicked
          (call_script, "script_execute_town_menu_cosequence", menu_slot),# execute consequences of the menu option with number ":menu_slot" 
        (end_try),
All the other code is mainly handling exceptions and problems which makes the code for the scenic menu much more complicated :sad:
This are the basics. I hope it helps a bit.

Hi Phaiak! Thanks for taking the time to write this up! I really do appreciate it.

I'll study it and see if I can implement it myself!
 
Jrossp said:
Hello all! New face here on the forum. Interested in the creation of a proper three kingdoms period mod using the viking conquest engine (if thats even a remote possibility). Too colorful and interesting a time period to be left in the dark imo..hoping to hear some sagacious opinions of the pros.

Played this three years ago: http://www.moddb.com/mods/romance-of-the-three-kingdoms-dynasty-warriors

A lot of work had gone into it. Beautiful, idealized scenes had been worked out. Had the story, but was slow moving. I couldn't find the guy I had to find in some village, so after some hours of that, I dropped it.

Apparently was updated in 2014.
 
motomataru said:
Jrossp said:
Hello all! New face here on the forum. Interested in the creation of a proper three kingdoms period mod using the viking conquest engine (if thats even a remote possibility). Too colorful and interesting a time period to be left in the dark imo..hoping to hear some sagacious opinions of the pros.

Played this three years ago: http://www.moddb.com/mods/romance-of-the-three-kingdoms-dynasty-warriors

A lot of work had gone into it. Beautiful, idealized scenes had been worked out. Had the story, but was slow moving. I couldn't find the guy I had to find in some village, so after some hours of that, I dropped it.

Apparently was updated in 2014.

Thanks for the effort, im familiar with these mods (dev did a wonderful job with world map and scenes, but that was the extent of it for me im afraid) mainly was just curious if a total overhaul is feasible with VC. Thanks in advance and forgive any ignorance.
 
Hello fellow Vikings :smile:
I got some questions, so let's get to it (thanks in advance for answering them).

1) What's the formula for pricing items (especially swords, shields, bows, crossbows etc.)? I believe that you don't set it manually for each item (would get some time and would be unbalanced huh?).
I need it, because recently I added some additionals items, armours etc. to VC and the prices in marketplace are messed up. When I go to merchant and want to buy some armour, the best ones are not at the top, because they cost really low amount of money, so I would like to balance it and use some formula to calculate prices for all of the items.

2) How is it possible to make it so all of my troops will have shield with the faction's banner/logo? With companions it aint a problem, as I can give them shields with faction logo from the marketplace (and some elite troops have that one already too), but since I can't edit (in-game way) the troops like companions, they use shields with different logos.

3) Related to 2. question -> how does one make an armour that will show your faction banner on it? For example if I have some existing armour and I would like to give it the option to have some default logo/color and then when I recruit troops with that armour (while being a lord with own faction banner), it would change from default color/logo to the faction color/logo.

Thanks a lot again! (-;
 
Tordiato said:
I got some questions...

1) no formula. You need to understand the historical elements, apply them to the game economy and then balance gear around it.

Example: normal axes are cheap weapons, double edge swords are expensive weapons, ... horses are rare, in special combat breeds (instead of the ones used for mounted infantry).

if you want to add more stuff you can follow the game general values, or rebalance it towards your own taste.

2) check module_items.py for items that have this trigger. A example:
Code:
["tab_shield_round_01_device", "Painted Round Shield", [("Roundshield_01_tab_device",0)], itp_merchandise|itp_type_shield|itp_wooden_parry, itcf_carry_round_shield,
  510 , weight(4)|hit_points(310)|body_armor(18)|spd_rtng(90)|shield_width(38),imodbits_shield,
 [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner","tableau_vc_round_shield_01_device", ":agent_no", ":troop_no")])]],

3) same as above. You will need to check the Forge for a example on how to create heraldic armor if you want to bring some gear from the 11-15th century (mods like 1257AD, or Native)

Native example (note you need to modify the model, not just the code):
Code:
["heraldic_mail_with_surcoat", "Heraldic Mail with Surcoat", [("heraldic_armor_new_a",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0,
 3454 , weight(22)|abundance(100)|head_armor(0)|body_armor(49)|leg_armor(17)|difficulty(7) ,imodbits_armor,
 [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_heraldic_armor_a", ":agent_no", ":troop_no")])]],
 
kalarhan said:
Tordiato said:
I got some questions...

1) no formula. You need to understand the historical elements, apply them to the game economy and then balance gear around it.

Example: normal axes are cheap weapons, double edge swords are expensive weapons, ... horses are rare, in special combat breeds (instead of the ones used for mounted infantry).

if you want to add more stuff you can follow the game general values, or rebalance it towards your own taste.

Thanks for the tip :wink: I checked cost and damage of vc items (swords, polearms etc.) and balanced it (with my ****ty console program). Now I can't get the best armor/sword or so for ridiculously low price :wink:


kalarhan said:
2) check module_items.py for items that have this trigger. A example:
Code:
["tab_shield_round_01_device", "Painted Round Shield", [("Roundshield_01_tab_device",0)], itp_merchandise|itp_type_shield|itp_wooden_parry, itcf_carry_round_shield,
  510 , weight(4)|hit_points(310)|body_armor(18)|spd_rtng(90)|shield_width(38),imodbits_shield,
 [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner","tableau_vc_round_shield_01_device", ":agent_no", ":troop_no")])]],

Welp, I added it to other existing shields aaand only some of them are showing my faction's banner. Some examples below:
Working as intended
http://i.imgur.com/dInLiRw.jpg
http://i.imgur.com/FLMglsT.jpg

Not working for these shields
http://i.imgur.com/ZQOCGJk.jpg
http://i.imgur.com/BaO1QuX.jpg

Ingame battle, only two soldiers has shield with my faction's banner
http://i.imgur.com/HVxv2Sq.jpg

Can you tell me how the code should look like for example for this shield?
Code:
["shield_14", "Round Shield", [("Basicshield_08",0)], itp_type_shield|itp_wooden_parry, itcf_carry_round_shield,
  500 , weight(4)|hit_points(300)|body_armor(19)|spd_rtng(86)|shield_width(43),imodbits_shield,
 [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner","(**what's supposed to be here?**)", ":agent_no", ":troop_no")])]],

btw. hopefully in Bannerlord we will have an option to choose this as a default thingy for all troops under our arms.


kalarhan said:
3) same as above. You will need to check the Forge for a example on how to create heraldic armor if you want to bring some gear from the 11-15th century (mods like 1257AD, or Native)

Native example (note you need to modify the model, not just the code):
Code:
["heraldic_mail_with_surcoat", "Heraldic Mail with Surcoat", [("heraldic_armor_new_a",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0,
 3454 , weight(22)|abundance(100)|head_armor(0)|body_armor(49)|leg_armor(17)|difficulty(7) ,imodbits_armor,
 [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_heraldic_armor_a", ":agent_no", ":troop_no")])]],

Yeah, I thought that model has to be modified as well, but that's not my concern as I imported models which already has this done.

Thanks a lot for helping out (again  :party:)
 
Tordiato said:
Ingame battle, only two soldiers has shield with my faction's banner
http://i.imgur.com/HVxv2Sq.jpg

I can't help with your problems I'm afraid, but what helmet is this you're wearing :smile:?
 
kraggrim said:
Tordiato said:
Ingame battle, only two soldiers has shield with my faction's banner
http://i.imgur.com/HVxv2Sq.jpg

I can't help with your problems I'm afraid, but what helmet is this you're wearing :smile:?

I'm using all items from NordInvasion except for the fantasy stuff.
The name of the helmet is: Grinder Helmet
Code:
 itm_grinder_helmet Grinder_Helmet Grinder_Helmet 1  milanese_sallet 0  2147549196 0 6120 704643238 2.750000 100 60 0 0 8 0 0 0 0 0 0 0
 0
0

Download NI: https://nordinvasion.com/download.php
Resource: milanese_sallet (helmets.brf)
Texture: greatbascinet.dds + greatbascinet_spec.dds

Screens:
http://i.imgur.com/3bHK3iV.jpg
http://i.imgur.com/uHmtfMs.jpg
 
I think your problem is that you are using non-device tableaux in your script call from items. That, and to ensure troops get nothing but devices, you have to strip out all the non-device items from their equipment list in module_troops. That will, of course, affect other factions using the same troops.

The magic for devices all happens in tableaux and the scripts used there. Think of tableaux as Photoshop with texture files as layers. The set_banner scripts called from the item in VC simply find the device texture to use. It's script_process_shield_tableau that puts everything together:

Throw faction-indexed background color beneath:

      (cur_tableau_set_background_color, ":background_color"),

After some very fine positioning and angling, add the device "sticker":

        (store_add, ":arms_mesh", ":banner_index", arms_meshes_begin),

Layer over whatever mess the foregoing left on the back of the shield:

        (init_position, pos1),
        (position_set_x, pos1, -100),
        (position_set_z, pos1, 10),
        ...
          (cur_tableau_add_mesh_with_vertex_color, "mesh_white_bg_plane_a", pos1, 1000, 100, ":background_color"),

Layer on scratches, dents, rim, boss, etc.:
      (init_position, pos1),
      (position_set_z, pos1, 20),
      (cur_tableau_add_mesh, ":surface_mesh", pos1, 0),

You would need to do something like this for each heraldic armor. You could try starting with just sticking the device on somewhere. Bear in mind, without a graphical interface, moving, scaling, and undistorting the device is an extremely painstaking process of: modify the source, recompile, and run the game to check output. I really hope they give us THIS in Bannerlord!

More ambitious would be to resurrect the custom armor system in the Native source. Taking our approach, the would require leaving "gaps" in the heraldic armor textures to be filled with the background color and additional texture layers for any foreground layers, plus the surface layer.
 
Tordiato said:
kraggrim said:
Tordiato said:
Ingame battle, only two soldiers has shield with my faction's banner
http://i.imgur.com/HVxv2Sq.jpg

I can't help with your problems I'm afraid, but what helmet is this you're wearing :smile:?

I'm using all items from NordInvasion except for the fantasy stuff.
The name of the helmet is: Grinder Helmet
Code:
 itm_grinder_helmet Grinder_Helmet Grinder_Helmet 1  milanese_sallet 0  2147549196 0 6120 704643238 2.750000 100 60 0 0 8 0 0 0 0 0 0 0
 0
0

Download NI: https://nordinvasion.com/download.php
Resource: milanese_sallet (helmets.brf)
Texture: greatbascinet.dds + greatbascinet_spec.dds

Screens:
http://i.imgur.com/3bHK3iV.jpg
http://i.imgur.com/uHmtfMs.jpg
Cheers!
 
motomataru said:
I think your problem is that you are using non-device tableaux in your script call from items. That, and to ensure troops get nothing but devices, you have to strip out all the non-device items from their equipment list in module_troops. That will, of course, affect other factions using the same troops.

The magic for devices all happens in tableaux and the scripts used there. Think of tableaux as Photoshop with texture files as layers. The set_banner scripts called from the item in VC simply find the device texture to use. It's script_process_shield_tableau that puts everything together:

Throw faction-indexed background color beneath:

      (cur_tableau_set_background_color, ":background_color"),

After some very fine positioning and angling, add the device "sticker":

        (store_add, ":arms_mesh", ":banner_index", arms_meshes_begin),

Layer over whatever mess the foregoing left on the back of the shield:

        (init_position, pos1),
        (position_set_x, pos1, -100),
        (position_set_z, pos1, 10),
        ...
          (cur_tableau_add_mesh_with_vertex_color, "mesh_white_bg_plane_a", pos1, 1000, 100, ":background_color"),

Layer on scratches, dents, rim, boss, etc.:
      (init_position, pos1),
      (position_set_z, pos1, 20),
      (cur_tableau_add_mesh, ":surface_mesh", pos1, 0),

You would need to do something like this for each heraldic armor. You could try starting with just sticking the device on somewhere. Bear in mind, without a graphical interface, moving, scaling, and undistorting the device is an extremely painstaking process of: modify the source, recompile, and run the game to check output. I really hope they give us THIS in Bannerlord!

More ambitious would be to resurrect the custom armor system in the Native source. Taking our approach, the would require leaving "gaps" in the heraldic armor textures to be filled with the background color and additional texture layers for any foreground layers, plus the surface layer.

Actually I don't mind if it will work the same for other factions, that's actually something I want (I wrote it before like I wanted it only for my troops under my arms, but that's not the case, my bad).
For all other "independent" troops which are not under any faction, it could show up the default white one and if I recruited them, it would change to one with my faction banner on their shields. That's my goal.

Regarding heraldic armor: I'm not going to do that, shields with fac. banner are enough to distinguish my troops from enemy' troops.

Thanks a lot for the explanation/info and your time btw.! I can't wait to see what M&B2: Bannerlord brings regarding modding tools/support :wink:
 
Templar_Maluxul said:
kraggrim said:
Do you mean like an algorithm that automatically sets them as 'heavy' or whatever based on stats? It doesn't work like that, they're set by ranges in module_constnts.py.


If you mean how did the devs decide which armours etc to place in which categories...no idea.


Anyway, this discussion is probably better continued in the modding QA thread in the VC modding section.

Ah, I think I understand what you're saying. All of the armors in the game have already been categorized as light, medium or heavy and changing their stats does not affect their category. I have fiddled around with stats on a Common Gambeson and after testing in game it still had a "medium" rating with 42/24 body/leg armor, 10 STR req and 16 weight. I guess that if I made a new item it would not be put into any category regardless of stats because it's not defined in "module_constnts.py"? Every day I keep thinking I should just put Morgh's Editor to rest and start editing stuff properly in the module system. I gave that a try before but I quickly chickened out because it's not as...easy to look at like Morgh's Tools.

Yep, and new item will be outside those ranges, so no effects are applied. You can plonk them down within those ranges but then it all gets moved down the list and everything gets ****ed up. So there's not really a solution without the module system.

Technically you can do a text edit to add a second range for your new items in the relevant script, but it's a pain in the arse to do from what I remember.
 
Back
Top Bottom