Modding VC: basic tutorials and Q&A thread

Users who are viewing this thread

Bearomir said:
Oh no way, that's pretty cool.
Han hecho un buen trabajo, buen mod!

Hey guys, this is a thread on modding VC, not about the game or the devs  :smile:.

You could use the thread on VCRE release (link) or create a new one to send them your love  :mrgreen:

Btw, VC is a DLC, not a mod
 
kalarhan said:
Bearomir said:
Oh no way, that's pretty cool.
Han hecho un buen trabajo, buen mod!

Hey guys, this is a thread on modding VC, not about the game or the devs  :smile:.

You could use the thread on VCRE release (link) or create a new one to send them your love  :mrgreen:

Btw, VC is a DLC, not a mod
My bad, couldn't resist.
As for modding, I was surprised that I couldn't sacrifice people at pagan places. So I looked into module system and found this when you pillage a monastery
Code:
      # ("spoils_woden",[(eq, 0, 1), (eq, "$g_player_faith", 2),],"Sacrifice some monks in honor of Odin and keep the booty.",
That whole section is commented out. I'll play with it and add that functionality back and come back with my findings. Hold my beer.
 
I'm trying to start with a ship at Tunsberg (custom sail, oak, varnish & purple)

Going through the code i found this:

      (party_set_slot, "$current_town", slot_party_shipyard_ship_type, "$build_ship_type"),
      (party_set_slot, "$current_town", slot_party_shipyard_ship_prop, "$build_ship_wood"),
      (party_set_slot, "$current_town", slot_party_shipyard_ship_time, 0),
I know Tunsberg is town_5

Would this work?

(party_set_slot, "town_5", slot_party_shipyard_ship_type, "$build_ship_type"),
(party_set_slot, "town_5", slot_party_shipyard_ship_prop, "$build_ship_wood"),
(party_set_slot, "town_5", slot_party_shipyard_ship_time, 0),

As for the finish, I found this, but not sure what the actual values of the properties are
            (troop_remove_gold, "trp_player", "$ship_menu_current_ship_price"),
            (call_script, "script_decode_value", "$ship_menu_current_ship_propertys"),
            (call_script, "script_encode_values_to_reg0", reg1, "$current_ship_sail", "$current_ship_paint", reg4, reg5),
            (assign, ":ship_properties", reg0),
            (store_add, ":current_ship_propertys_slot", slot_party_player_ships_propertys_begin, "$ship_menu_state"),
            (val_sub, ":current_ship_propertys_slot", 1),
            (party_set_slot, "$current_town", ":current_ship_propertys_slot", ":ship_properties"),
I'm thinking of sticking that in game menus where the player gets initial items.
 
Bearomir said:
I'm trying to start with a ship at Tunsberg (custom sail, oak, varnish & purple)

Check the dialog for "crafting" a custom ship. You could create a quest that gives you one for free (some kind of reward), or simple apply that logic and create the player fleet (party) with 1 ship (of that type and quality)

You can also check the "buy a ship" menu and follow that logic.
 
There's also the menu segment from the storyline where you get the first ship:
  (
    "primer_barco",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "You have obtained your first ship. A ship doesn't simply make it feasible for you to cross the sea. It makes you rich if you engage in trade across the sea. It makes you a feared man if you make quick raids on settlements on the coast. It makes you a ruler if you conquer foreign lands. The Norsemen say it will even bring you to the after-life.^^" +
    "However, traveling on a ship is also dangerous. The sea is like an open grave beneath the hull, awaiting you and your men. The storms of winter will harm your ships, but calm weather isn't much better, because it forces your men to row. To avoid overtaxing the crew, it is customary to stop traveling at night and to rest on land.^^" +
    "A ship is also a valuable possession. The owner should always keep an eye on it.^^Come back to this place as soon as you want to sail...",
    "none",
    [(set_background_mesh, "mesh_hacerbarco"),
    ],
    [
      ("choice_01_1bar",[],"Continue.",
        [
          #(quest_set_slot,"qst_getting_ship",slot_quest_current_state, 4),
          (call_script, "script_end_quest", "qst_getting_ship"),
         
          #(party_get_position, pos2, "p_frisa_beach"),
          (disable_party, "p_frisa_beach"),
          (set_spawn_radius, 0),
          (spawn_around_party, "p_main_party", "pt_landet_ships"),
          (assign, ":landet_ship_party", reg0),
          (str_store_troop_name, s1, "trp_player"),
          (party_set_name, ":landet_ship_party", "@{s1}'s Ships"),
          (party_set_slot, ":landet_ship_party", slot_party_type, spt_ship),
          #(party_set_position, ":landet_ship_party", pos2),
          (party_set_slot, ":landet_ship_party", slot_party_1_ship_type, 4), # = small warship
          (party_set_slot, ":landet_ship_party", slot_party_1_ship_quality, 80), # = bad quality
          (party_set_slot, ":landet_ship_party", slot_party_1_ship_name, "str_ship_name_1"), # = "Tranann"
          (change_screen_return),
      ]),
    ]
  ),
Could adapt that. Maybe stick something like it in the camp extra options menu or something else.

Or maybe you just have it run on game start and make it spawn around Tunsberg:
          (set_spawn_radius, 0),
          (spawn_around_party, "p_town_5", "pt_landet_ships"),
          (assign, ":landet_ship_party", reg0),
          (str_store_troop_name, s1, "trp_player"),
          (party_set_name, ":landet_ship_party", "@{s1}'s Ships"),
          (party_set_slot, ":landet_ship_party", slot_party_type, spt_ship),
          #(party_set_position, ":landet_ship_party", pos2),
          (party_set_slot, ":landet_ship_party", slot_party_1_ship_type, 4), # = small warship
          (party_set_slot, ":landet_ship_party", slot_party_1_ship_quality, 80), # = bad quality
          (party_set_slot, ":landet_ship_party", slot_party_1_ship_name, "str_ship_name_1"), # = "Tranann"
Presumably you can set the wood, sail and decoration here too, though I'm not sure how.
 
kraggrim said:
Presumably you can set the wood, sail and decoration here too, though I'm not sure how.

When in doubt check the slots in module_constants.py
Code:
# ships owned by player:
slot_party_1_ship_type					= 301 # Busse, etc
slot_party_1_ship_name					= 311 # name...
slot_party_1_ship_quality				        = 321 # Repair state (0 to 100%). At 0 it will sink (be destroyed)
slot_party_1_ship_propertys				= 331 # Wood type, sail, paint, etc

slot_party_1_ship_propertys uses a binary representation to store several flags in one slot. Something like 1001110010. There is a script that "decodes" that

Code:
(call_script, "script_decode_value", ":curr_ship_propertys"),

Code:
  ("decode_value",
    [(store_script_param, ":value", 1),
      
      # (set_fixed_point_multiplier, 1),
      
      (store_div, reg5, ":value", 10000),	# ship cargo
      (store_div, reg4, ":value", 1000),	# ship dragon head
      (store_div, reg3, ":value", 100),		# ship paint
      (store_div, reg2, ":value", 10),		# ship sail
      (store_div, reg1, ":value", 1),		# ship wood
      
      (store_mul, ":sub", reg2, 10),
      (val_sub, reg1, ":sub"),
      (store_mul, ":sub", reg3, 10),
      (val_sub, reg2, ":sub"),
      (store_mul, ":sub", reg4, 10),
      (val_sub, reg3, ":sub"),
      (store_mul, ":sub", reg5, 10),
      (val_sub, reg4, ":sub"),
  ]),
as you can see reg1 is the wood type

But how do I set the properties you ask? Use the encode script  :mrgreen:

Code:
  # script_encode_values_to_reg0
  # Component: Ships and sea
  # Input: ":ship_wood", ":ship_sail", ":ship_paint", ":ship_dragon_head", ":ship_cargo"
  ("encode_values_to_reg0",
    [(store_script_param, ":ship_wood", 1),
      (store_script_param, ":ship_sail", 2),
      (store_script_param, ":ship_paint", 3),
      (store_script_param, ":ship_dragon_head", 4),
      (store_script_param, ":ship_cargo", 5),
      
      (val_mul, ":ship_sail", 10),			# ship sail
      (val_mul, ":ship_paint", 100),		# ship paint
      (val_mul, ":ship_dragon_head", 1000),	# ship dragon head
      (val_mul, ":ship_cargo", 10000),		# ship cargo
      
      (assign, reg0, ":ship_wood"),
      (val_add, reg0, ":ship_sail"),
      (val_add, reg0, ":ship_paint"),
      (val_add, reg0, ":ship_dragon_head"),
      (val_add, reg0, ":ship_cargo"),]),
 
kalarhan said:
Bearomir said:
I'm trying to start with a ship at Tunsberg (custom sail, oak, varnish & purple)

Check the dialog for "crafting" a custom ship. You could create a quest that gives you one for free (some kind of reward), or simple apply that logic and create the player fleet (party) with 1 ship (of that type and quality)

You can also check the "buy a ship" menu and follow that logic.
That's exactly where I got it from. I was planning on just "spawning" it on Tunsberg as if I had bought it and talk to the shipwright to launch it. But I want it to be there by default. I see your comment now and makes things more clear. I had no idea you could choose the dragon head, that's very, very interesting.
 
Ruan said:
I want archers able to form ranks in VC which files I need to edit and how?

I'd guess it will be in the generic triggers (used in multiple mission templates, "extended_battle_menu" is an example) found at the top of the module_mission_templates.py file. Presumably there is something there that is either an exception for archers or only lists non-archers.

Edit: There are also various scripts that deal with formations, for example script_cf_battlegroup_valid_formation, script_cf_valid_formation_member , script_player_attempt_formation, script_player_formation_end, script_player_order_formations. The constraint could be contained in one of these.
 
kraggrim said:
Edit: There are also various scripts that deal with formations, for example script_cf_battlegroup_valid_formation, script_cf_valid_formation_member , script_player_attempt_formation, script_player_formation_end, script_player_order_formations. The constraint could be contained in one of these.

I discussed that in the early questions. When in doubt a good starting place is to use the game strings (texts, speechs, alerts, messages) as a reference

Code:
 Division 2 Archers is an archer division and cannot form ranks.
search the game code for "division and cannot form" and you will be directed to the script player_attempt_formation, which handles the validation (should this group be allowed to use this formation?).

Reading the code you will see that it calls a cf_ script to answer that basic question:
(call_script, "script_cf_battlegroup_valid_formation", "$fplayer_team_no", ":fdivision", ":fformation"),

(if anyone reading this doesn't know what cf_ means: you need to read the basic guides in the Forge, linked in the start of this thread. That is a very important concept)

You can then modify the rules there.

Code:
        (eq, ":sd_type", sdt_archer),
        (assign, ":size_minimum", formation_min_foot_troops),
        (try_begin),
          # (this_or_next|eq, ":fformation", formation_ranks), uncheck for proper
          # ranks
          (eq, ":fformation", formation_default),
          (assign, ":valid_type", 1),
        (try_end),

Archers are only allowed to used default formation (which is not enabled). Not ranks, shieldwall, wedge, square.

Why? Archers in Warband shoot the enemy in front of them. They don't shoot high in the air to hit a area. If you form ranks/multiple rows you will end up with many archers doing nothing (they can't shoot without killing the friendly in front of them)



Edit: keep in mind that enabling ranks to archers makes no sense. The formation is used to put "best" melee troops in the front row, and you are using archers... so that won't really work unless you create new rules/code to decide which archers should be considered "best" ....
 
kalarhan said:
I discussed that in the early questions. When in doubt a good starting place is to use the game strings (texts, speechs, alerts, messages) as a reference
Well, if you're going to insist on being efficient about these things  :mrgreen:.

Edit: keep in mind that enabling ranks to archers makes no sense. The formation is used to put "best" melee troops in the front row, and you are using archers... so that won't really work unless you create new rules/code to decide which archers should be considered "best" ....
I'm presuming he has a bunch of the Norse veteran archers, and would like to put them in front if the enemy manages to get close to them. Only reason I can think you'd want this.
 
kraggrim said:
I'm presuming he has a bunch of the Norse veteran archers, and would like to put them in front if the enemy manages to get close to them. Only reason I can think you'd want this.

But like I mentioned the script was created for melee troops, not archers. The stats are different, so if the game tries to apply the same logic it won't have the result you would expect, even worse if someone changes the troop tree/stats.

So to enable "RANKS" the modder will need to go deeper and first understand how it works, why it works that way, and HOW to adapt that to other types of units (like archers), or create a new formations like "archers ranks" and apply the new rules for it.

TLDR: things are not that simple when you are messing with AI decisions  :smile:
 
Update: (Miniguide, coder section)


Sublime API: do you want to type code 10x as fast? Do you want inline help with operations? Then check out this link https://forums.taleworlds.com/index.php/topic,320675.0.html


WRECK: alternative compiler that will let you do very cool stuff with your code. Visit the official thread to learn more:
https://forums.taleworlds.com/index.php/topic,325102.0.html


Lav's version of modules (for native, 1.166): check out the header_operations.py and header_triggers.py. You can actually read and understand those numbers, instead of guessing what they do (Lav's has added comments to explain and organize that stuff!)
http://forums.taleworlds.com/index.php/topic,324874.0.html


Sublime+WRECK+Lav's header_operations.py = much happier modder
 
Hi everybody, CrazyOldTeenager here. I was directed here by a moderator as I was told my question was more suitable for this forum rather than the support section.

I'm trying to incorporate the sling from Viking Conquest into a personal mod of mine, but I've come across the old problem where the sling doesn't fire and just keeps spinning around for a while after the attack button has been released. It eventually does fire, but only after several seconds, making it difficult to land accurate shots. For further description of the problem, visit this link: https://forums.taleworlds.com/index.php?topic=320434.0 I've obtained the original animation and copied the relevant code from module_animations.py, but the issue persists. How was this bug fixed before? 

 
CrazyOldTeenager said:
sling doesn't fire and just keeps spinning around

1. Make sure you are playing WB 1.168
2. Make sure you are using code from VC MS 2.023
3. Make sure you are copying the latest resources (BRF for animations).
4. Check the slingers code on module_items.py
5. Check the animation code on module_animations.py
6. Check your module.ini for these flags:

Code:
shorter_pistol_aiming = 1
apply_all_ammo_damage_modifiers = 1
 
Thank you very much, good sir! My slings work perfectly now, there is absolutely no delay when firing.

That being said, there is one other question I would like to ask...is it possible to remove the reload function for the sling, so that operates similarly to a javelin in that you can just keep firing until you're out of ammo without having to worry about the reloading process?
 
CrazyOldTeenager said:
is it possible to remove the reload function

try increasing the max_ammo of the weapon, that way the game thinks you have "that many" ready to fire (like a revolver with 6 bullets instead of a gun with 1)

Code:
max_ammo(1)

do that on module_items.py for your slingers
 
Sorenerv said:
2. Only Viking Conquest Mod Source may be used in non-Viking Conquest mods. Do not use Viking Conquest binary files such as textures, models, animations, sounds, music, and scenes.

I am wanting to make a small mod (because I am one man) with additional features, new content, OSP's, ....

Imagine that you are creating a Medieval Japan mod. All you want are the scripts for decapitation. You can use them, as long you add the DLC and BWStudios on your credits. It does not need to be a submod.

If you use any of the resources/binaries: any texture, music, sounds, BRF, animation, map, ... you need to turn your game into a submod. That means you will need to post it on this forum section (not the warband one), your players will be required to own the DLC to play your mod, but you are free to change stuff. Make it a total conversion, or a small feature addition. It does not matter. It is a submod of VC, the rest is up to you. You also need to add credits for the main game (VC DLC). Thats it.
 
:grin: :grin: :grin: :grin: :grin: :grin: :grin: :grin: :grin: :grin: :grin:

Thank you!! I was really worried. I have already started on my mod and have about a hard solid week into it. Glad the heart didn't sink there! haha. Making my mod is something I really want to do! I'm glad I'll be able to make scenes or do whatever. Great news!! Sorry I deleted my prior post I was not sure where it should go.
 
Question: How to skip character creation on a new game?

answered here  :arrow: https://forums.taleworlds.com/index.php/topic,349118.msg8377882.html#msg8377882

Example of use: I have a mod that follows this story

1) Click new game
2) You are inside a scene/instance for a battle (no previous menus, character creation, questions, history, etc)
3) Battle is scripted with some events (no spoilers...)
4) After battle is over you are sent to the worldmap to see how factions are distributed and to start to get your grips on the current stage of the story
5) 1 ingame hour later (player moves anywhere, as showed on the tutorial popup) game shows up some UI to tell the story (similar to VC)
6) Then it finally takes you to character creation (you can then pick a name, face and stats)



Example 2: just skip all the blah blah when doing TESTS. A button on the first menu allows you to skip it all, so you go directly to the worldmap. You will probably have to create hundreds of savegames that are only useful for a few seconds/minutes to collect data, so there ya go, shortcut!  :mrgreen:
 
ehy kalarhan, posting here following your advice on the other topic in the bug section.

here is the incriminated code from the 2.023 source module:

Code:
[anyone, "event_triggered", [
    ],
    "Sorry, I must take care of some business, but look me up again later... (companions limited to ten in party)", "close_window", [
      (troop_set_slot, "$map_talk_troop", slot_troop_playerparty_history, pp_history_quit),
      (call_script, "script_retire_companion", "$map_talk_troop", 150),
  ]],

I could either take out the whole thing or just the bits that make the companion actually leave, but I am afraid it might be related to some specific events later in the story campaign that could actually bug my save later on, because the "event_triggered" part is generic, I found it other places as well, I have no idea about its relative importance or lack thereof.
I have also already modded my game by making some tweaks to change things to my liking, for example I completely removed all the code related to companions complaining and whining at each other (after you played warband/mods/dlcs enough times you just grow tired of it :grin: ), so I am also afraid as to how related some interactions could be.

And since I discovered this topic, later on I am also going to post some more doubts/questions I had that were giving me compilation errors I could not understand the reasons why as I thought it was all correct, syntax included.

Meanwhile, cheers and thanks
 
Back
Top Bottom