Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I am looking for help modding Viking Conquest: the size of bandit party spawns is related to the player's party size at the time of their spawning, with smaller or larger player party size generating smaller or larger ai spawns, in a formula that also involves other factors.

I would like to break that dependency and make it so that it wouldn't matter whether the player had 10 troops or 100 troops in their party. Can anyone offer guidance on how to do this?

In particular, I would be happy making spawn size formula always use the player's level as player party size, or instead simply assume a fixed number as player party size, or, perhaps most ideally, generate a random number each time a spawn is created and base its size treating that random number as the player party size.

I am not attached to any particular way of changing this, as long as I can break the dependency on player party size.

I imagine doing any of this would be beyond the reach of simple text edits, but on the off-chance a text edit could accomplish any of these methods, that would be nice--but I am ready to work with the module system as needed.

I did find this tweak: http://forums.taleworlds.com/index.php/topic,46290.msg1254290.html#msg1254290

to change min and max for the party sizes, and I will explore simply defining a smaller range on that if alternatives are not available to work over the same broad range but without dependence on player party size.

Thanks for any insight or guidance!
 
Thanks.
Code:
(try_for_range, ":i_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":stack_troop",":party",":i_stack"),
#      (party_stack_get_size, ":stack_size", ":party", ":i_stack"),
        (neq, ":stack_troop", "trp_player"),
      (try_begin),
      (troop_slot_eq, ":stack_troop", slot_troop_tier_infantry, 1),
      (val_add, ":inf_tier_1", 1),
      (val_add, ":num_fit", 1),
      (else_try),
      (troop_slot_eq, ":stack_troop", slot_troop_tier_infantry, 2),
      (val_add, ":inf_tier_2", 1),
      (val_add, ":num_fit", 1),
      (else_try),
I wrote this code. I want to val_add 1 if troop is (an example) tier 1. How can I do that?
 
Code:
(try_for_range, ":slot_no", 0, 3), #or however many tiers
  (troop_set_slot, "trp_stack_selection_amounts", ":slot_no", 0),
(try_end),
(try_for_range, ":i_stack", 1, ":num_stacks"), #skip player as first troop
        (party_stack_get_troop_id, ":stack_troop",":party",":i_stack"),
        (neg|troop_is_hero, ":stack_troop"),
        (party_stack_get_size, ":stack_size", ":party", ":i_stack"),
        (party_stack_get_num_wounded, ":stack_wounded", ":party", ":i_stack"),
        (val_sub, ":stack_size", ":stack_wounded"),
        (gt, ":stack_size", 0),
        (troop_get_slot, ":tier_infantry", ":stack_troop", slot_troop_tier_infantry),
        (try_begin),
          (gt, ":tier_infantry", 0),
          (troop_get_slot, ":tier_stack", "trp_stack_selection_amounts", ":tier_infantry"),
          (val_add, ":tier_stack", ":stack_size"),
          (troop_set_slot, "trp_stack_selection_amounts", ":tier_infantry", ":tier_stack"),
        (try_end),
        (val_add, ":num_fit", ":stack_size"),
(try_end),
The resulting number of troops in each tier will be stored in the troop slots of
Code:
trp_stack_selection_amounts
 
Tingyun said:
Viking Conquest: the size of bandit party spawns

VC has a different system from Native.

Bandits are balanced around the player's strength (army and level), not player's army size. They phase out over time (as player gets a higher level). They are under a normal distribution to make sure there are groups of bandits weaker, at level and some stronger than the player (at spawn time). So a weaker bandit type would have a bigger party than a elite bandit party (a example), but keep the overall STR level.

One of the effects of the dynamic system is that if a player loses battles/territory/etc the bandits will also go down in strength (over time, as they die and respawn). That means you won't face a world full of impossible parties to fight if you lose your territory.

Anyway you can study the code and make your changes on "script_spawn_bandits". Look for the globals (to find triggers), the slots (to find the spawn database), the couple of globals related to options, etc, and adjust/remove them as you see fit.

You can then port your modsys changes to a .txt edit by replacing the numbers/script (thus merging a manual .txt mod with a modsys edit).
 
I have a somewhat random question related to .brf files, M&B engine mechanics and optimisation.

Is it beneficial to have a bunch of smaller .brf files filled with models which are usually used together (like CommonRes for example)?
Is there some way to optimise the use of .brf files for faster loading and maximum performace?
And if that's a thing, are there there any general guidelines on how to achive the best results?
 
Silver Wolf said:
I have a somewhat random question related to .brf files, M&B engine mechanics and optimisation.

Is it beneficial to have a bunch of smaller .brf files filled with models which are usually used together (like CommonRes for example)?
Is there some way to optimise the use of .brf files for faster loading and maximum performace?
And if that's a thing, are there there any general guidelines on how to achive the best results?
Quoting myself...
_Sebastian_ said:
Cozur said:
What is the best way to organise .brf resources?

All textures in one file, all materials in another, models in a third?
Doesn't really matter aslong as the loading order is correct (textures -> materials -> meshes).
Fewer but bigger resource files might be easier to work with, on the other hand potential mod-updates/patches become even bigger (due to the large brf files you have to update).
Game loading times of boths methods are roughly the same btw, unless you go for one brf per mesh/material/texture ofc.
In general you should try to keep the number of textures, materials and meshes as low as possible and reuse them as often as possible.
 
_Sebastian_ said:
In general you should try to keep the number of textures, materials and meshes as low as possible and reuse them as often as possible.

Thank you for a quick reply!
So basically what you're saying is that the way you organize your .brf files doesn't have much impact on performance (unless it's a complete mess, of course)?
I've always thought of them as loading blocks and I tend to cram my models/materials/textures into functional groups (faction/bandit/common), but I guess it doesn't matter that much.
 
It has no significant impact whether your 1000 new mod meshes are in 5, or 50 brfs. Would have an impact if they were in a thousand ones(as Sebastian said).

Brf organization is a matter of just that - organization. Working with different people on different projects however, allowed me to see a very clear impact on your workspeed/workflow when it comes to brf organization. They should be thematically(or as you said, functionally) separated so it is easy for new people working on your mod and yourself to locate stuff you want and to improve your workflow.

Also it is ideally better to work in smaller brfs, it'll allow you to release small and more frequent updates without giving everyone a downloading headache  :smile:
 
Hello, maybe is something very easy, but I don't know the problem (Or maybe I use wrong the operation). I create a new option in the camp menu, for show the position of the main party (I don't know why Ctrl+E in the world map doesn't work). The new option appears in game, but nothing happen.

Code:
("mostrar_coordenadas",
       [(try_begin),
	   (ge, "$cheat_mode", 1),
	   (else_try),
	   (ge, "$activaropcionesdesarrollo", 1),
	   (try_end),
        ], "Mostrar las coordenadas del jugador",
       [(party_get_position, pos1, "p_main_party"),
	   (display_message, pos1),
        ],
       ),

Thanks in advance.
 
Hernanxd16 said:
(try_begin),
  (ge, "$cheat_mode", 1),
  (else_try),
  (ge, "$activaropcionesdesarrollo", 1),
  (try_end),

that does nothing.

Hernanxd16 said:
      [(party_get_position, pos1, "p_main_party"),
  (display_message, pos1),
break the position into variables and concatenate them into a string

Code:
set_fixed_point_multiplier, 1000  #adjust the value here
position_get_x, reg1, pos1
position_get_y, ...
...get_z, ...
display_message, "@player at {reg1} {reg2} {reg3}"

you can ignore Z if X,Y are enough
 
Hernanxd16 said:
Hello, maybe is something very easy, but I don't know the problem (Or maybe I use wrong the operation). I create a new option in the camp menu, for show the position of the main party (I don't know why Ctrl+E in the world map doesn't work). The new option appears in game, but nothing happen.
Here is a simple trigger I use for the same purpose.
Code:
(0.0,
  [
	 (map_free),
	 (try_begin),
		 (key_clicked, key_h),
		 (set_fixed_point_multiplier, 100), #1 - 10, 25, 100, 125 etc., 
		 (party_get_position, pos1, "p_main_party"),
		 (position_get_x, reg1, pos1),
		 (position_get_y, reg2, pos1),
		 (position_get_z, reg3, pos1),
		 (display_message, "@Current position is {reg1}, {reg2}, {reg3}."),
	(try_end), 
  ]
),
 
Looking for advice on modifying script_party_calculate_loot

Currently, it seems that the order in which enemy stacks are killed determines the order in which they are looted, and very valuable loot can be lost if the loot fills up (thanks to a past Leonion post analyzing and explaining this: https://forums.taleworlds.com/index.php?topic=348755.0)

So, for example, if the player fights a large party with a small party, and kills a peasant first, then the loot box can be filled with very low value items, and the good equipment from the top units will be lost. This happens especially frequently in Viking Conquest with the "Take all loot" option, frequently returning worse results than equal shares because it fills the loot box so quickly.

I would like to either:

1) Have a function that sorts the killed enemy stacks by level before they begin to have their loot added, so that the highest level enemy stacks always have their loot added first

or

2) Have a function that cuts off very low value loot from ever appearing in the loot pool, or makes it very unlikely to appear, so it doesn't fill up. Perhaps dependent on player level.

Does anyone have advice, or know of where I can find a similar function to adapt to this purpose? I have tried to figure out how to code it, but am a bit lost.
 
kalarhan said:
Hernanxd16 said:
(try_begin),
  (ge, "$cheat_mode", 1),
  (else_try),
  (ge, "$activaropcionesdesarrollo", 1),
  (try_end),

that does nothing.

Hernanxd16 said:
      [(party_get_position, pos1, "p_main_party"),
  (display_message, pos1),
break the position into variables and concatenate them into a string

Code:
set_fixed_point_multiplier, 1000  #adjust the value here
position_get_x, reg1, pos1
position_get_y, ...
...get_z, ...
display_message, "@player at {reg1} {reg2} {reg3}"

you can ignore Z if X,Y are enough

Thanks. Now works good.

Leonion said:
Hernanxd16 said:
Hello, maybe is something very easy, but I don't know the problem (Or maybe I use wrong the operation). I create a new option in the camp menu, for show the position of the main party (I don't know why Ctrl+E in the world map doesn't work). The new option appears in game, but nothing happen.
Here is a simple trigger I use for the same purpose.
Code:
(0.0,
  [
	 (map_free),
	 (try_begin),
		 (key_clicked, key_h),
		 (set_fixed_point_multiplier, 100), #1 - 10, 25, 100, 125 etc., 
		 (party_get_position, pos1, "p_main_party"),
		 (position_get_x, reg1, pos1),
		 (position_get_y, reg2, pos1),
		 (position_get_z, reg3, pos1),
		 (display_message, "@Current position is {reg1}, {reg2}, {reg3}."),
	(try_end), 
  ]
),

I tried with your code also, but I only get this error in the compiler:

Code:
*** Warband Refined & Enhanced Compiler Kit (W.R.E.C.K.) version 1.0.0 ***
Please report errors, problems and suggestions at http://lav.lomskih.net/wreck/

Loading module... DONE.
Loading plugins... DONE.
Checking module syntax... FAILED.
MODULE `triggers` ERROR:
failed to parse element #31
  cannot convert value [37, 4, (71, 35), (2124, 100), (1625, <reg.pos1[@1]>, 'p_
main_party'), (726, <reg.reg1[@72057594037927937]>, <reg.pos1[@1]>), (727, <reg.
reg2[@72057594037927938]>, <reg.pos1[@1]>), (728, <reg.reg3[@72057594037927939]>
, <reg.pos1[@1]>), (1106, '@Current position is {reg1}, {reg2}, {reg3}.'), 3] to
 float


COMPILATION FAILED.

Script processing has ended as of 17:26:42,10
Presione una tecla para continuar . . .
 
Tingyun said:
Looking for advice on modifying script_party_calculate_loot

you can do this in different ways. Couple examples:

- create your own loot table as agents are defeated/wounded, save the data, order it later with some criteria, and fill the inventory for the loot UI? You can look for examples on how to handle lists/arrays on the tutorial/osp section to do this.

- use the inventory feature to keep track of your custom loot. Remove/add stuff as agents are defeated. That way you have full control of what will show up.

A common problem with loot is battle continuation (when you need to restart the battle several times, as the armies are too big). And also siege battles.


 
Tingyun said:
Currently, it seems that the order in which enemy stacks are killed determines the order in which they are looted, and very valuable loot can be lost if the loot fills up (thanks to a past Leonion post analyzing and explaining this: https://forums.taleworlds.com/index.php?topic=348755.0)
That particular observation wasn't mine, I only translated it.  :smile:

Hernanxd16 said:
I tried with your code also, but I only get this error in the compiler:

Code:
MODULE `triggers` ERROR:
Leonion said:
Here is a simple trigger I use for the same purpose.
 
Thanks Kalarhan! Though that may be a bit more involved than I want to go yet.

Thanks Leonion for translating then. :smile:

Hmm, does anyone see any problems with the below code?

This would be a quick idea to cap the number of low level troops looted--since their gear isn't really valuable anyway--thus making room for the high level.

The part that starts with storing character level is my addition.

      (party_get_num_companion_stacks, ":num_stacks",":enemy_party"),
      (try_for_range, ":i_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":stack_troop",":enemy_party",":i_stack"),
        (neg|troop_is_hero, ":stack_troop"),
        (party_stack_get_size, ":stack_size",":enemy_party",":i_stack"),
(store_character_level, ":troop_levelloot", ":stack_troop"),
(try_begin),
(le, ":troop_levelloot", 23),
(val_min, ":stack_size", 20),
(try_end),
(try_begin),
(le, ":troop_levelloot", 20),
(val_min, ":stack_size", 10),
(try_end),
(try_begin),
(le, ":troop_levelloot", 16),
(val_min, ":stack_size", 5),
(try_end),
        (try_for_range, ":unused", 0, ":stack_size"),
          (troop_loot_troop, "trp_temp_troop", ":stack_troop", ":loot_probability"),
        (try_end),

I think that would make it so high level troops are unlimitied, but any given stack lvl 23 and below only 20 can be looted, lvl 20 and below only 10, and lvl 16 and below only 5 enemies looted at most?
 
Status
Not open for further replies.
Back
Top Bottom