How to Moddify Vilage Income

正在查看此主题的用户

So I was thinking about income the other day when it occurred to me that in the feudal era most of a lords income came from the area he controlled while here I need the Bank to keep a steady cash flow. But the amount you get from villages, castles, and even towns is really small overall. I don't have any experience with modding but can someone suggest how I might change those numbers? I would also be interested in changing the amount of money a king pays you for being a mercenary. Finally this might be more complicated but is it possible to make it so that even after a town was looted it still pays something? Thanks.
 
I don't know how you can make it so that you'll get money after the village has been looted or how to have your mercenary contract pay more money, but you can easily change your village, castle and town income with TweakMB, as well as a lot of other settings, you can also change the amount of time you'll be under a mercenary contract.

Go to the forum post dedicated to TweakMB and read up on the other features and decide for yourself whether it is worth downloading, in my opinion it is very much so.

http://forums.taleworlds.com/index.php/topic,101731.0.html
 
I found this post about editing the module files to change the mercenary income http://forums.taleworlds.com/index.php/topic,120797.msg2920844.html#msg2920844 but if I want to do that how do I go about it. Do I need to download the source for this mod then make the changes and compile it?
 
Simple_triggers.py

插入代码块:
   #Accumulate taxes
   (24 * 7,
   [
      #Adding earnings to town lords' wealths.
      #Moved to troop does business
      #(try_for_range, ":center_no", centers_begin, centers_end),
      #  (party_get_slot, ":town_lord", ":center_no", slot_town_lord),
      #  (neq, ":town_lord", "trp_player"),
      #  (is_between, ":town_lord", active_npcs_begin, active_npcs_end),
      #  (party_get_slot, ":accumulated_rents", ":center_no", slot_center_accumulated_rents),
      #  (party_get_slot, ":accumulated_tariffs", ":center_no", slot_center_accumulated_tariffs),
      #  (troop_get_slot, ":troop_wealth", ":town_lord", slot_troop_wealth),
      #  (val_add, ":troop_wealth", ":accumulated_rents"),
      #  (val_add, ":troop_wealth", ":accumulated_tariffs"),
      #  (troop_set_slot, ":town_lord", slot_troop_wealth, ":troop_wealth"),				
      #  (party_set_slot, ":center_no", slot_center_accumulated_rents, 0),
      #  (party_set_slot, ":center_no", slot_center_accumulated_tariffs, 0),
      #  (try_begin),
      #    (eq, "$cheat_mode", 1),
      #    (assign, reg1, ":troop_wealth"),
      #    (add_troop_note_from_sreg, ":town_lord", 1, "str_current_wealth_reg1", 0),
      #  (try_end),
      #(try_end),
      
	  #Collect taxes for another week
      (try_for_range, ":center_no", centers_begin, centers_end),
        (try_begin),
          (party_slot_ge, ":center_no", slot_town_lord, 0), #unassigned centers do not accumulate rents	  
        
          (party_get_slot, ":accumulated_rents", ":center_no", slot_center_accumulated_rents),
		
          (assign, ":cur_rents", 0),
          (try_begin),
            (party_slot_eq, ":center_no", slot_party_type, spt_village),
            (try_begin),
              (party_slot_eq, ":center_no", slot_village_state, svs_normal),
              (assign, ":cur_rents", 1200),
            (try_end),
          (else_try),
            (party_slot_eq, ":center_no", slot_party_type, spt_castle),
            (assign, ":cur_rents", 1200),
          (else_try),  
            (party_slot_eq, ":center_no", slot_party_type, spt_town),
            (assign, ":cur_rents", 2400),
          (try_end),
		
          (party_get_slot, ":prosperity", ":center_no", slot_town_prosperity), #prosperty changes between 0..100     
          (store_add, ":multiplier", 20, ":prosperity"), #multiplier changes between 20..120
          (val_mul, ":cur_rents", ":multiplier"), 
          (val_div, ":cur_rents", 120),#Prosperity of 100 gives the default values
          
          (try_begin),
            (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
            
            (game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
            (try_begin),
              (eq, ":reduce_campaign_ai", 0), #hard (less money from rents)
              (val_mul, ":cur_rents", 3),
              (val_div, ":cur_rents", 4),
            (else_try),
              (eq, ":reduce_campaign_ai", 1), #medium (normal money from rents)
              #same
            (else_try),
              (eq, ":reduce_campaign_ai", 2), #easy (more money from rents)
              (val_mul, ":cur_rents", 4),
              (val_div, ":cur_rents", 3),
            (try_end),                
          (try_end),  
                    
          (val_add, ":accumulated_rents", ":cur_rents"), #cur rents changes between 23..1000

          ##diplomacy begin
          (try_begin),    
            (str_store_party_name, s6, ":center_no"),
             
            (party_get_slot, ":tax_rate", ":center_no", dplmc_slot_center_taxation),
            (neq, ":tax_rate", 0),
            (store_div, ":rent_change", ":accumulated_rents", 100),
            (val_mul, ":rent_change", ":tax_rate"),
   
            (try_begin), #debug
              (eq, "$cheat_mode", 1),
              (assign, reg0, ":tax_rate"),
              (display_message, "@{!}DEBUG : tax rate in {s6}: {reg0}"),
              (assign, reg0, ":accumulated_rents"),
              (display_message, "@{!}DEBUG : accumulated_rents  in {s6}: {reg0}"),
              (assign, reg0, ":rent_change"),
              (display_message, "@{!}DEBUG : rent_change in {s6}: {reg0}  in {s6}"),
            (try_end),          
  
            (val_add, ":accumulated_rents", ":rent_change"),
            
            (val_div, ":tax_rate", -25),
            
            (call_script, "script_change_center_prosperity", ":center_no", ":tax_rate"),
  
            (try_begin),
              (lt, ":tax_rate", 0), #double negative values
              (val_mul, ":tax_rate", 2),
              
              (try_begin), #debug
                (eq, "$cheat_mode", 1),
                (assign, reg0, ":tax_rate"),
                (display_message, "@{!}DEBUG : tax rate after modi in {s6}: {reg0}"),
              (try_end),
  
              (try_begin),
                (this_or_next|is_between, ":center_no", villages_begin, villages_end),
                (is_between, ":center_no", towns_begin, towns_end),
                (party_get_slot, ":center_relation", ":center_no", slot_center_player_relation),
  
                (try_begin), #debug
                  (eq, "$cheat_mode", 1),
                  (assign, reg0, ":center_relation"),
                  (display_message, "@{!}DEBUG : center relation: {reg0}"),
                (try_end),
              
                (le, ":center_relation", -5),
                (store_random_in_range, ":random",-100, 0),
                (gt, ":random", ":center_relation"),           
                
                (neg|party_slot_eq, ":center_no", slot_village_infested_by_bandits, "trp_peasant_woman"),
                (display_message, "@Riot in {s6}!"),
                (party_set_slot, ":center_no", slot_village_infested_by_bandits, "trp_peasant_woman"), #trp_peasant_woman used to simulate riot
                (call_script, "script_change_center_prosperity", ":center_no", -1),     
                (call_script, "script_add_notification_menu", "mnu_dplmc_notification_riot", ":center_no", 0),         
  
                #add additional troops
                (store_character_level, ":player_level", "trp_player"),
                (store_div, ":player_leveld2", ":player_level", 2),
                (store_mul, ":player_levelx2", ":player_level", 2),
                (try_begin), 
                  (is_between, ":center_no", villages_begin, villages_end),       
                  (store_random_in_range, ":random",0, ":player_level"),
                  (party_add_members, ":center_no", "trp_mercenary_swordsman", ":random"),
                  (store_random_in_range, ":random", 0, ":player_leveld2"),
                  (party_add_members, ":center_no", "trp_mercenary_crossbowman", ":random"),
                (else_try),
                  (party_set_banner_icon, ":center_no", 0),   
                  (party_get_num_companion_stacks, ":num_stacks",":center_no"),
                  (try_for_range, ":i_stack", 0, ":num_stacks"),
                    (party_stack_get_size, ":stack_size",":center_no",":i_stack"),                             
                    (val_div, ":stack_size", 2),
                    (party_stack_get_troop_id, ":troop_id", ":center_no", ":i_stack"),
                    (party_remove_members, ":center_no", ":troop_id", ":stack_size"),
                  (try_end),
                  (store_random_in_range, ":random",":player_leveld2", ":player_levelx2"),
                  (party_add_members, ":center_no", "trp_townsman", ":random"),
                  (store_random_in_range, ":random",0, ":player_level"),
                  (party_add_members, ":center_no", "trp_mercenary_watchman", ":random"),
                (try_end),
              (end_try),     
            (try_end),
            (call_script, "script_change_player_relation_with_center", ":center_no", ":tax_rate"),
          (try_end),
          
          (try_begin), #no taxes for infested villages and towns 
            (party_slot_ge, ":center_no", slot_village_infested_by_bandits, 1),
            (assign,":accumulated_rents", 0),
          (try_end),
          ##diplomacy end


          (party_set_slot, ":center_no", slot_center_accumulated_rents, ":accumulated_rents"),
        (try_end),
        
		(try_begin),
		  (is_between, ":center_no", villages_begin, villages_end),
		  (party_get_slot, ":bound_castle", ":center_no", slot_village_bound_center),
		  (party_slot_ge, ":bound_castle", slot_town_lord, 0), #unassigned centers do not accumulate rents	  
		  (is_between, ":bound_castle", castles_begin, castles_end),
		  (party_get_slot, ":accumulated_rents", ":bound_castle", slot_center_accumulated_rents), #castle's accumulated rents
		  (val_add, ":accumulated_rents", ":cur_rents"), #add village's rent to castle rents
		  (party_set_slot, ":bound_castle", slot_center_accumulated_rents, ":accumulated_rents"),
		(try_end),		
      (try_end),
    ]),
 
OK thanks again. It's been a long time since I did anything even vaguely related to CS. If I'm not mistaken editing the line (assign, ":cur_rents", 1200) by changing 1200 to what ever would change the amount you get pretty easily. So If I made it (assign, ":cur_rents", 4800) I think rents wold be quadrupled for villages, and I could do the same to towns and castles. Is that correct? What I'm still missing is that there should be some check for if the village has been looted since that seems to make the value automatically 0 for a while but I don't see it. Am I just missing it or is there something else. Also I've never done python before what exactly is (try_begin)? Thanks again.
 
I would think that changes to those values, would have that effect. Just give it a try :wink:
Havent played with the looted villages yet, so you will have to either find that yourself (search works rather well with the ms) or wait for the forge to answer that question.

Oh and this isnt python, its taleworlds gibberish :razz:
Check out Caba'drins Module System Syntax. Explains quite a bit. (Link is in his signature)
 
I think I found it in module_scripts.py In the section on village raiding there's these lines

              (call_script, "script_village_set_state",  ":village_no", svs_looted),
              (party_set_slot, ":village_no", slot_center_accumulated_rents, 0), #new 1.126
              (party_set_slot, ":village_no", slot_center_accumulated_tariffs, 0), #new 1.126

Unless I'm mistaken the first one calls a script which sets the village into a looted state but it's actually the next two lines that wipe out the accumulated money. So am I right in thinking that if I comment out those two lines it will not wipe out the money? The problem is that this would leave previous money intact but I'm not sure if the village would make any new money while it was looted. This line from Simple_triggers.py

              (party_slot_eq, ":center_no", slot_village_state, svs_normal),
              (assign, ":cur_rents", 1200),

The last part "svs_normal" does this mean that it will only work if the village state is normal instead of looted? And how could that be modified to make it work either if it was looted or normal?
 
Yup it looks like you wouldnt get any rents even if you comment out the slot_center_accumulated_rents, 0

If you want to keep getting rent you have to additionally comment out the requirement in the village rent code.

插入代码块:
            (try_begin),
              (party_slot_eq, ":center_no", slot_village_state, svs_normal), #Remove this part/comment it out
              (assign, ":cur_rents", 1200),
            (try_end),

Anyways give that a test run and see what happens
 
Thanks again but as I understand this programing language wouldn't commenting it out cause an error since the (try_begin) needs an operation? What about something like changing this:

          (try_begin),
            (party_slot_eq, ":center_no", slot_party_type, spt_village),
            (try_begin),
              (party_slot_eq, ":center_no", slot_village_state, svs_normal),
              (assign, ":cur_rents", 1200),
            (try_end),
          (else_try),
            (party_slot_eq, ":center_no", slot_party_type, spt_castle),
            (assign, ":cur_rents", 1200),
          (else_try), 
            (party_slot_eq, ":center_no", slot_party_type, spt_town),
            (assign, ":cur_rents", 2400),
          (try_end),

to this:

(try_begin),
            (party_slot_eq, ":center_no", slot_party_type, spt_village),
            (assign, ":cur_rents", 1200),
          (else_try),
            (party_slot_eq, ":center_no", slot_party_type, spt_castle),
            (assign, ":cur_rents", 1200),
          (else_try), 
            (party_slot_eq, ":center_no", slot_party_type, spt_town),
            (assign, ":cur_rents", 2400),
          (try_end),

Also as someone really new to modding I had one or two other questions:

1) How do you usually go about testing it? Just start a new game and try to play through the part you modified? I only ask since it takes a little while to get a village and I don't know how long until someone raids it.

2) If I download this Floris code make these changes then compile it I'll basically have made another mod. How can I make something like a sub-mod where it can just be added to an already existing install of Floris?

Thanks again Duh for all the help.
 
Nope it would work. The try begin would become obsolete, but i figured you might want to keep the original code - i.e. better to comment it out rather than completely remove it. Your code would work as well though :wink:.

Also if you compile the code, it will tell you any code related mess ups. So if the syntax is wrong, you will know as soon as you compile.

1)For testing you can turn on the debug mode and use the cheat menu for ... well everything :grin:
As i havent worked too much with fiefs lately, i cant even tell you if there are limitations, but even if there are, it will make your testing a lot smoother.

2) Not sure what you mean. Once you compile the floris source with your code, you have floris with that code. It will stay that way. For later versions, we always release the source code, so you only need to compile that with your code and everythings gonna work again.
 
I didn't even know there was a cheat menu that's great.

What I want is that if someone else wants to use my modifications they can without having to go through all this. For example there are a couple of sub-mods for Floris which change the troop trees. I didn't have to install a new mod to use these I just changed a few files.
 
Hehe i see.

The debug mode can be turned on and off in the camp submenu "Mod Options". You wont only get a cheat menu in the camp menu, but also new options during conversations and in towns/etc.

For others to be able to use your "submod", you need to compile the working code and then upload the according txt files. So if you change scripts.py and simple_triggers.py, you will have to upload the scripts.txt and simple trigger.txt in your Floris folder.
 
Ah thanks you've been a big help. I'm not sure anyone will be interested in what I do but I'd like to give them the option if they're so inclined. I think I've figured out how to do everything I want to do. I'm going to make it so that looted villages only lose 10 prosperity, down from 20, keep there money and still pay half normal rent, I'm also going to increase the rents by about 6 times. I'm also going to increase the mercenary contracts from half the cost of your army to three times the cost. And I guess I'll make the Mill and School a little better, took me forever to find the mill since it's labeled "fish_pond" in the code. My only remaining question is is there a simple way to cap the bank interest at like 4% since if I'm jacking up the money from these things I don't want money to be too easy?
 
Hum i havent looked at the bank code so far... have some bits of it somewhere in a pm, but so far caba has been the one digging through that mess.

It should be in presenations.py, but be warned - from what i have heard its ... quite special (in the way it was written) :lol: expect to be confused and annoyed.
 
Man this stuff ain't easy. I made some changes, looked like everything was good. I got a fief and when the time came to display the money it was much higher than normal, also good, but then no money actually showed up to my character. The troop payment screen lists me as getting paid thousands but nothing shows up. Does this look right? The numbers showed up correctly in one place but than never made it to my wallet.
插入代码块:
            (try_begin),
            (party_slot_eq, ":center_no", slot_party_type, spt_village),
            (try_begin),
              (party_slot_eq, ":center_no", slot_village_state, svs_normal),
              (assign, ":cur_rents", 7200),
            (else_try),
              (party_slot_eq, ":center_no", slot_village_state, svs_looted),
	      (assign, ":cur_rents", 3600),
            (try_end),    
          (else_try),
            (party_slot_eq, ":center_no", slot_party_type, spt_castle),
            (assign, ":cur_rents", 7200),
          (else_try),  
            (party_slot_eq, ":center_no", slot_party_type, spt_town),
            (assign, ":cur_rents", 14400),
          (try_end),
 
Mhm have have you taken a look at the actual presentation? (If so could you copy paste it here?)
插入代码块:
		#Enterprise ends, taxes begin
        (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
        (party_get_slot, ":accumulated_rents", ":center_no", slot_center_accumulated_rents),
        (party_get_slot, ":accumulated_tariffs", ":center_no", slot_center_accumulated_tariffs),
		
        (store_add, ":accumulated_total", ":accumulated_rents", ":accumulated_tariffs"),
        (val_add, ":all_centers_accumulated_total", ":accumulated_total"),
        (val_add, ":all_centers_accumulated_taxes_and_rents", ":accumulated_total"),
        (val_add, ":net_change", ":accumulated_total"),
        (str_store_party_name, s0, ":center_no"),
Oddity odd... it should work. Gonna have a closer look.


PS: Unrelated to the above issue, but you will have to change this as well

插入代码块:
          (try_begin), #no taxes for infested villages and towns 
            (party_slot_ge, ":center_no", slot_village_infested_by_bandits, 1),
            (assign,":accumulated_rents", 0),
          (try_end),
          ##diplomacy end

_______________________________________________________________

Mhm i forgot that caba n me added a new tax/tribute for kings, which their nobles pay them.
We added the code in presentations and we included the code from simple triggers (well could have been there natively as caba pasted our code in there, so im not 100% certain). It might be that they are conflicting. Try adjusting the code in presentations.py, so that it looks like your code in simple triggers.

Here you go:

插入代码块:
	  #FLORIS BEGIN
      (try_begin),
        (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
        (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
        (assign, ":rents_from_vassals", 0),
        (try_for_range, ":center_no", centers_begin, centers_end),
            (party_slot_eq, ":center_no", slot_village_infested_by_bandits, 0), #Isn't infested
            (party_slot_ge, ":center_no", slot_town_lord, 1), #unassigned centers do not accumulate rents ; changed to 1, excludes player since the player is troop 0   
            (party_get_slot, ":lord", ":center_no", slot_town_lord),
            (store_troop_faction, ":faction", ":lord"),
            (eq, ":faction", "fac_player_supporters_faction"),

            (assign, ":cur_rents", 0),
            (try_begin),
                (party_slot_eq, ":center_no", slot_party_type, spt_village),
                (party_slot_eq, ":center_no", slot_village_state, svs_normal),
                (assign, ":cur_rents", 1200),
            (else_try),
                (party_slot_eq, ":center_no", slot_party_type, spt_castle),
                (assign, ":cur_rents", 1200),
            (else_try),
                (party_slot_eq, ":center_no", slot_party_type, spt_town),
                (assign, ":cur_rents", 2400),
            (try_end),
           
            (party_get_slot, ":prosperity", ":center_no", slot_town_prosperity), #prosperty changes between 0..100     
            (store_add, ":multiplier", 20, ":prosperity"), #multiplier changes between 20..120
            (val_mul, ":cur_rents", ":multiplier"),
            (val_div, ":cur_rents", 120),#Prosperity of 100 gives the default values
                         
            (game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
            (try_begin),
                (eq, ":reduce_campaign_ai", 0), #hard (less money from rents)
                (val_mul, ":cur_rents", 3),
                (val_div, ":cur_rents", 4),
            (else_try),
                (eq, ":reduce_campaign_ai", 1), #medium (normal money from rents)
                #same
            (else_try),
                (eq, ":reduce_campaign_ai", 2), #easy (more money from rents)
                (val_mul, ":cur_rents", 4),
                (val_div, ":cur_rents", 3),
            (try_end),       

            (assign, ":base_rent", ":cur_rents"),       
                       
              ##Floris + diplomacy begin
            (try_begin),           
                (party_get_slot, ":tax_rate", ":center_no", dplmc_slot_center_taxation),
                (neq, ":tax_rate", 0),
                (store_div, ":rent_change", ":base_rent", 100),
                (val_mul, ":rent_change", ":tax_rate"),
                (val_add, ":cur_rents", ":rent_change"),
            (try_end),
            (try_begin),
                (faction_get_slot, ":aristocracy", "fac_player_supporters_faction", dplmc_slot_faction_aristocracy),
                (neq, ":aristocracy", 0),
                (val_mul, ":aristocracy", 5), #10
                (store_div, ":rent_change", ":base_rent", 100),
                (val_mul, ":rent_change", ":aristocracy"),
                (val_add, ":cur_rents", ":rent_change"),
            (try_end),
            (try_begin),
                (faction_get_slot, ":centralization", "fac_player_supporters_faction", dplmc_slot_faction_centralization),
                (neq, ":centralization", 0),
                (val_mul, ":centralization", 10), #20
                (store_div, ":rent_change", ":base_rent", 100),
                (val_mul, ":rent_change", ":centralization"),
                (val_add, ":cur_rents", ":rent_change"),
            (try_end),
            (try_begin),
                (faction_get_slot, ":serfdom", "fac_player_supporters_faction", dplmc_slot_faction_serfdom),
                (neq, ":serfdom", 0),
                (val_mul, ":serfdom", 2), #5
                (store_div, ":rent_change", ":base_rent", 100),
                (val_mul, ":rent_change", ":serfdom"),
                (val_add, ":cur_rents", ":rent_change"),
            (try_end),       
              ##Floris + diplomacy end
             
            (val_div, ":cur_rents", 5), #Only collect 20% of the above adjusted income
            (val_div, ":base_rent", 2), #Max Rent 50% of the Lord's take
            (val_clamp, ":cur_rents", 0, ":base_rent"),
            (val_add, ":rents_from_vassals", ":cur_rents"),
        (try_end), #Center Loop 
        (create_text_overlay, reg1, "@Tributes from your nobles:", 0), ##Report for new Taxes from Vassals/Floris
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 25),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (try_begin),           
            (gt, ":rents_from_vassals", 0),
            (val_add, ":net_change", ":rents_from_vassals"),
            (assign, reg0, ":rents_from_vassals"),
            (create_text_overlay, reg1, "str_reg0", tf_right_align|tf_single_line),
            (overlay_set_color, reg1, 0x00AA00),
        (else_try),
            (create_text_overlay, reg1, "str_none", tf_right_align|tf_single_line),
        (try_end),
        (position_set_x, pos1, 900),
        (position_set_y, pos1, 900),
        (overlay_set_size, reg1, pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg1, pos1),
        (val_sub, ":cur_y", 27),
      (try_end),   
      #FLORIS END	 

@Caba'drin - are both codes necessary? Completely forgot about this, heh.
 
I tried changing it in presentations.py but it didn't make any difference. What's odd is I'm getting no money. I'm not getting the rent at the old rate or any rate at all just nothing.
 
You are looking at your treasury right? Not your inventory?

I think as soon as you hold a fief, you get a chamberlain, who hangs around in your village (or other fief).
 
后退
顶部 底部