Tweaks for Viking Conquest (one for 2.028, others for 2.021, 2.012, 2.010 etc)

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
JuJu70 said:
{reg3} is the amount you get from plundering. It's calculated by the script
we know that, we just need the modules. Coming with 1.04, right?  :twisted:
 

CrvenBear

Recruit
Best answers
0
Since I was so kindly invited over here, I'll request some tweaks :razz:

-Effect of Leadership skill on troop wages (every level of Leadership decreases wages by 5%, how would I change that?)
-Modifying the feeding frequency of my troops and the amount of food they feast upon per soldier (native setting was 3 soldiers eating 1 unit of food every 14 hours)
-Renown deterioration over time (frequency of deterioration and percent of renown that goes away)

Thanks in advance babe.
 

kraggrim

Marquis
WBM&BWF&SNWVC
Best answers
0
Change food consumption frequency and amount: 1.04

Open up simple_triggers.txt and look for this line:
12.000000  44 31 2 144115188075855908 0 2156 2 72057594037927961 648518346341351424 2133 2 1224979098644774912 72057594037927961 2108 2 1224979098644774912 3 4 0 31 2
If you're using notepad++ or whatever it should be line 63.

That 12.000000 at the beginning is the number of hours between feedings, change it to whatever you want.
Later there should be a bit that looks like 3 4 0 31 2. That 3 is the number of troops fed by one unit of food.



CrvenBear said:
-Renown deterioration over time (frequency of deterioration and percent of renown that goes away)
I don't know what this is. Does renown deteriorate by itself? I've never noticed this.
 

CrvenBear

Recruit
Best answers
0
kraggrim said:
CrvenBear said:
-Renown deterioration over time (frequency of deterioration and percent of renown that goes away)
I don't know what this is. Does renown deteriorate by itself? I've never noticed this.
It does, as a matter of fact. There was a tweak I found in Magelord's compilation but I lost it, I'll try and look it up again, see if it's compatible with VC and PM you so you could add it to the main post. Also thanks for the food. Now get grunting on the Leadership :razz:
 

CrvenBear

Recruit
Best answers
0
It should be, yeah.
Also add this to the main post, here's the tweak for modifying renown drain, all credits to TheMageLord:
Open up simple_triggers.txt, search for
168.000000  4 520 3 1224979098644774912 360287970189639680 7 2123 3 1224979098644774913 1224979098644774912 200
The 168.00 in the beginning is the timer for the drain frequency. The higher the number, the more time it takes for the renown drain tick to occur.
The 200 is the percentage of renown drained from your total pool, meaning 0.5% in this case. The higher the number, the lower the percentage of renown drained.
In order to basically negate the renown drain change the 168 to 999999 and the 200 to 999999
 

kraggrim

Marquis
WBM&BWF&SNWVC
Best answers
0
Thanks for that.  I had a look at the leaderships troop wage thing but couldnt figure it out. game_get_troop_wage -1 in scripts.txt is the area you want to look at.  I presume it would be one of the instances of " 5 " in there, if the reduction is still 5%
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
CrvenBear said:
It should be, yeah.
Also add this to the main post, here's the tweak for modifying renown drain, all credits to TheMageLord:
.....
Techie stuff :

Thats the native script (from simple_triggers.txt):
Code:
  # Reduce renown slightly by 0.5% every week
  (7 * 24,
   [
       (troop_get_slot, ":player_renown", "trp_player", slot_troop_renown),
       (store_div, ":renown_decrease", ":player_renown", 200),
       (val_sub, ":player_renown", ":renown_decrease"),
       (troop_set_slot, "trp_player", slot_troop_renown, ":player_renown"),
    ]),
7 * 24 = 168 hours (1week)
troop_get_slot                  = 520
tag_register        =  1
tag_variable        =  2
tag_string          =  3
tag_item            =  4
tag_troop          =  5
slot_troop_renown              = 7
troop_set_slot                  = 500
store_div              = 2123
val_sub                = 2106

Game translates that to:
Code:
168 4 520 3  ":player_renown"  "trp_player" 7 2123 3 ":renown_decrease" ":player_renown" 200 2106 2 ":player_renown" ":renown_decrease" 500  3 "trp_player" 7 ":player_renown"
Code:
168.000000  4 520 3 1224979098644774912 360287970189639680 7 2123 3 1224979098644774913 1224979098644774912 200 2106 2 1224979098644774912 1224979098644774913 500 3 360287970189639680 7 1224979098644774912
I didnt replace the variables/strings for simplicity (":player_renown"=1224979098644774912 ;  "trp_player"=360287970189639680 ; ":renown_decrease"=1224979098644774913 )



Now, assuming that VC has a similar trigger, we can find out the script and tweak code:

Code:
168.000000  4 520 3 1224979098644774912 360287970189639680 7 2123 3 1224979098644774913 1224979098644774912 200 2106 2 1224979098644774912 1224979098644774913 500 3 360287970189639680 7 1224979098644774912
Its is the same *processed* code on VC and native. It could have difference values for the variables/strings, but that is easy to translate as I showed above. Anyway:

Code:
  # Reduce renown slightly by 0.5% every week
  (7 * 24,
   [
       (troop_get_slot, ":player_renown", "trp_player", slot_troop_renown),
       (store_div, ":renown_decrease", ":player_renown", 200),
       (val_sub, ":player_renown", ":renown_decrease"),
       (troop_set_slot, "trp_player", slot_troop_renown, ":player_renown"),
    ]),
Example:

1000 renown -> renown_decrease = 1000/200 , renown_decrease = 5; player_renown = player_renown - renown_decrease = 1000 - 5 = 995 -> player_renown= 995
200 -> 200/200 = 1 -> 199
500 -> 500/200 = 2 -> 498
2000 -> 2000/200 = 10 -> 1990

Tweaks:
So you can change the frequency (168.00000). You could test and just exclude the entire trigger. You can exclude the code line that does the substract. You can change the percentual to something else (the 200 value). And so on.

E.g: 200 to 1000 (from 0.5% to 0.1%)
200 renown -> 200 / 1000 = 0 (no change)
1000 renown -> 1000/1000 = 1 (999)
2000 renown -> 2000/1000 = 2 (199:cool:

Hope that helps.

Cheers
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
CrvenBear said:
-Effect of Leadership skill on troop wages (every level of Leadership decreases wages by 5%, how would I change that?)
Original File:  module_scripts.py
Compiled file: scripts.txt
Script name:  script_game_get_troop_wage

It comes from this snippet (native):
Code:
     (store_skill_level, ":leadership_level", "skl_leadership", "trp_player"),
      (store_mul, ":leadership_bonus", 5, ":leadership_level"),
      (store_sub, ":leadership_factor", 100, ":leadership_bonus"), 
      (val_mul, ":wage", ":leadership_factor"),  #wage = wage * (100 - 5*leadership)/100
      (val_div, ":wage", 100),
What it does: wage = wage * (100 - 5*leadership)/100
Examples:
leadership 1  -> 5 * 1 = 5; 100 - 5 = 95; wage * 95 / 100 => 5% discount
leadership 14 -> 5*14=70; 100-70 = 30; wage * 30 / 100 => 70% discount

Transforming that snippet to compiled code:
2170 2 ":leadership_level" "skl_leadership" 3 "trp_player"
2122 2 ":leadership_bonus" 5 3 ":leadership_level"
2121 2 ":leadership_factor" 100 2 ":leadership_bonus"
2107 2 ":wage" 2 ":leadership_factor"
2108 2 ":wage" 100


VC compiled script
Code:
game_get_troop_wage -1
 54 21 1 1224979098644774912 22 1 1224979098644774913 2133 2 1224979098644774914 0 2170 3 1224979098644774915 1369094286720630785 360287970189639680 4 0 1073741855 2 1224979098644774912 360287970189639680 31 2 1224979098644774912 360287970189639867 5 0 33 3 1224979098644774912 360287970189640144 360287970189640150 5 0 2171 2 1224979098644774916 1224979098644774912 2133 2 1224979098644774914 1224979098644774916 4 0 2147483680 2 1224979098644774916 23 2105 2 1224979098644774914 1 2106 2 1224979098644774914 1224979098644774915 5 0 31 2 1224979098644774916 26 2105 2 1224979098644774914 10 2106 2 1224979098644774914 1224979098644774915 5 0 2105 2 1224979098644774914 21 2106 2 1224979098644774914 1224979098644774915 3 0 2111 2 1224979098644774914 1 3 0 4 0 2147483681 3 1224979098644774912 360287970189639975 360287970189639991 152 1 1224979098644774912 2107 2 1224979098644774914 5 2108 2 1224979098644774914 4 3 0 4 0 33 3 1224979098644774912 360287970189639710 360287970189639719 2107 2 1224979098644774914 5 2108 2 1224979098644774914 4 3 0 4 0 33 3 1224979098644774912 360287970189639975 360287970189639991 2107 2 1224979098644774914 4 3 0 4 0 33 3 1224979098644774912 360287970189639828 360287970189639840 2107 2 1224979098644774914 5 2108 2 1224979098644774914 4 3 0 4 0 2147483679 2 1224979098644774912 360287970189639680 2147483679 2 1224979098644774912 360287970189639867 2147483681 3 1224979098644774912 360287970189640144 360287970189640150 2111 2 1224979098644774914 1 3 0 2133 2 72057594037927936 1224979098644774914 2075 1 72057594037927936
VC code is quite different, so the old tweak would not work. I did a quick "by-hand" transformation so we can find a new tweak:

Code:
("game_get_troop_wage",
 [
	(store_script_param_1, ":troop_id"),
	(store_script_param_2, ":unused"),       
	(assign,":wage", 0), 
	(store_skill_level, ":leadership_level", "skl_leadership", ":trp_player"),
	(try_begin), 
		(this_or_next|eq ,":troop_id", "trp_player"),
		(eq, ":troop_id", "trp_kidnapped_girl"),
	(else_try_begin),
		(is_between, ":troop_id", pretender_begin, pretender_end),
	(else_try),
		(store_character_level, ":troop_level", ":troop_id"),
		(assign, ":wage", ":troop_level"),
		(try_begin),
			(le ,":troop_level", 23),
			(val_add, ":wage", 1),
			(val_sub, ":wage", ":leadership_level"),
		(else_try),
			(eq, ":troop_level", 26),
			(val_add, ":wage", 10),
			(val_sub, ":wage", ":leadership_level"),
		(else_try),
			(val_add, ":wage", 21),
			(val_sub, ":wage", ":leadership_level"),
		(try_end),
		(val_max,  ":wage", 1),
	(try_end),
		
	(try_begin),
		(2147483681, ":troop_id", 360287970189639975, 360287970189639991),
		(troop_is_mounted,":troop_id"),
		(val_mul, ":wage", 5),
		(val_div, ":wage, 4),
	(try_end),
	(try_begin),
		(is_between,":troop_id",360287970189639710,360287970189639710),
		(val_mul, ":wage", 5),
		(val_div, ":wage, 4),
	(try_end),
	(try_begin),	
		(is_between,":troop_id",360287970189639975, 360287970189639991),
		(val_mul, ":wage", 4),
	(try_end),
	(try_begin),	
		(is_between,":troop_id",360287970189639828, 360287970189639840),
		(val_mul, ":wage", 5),
		(val_div, ":wage, 4),			
	(try_end),
	(try_begin),	
		(2147483679, ":troop_id", "trp_player"),
		(2147483679, ":troop_id", "trp_kidnapped_girl"),
		(2147483681, ":troop_id", pretender_begin, pretender_end),
		(val_max, ":wage", 1),
	(try_end),
	(assign, 72057594037927936,":wage"), #regX like reg0
	(set_trigger_result, 72057594037927936),
]),

I didnt finished some of the operations cause they wont change the leadership tweak.

TLDR: for VC it seens leadership is a direct subtraction and not a percentual.

Example: mounted troop level 23. Not a hero/companion/player.
wage = 0
leadership = 5
wage = 23              (level)
wage = 23 + 1 = 24 (+1)
wage = 24 - 5 = 19  (leadership bonus)
wage = 19 * 5 = 95  (mounted)
wage = 95 / 4 = 23  (mounted)

Tweak:
Increase the value of leadership. As a player skill goes from 0 to 10, we could add the following code:
Code:
(val_add, ":leadership_level", 5),
--> ALERT: personal skill bonus is not taken into account here. So if you have 10 leadership that is the ammount and not 14.

in numbers:
change this for 1.03:
Code:
54 21 1 1224979098644774912 22 1 1224979098644774913 2133 2 1224979098644774914 0 2170 3 1224979098644774915 1369094286720630785 360287970189639680 4 0
to this:
55 21 1 1224979098644774912 22 1 1224979098644774913 2133 2 1224979098644774914 0 2170 3 1224979098644774915 1369094286720630785 360287970189639680 2105 2 1224979098644774915 5 4 0
change this for 1.04:
Code:
 61 21 1 1224979098644774912 22 1 1224979098644774913 2133 2 1224979098644774914 0 2170 3 1224979098644774915 1369094286720630785 360287970189639680 4 0
to this:
Code:
 62 21 1 1224979098644774912 22 1 1224979098644774913 2133 2 1224979098644774914 0 2170 3 1224979098644774915 1369094286720630785 360287970189639680 2105 2 1224979098644774915 5 4 0
The number 5 above is your tweak. You can put 1, 2, 3.....  :razz:
 

kraggrim

Marquis
WBM&BWF&SNWVC
Best answers
0
Thanks kalarhan, very good work.

Transforming that snippet to compiled code:
2170 2 ":leadership_level" "skl_leadership" 3 "trp_player"
2122 2 ":leadership_bonus" 5 3 ":leadership_level"
2121 2 ":leadership_factor" 100 2 ":leadership_bonus"
2107 2 ":wage" 2 ":leadership_factor"
2108 2 ":wage" 100
Is there a guide or something for interpreting this kind of stuff, or did you just extrapolate?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
kraggrim said:
Thanks kalarhan, very good work.

Is there a guide or something for interpreting this kind of stuff, or did you just extrapolate?
Hum that comes from modding. All you need to do is read the process_XXXX.py files to learn how they *compile* the source, then you open native modules for the codes and you work from there. The wage script took me 10minutes.

header_operations.py has the engine codes. Examples:
Code:
assign                     = 2133    # (assign, <destination>, <value>),
                                     # Directly assigns a value to a variable or register.

val_add                    = 2105    # (val_add, <destination>, <value>),
                                     # Assigns <destination> := <destination> + <value>
val_sub                    = 2106    # (val_sub, <destination>, <value>),
                                     # Assigns <destination> := <destination> - <value>
val_mul                    = 2107    # (val_mul, <destination>, <value>),
                                     # Assigns <destination> := <destination> * <value>
val_div                    = 2108    # (val_div, <destination>, <value>),
                                     # Assigns <destination> := <destination> / <value>

call_script             =    1  # (call_script, <script_id>, [<script_param>...]),
                                # Calls specified script with or without parameters.
try_begin               =    4  # (try_begin),
                                # Opens a conditional block.
else_try                =    5  # (else_try),
                                # If conditional operations in the conditional block fail, this block of code will be executed.
try_end                 =    3  # (try_end),
                                # Concludes a conditional block or a cycle.

So if you see a 2133 you can see its a (assign, <destination>, <value>), which will require a variable and a value (number, variable, etc).

From module_constants.py you have the slots codes (savegame file). Its easy to find any special code from VC by checking with MnBSaveGameEditor.

From header_common.py you have some masks and very important: tags
Code:
tag_register        =  1
tag_variable        =  2
tag_string          =  3
tag_item            =  4
tag_troop           =  5
tag_faction         =  6
tag_quest           =  7
tag_party_tpl       =  8
tag_party           =  9
....
with that you can see that a 2170 2 123456 would mean: operation 2170 + variable 123456.

Scripts that exist on native are easier to figure out as you can compare the variables to figure out names quickly. But in general its easy to get the general code idea in a few minutes just by looking at it once you memorize the codes (modders tend to do that after a few months lol).

On a hypothetical world you could use a script to do that for you  :wink:

Cheers
 

kraggrim

Marquis
WBM&BWF&SNWVC
Best answers
0
And here I was just using intuition and lucky guesses! Cheers for the explanation, should come in handy.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
Tweak looting value from monasteries
File:    menus.txt
Menu: menu_saquear_monasterio

1.03:
360287970189639683 2041 1 360287970189639683 5 0 2136 3 1224979098644774917 100 500
100 and 500 is the range for the loot. Change to something else like 1000 and 5000 and you will get 10x the cash loot.



1.04:

(2136 3 12249790986447[0-9]{5} )(100)( )(12249790986447[0-9]{5})
\1XXX\3YYY
XXX to YYY is the value for looting
 

gdwitt

Knight at Arms
Best answers
0
Are you working with the Brytenwalda module_system? Or native?
Do you have some secret module system for Vikings.
I'm still modding Brytenwalda because I can read and understand the module system.

I find you explanations below to be very clear and insightful.
Can you refer us to any tutorial or reference posts that explain things like you are doing?

I know how to compile the moduleysystem then compare its output with current game code.
I just wish I had a better understanding of the logic of the system and what stands for what in the compiled number lists.

 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
gdwitt said:
I know how to compile the moduleysystem then compare its output with current game code.
I just wish I had a better understanding of the logic of the system and what stands for what in the compiled number lists.
You can start here:
kalarhan said:
kraggrim said:
Thanks kalarhan, very good work.

Is there a guide or something for interpreting this kind of stuff, or did you just extrapolate?
Hum that comes from modding. All you need to do is read the process_XXXX.py files to learn how they *compile* the source, then you open native modules for the codes and you work from there. The wage script took me 10minutes.

header_operations.py has the engine codes. Examples:
Code:
assign                     = 2133    # (assign, <destination>, <value>),
                                     # Directly assigns a value to a variable or register.

val_add                    = 2105    # (val_add, <destination>, <value>),
                                     # Assigns <destination> := <destination> + <value>
val_sub                    = 2106    # (val_sub, <destination>, <value>),
                                     # Assigns <destination> := <destination> - <value>
val_mul                    = 2107    # (val_mul, <destination>, <value>),
                                     # Assigns <destination> := <destination> * <value>
val_div                    = 2108    # (val_div, <destination>, <value>),
                                     # Assigns <destination> := <destination> / <value>

call_script             =    1  # (call_script, <script_id>, [<script_param>...]),
                                # Calls specified script with or without parameters.
try_begin               =    4  # (try_begin),
                                # Opens a conditional block.
else_try                =    5  # (else_try),
                                # If conditional operations in the conditional block fail, this block of code will be executed.
try_end                 =    3  # (try_end),
                                # Concludes a conditional block or a cycle.

So if you see a 2133 you can see its a (assign, <destination>, <value>), which will require a variable and a value (number, variable, etc).

From module_constants.py you have the slots codes (savegame file). Its easy to find any special code from VC by checking with MnBSaveGameEditor.

From header_common.py you have some masks and very important: tags
Code:
tag_register        =  1
tag_variable        =  2
tag_string          =  3
tag_item            =  4
tag_troop           =  5
tag_faction         =  6
tag_quest           =  7
tag_party_tpl       =  8
tag_party           =  9
....
with that you can see that a 2170 2 123456 would mean: operation 2170 + variable 123456.

Scripts that exist on native are easier to figure out as you can compare the variables to figure out names quickly. But in general its easy to get the general code idea in a few minutes just by looking at it once you memorize the codes (modders tend to do that after a few months lol).

On a hypothetical world you could use a script to do that for you  :wink:

Cheers

and go from there. It was maybe easier for me as I am a software developer (few decades of XP), so learning a new language and compilers takes a couple hours. As a modder you could probably handle this stuff in a day or two.

Also it will be alot easier if you install Sublime and the M&B pack we have on the modding forum.
 

kraggrim

Marquis
WBM&BWF&SNWVC
Best answers
0
Added "Change the village recruit type of to be based on the faction owning the village" to front page.

Kalarhan, any idea how to do this tweak for towns/castles?
 

JuJu70

kraggrim said:
Added "Change the village recruit type of to be based on the faction owning the village"
I guess because people get replaced overnight?

100 and 500 is the range for the loot. Change to something else like 1000 and 5000 and you will get 10x the cash loot.
Why not 1000000 to 5000000? :party: