Modding VC: basic tutorials and Q&A thread

Currently viewing this thread:

Blooorp

Recruit
Code:
(store_random_in_range, ":test_lair", 0, 8),
I was trying to have the lair's volunteers update every 3 days more or less. So as the code runs every 8 hours I added a check that would succeed approximately once every 9 tries.

Code:
(call_script, "script_update_npc_volunteer_troops_in_village", "p_yourlair"),

(call_script, "script_update_volunteer_troops_in_village", ":p_yourlair"),
Oops, just noticed the ":p_yourlair", that's not what it was meant to be haha, was meant to be "p_yourlair" instead of the random village from the VC code.

Edit : fixed ":p_yourlair" with "p_yourlair" but still doesn't work.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
random doesnt work like that, in special with Warband system that is not quite random. Put your code on a 3 days trigger instead (24*3)

study both scripts as you are missing the point of what they do. One of them will not do anything on your case. The other you will need to examine your flags for your lair and see if it is setup for that.

after you fixed those issues we can see the others.
 

Blooorp

Recruit
Looks like "update_npc_volunteer_troops_in_village" is only for NPCs so yeah quite useless for me, thanks x)
Tho "update_volunteer_troops_in_village" is pretty long and complicated, having a hard time finding out if it's this script that doesn't like to give troops to the refuge.

Most of the flags are not really explained in the header_parties.py, I guess that maybe removing "pf_disabled" or adding "pf_village" could help?
Code:
("yourlair","My Refuge",icon_camp_refuge|pf_disabled|pf_is_static|pf_always_visible|pf_label_medium, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1, 1),[]),
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Blooorp said:
Most of the flags are not really explained in the header_parties.py, I guess that maybe removing "pf_disabled" or adding "pf_village" could help?

not necessary as it is already done by the game when you create or destroy your lair (that is what it means by enable=created and disabled=destroyed)

otherwise the lair would be displayed in the map like a town whatever you have paid for it or not
 

Blooorp

Recruit
Updated the code to update the recruits
Code:
	# lair recruits update
	(72,
	  [
		(call_script, "script_update_volunteer_troops_in_village", "p_yourlair"),
    ]),

Also tried to add the "pf_village" flag to the lair without improvement so ended up copying a village, changing the essential parts to what it is on the lair and still nothing.
Code:
      # Original lair line
      ("yourlair","My Refuge",icon_camp_refuge|pf_disabled|pf_is_static|pf_always_visible|pf_label_medium, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1, 1),[]),
      # Same with "pf_village" added to the flags
      ("yourlair","My Refuge",icon_camp_refuge|pf_disabled|pf_is_static|pf_always_visible|pf_label_medium|pf_village, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1, 1),[]),
      # Last try, copied a village line, changed ID, name, added "pf_disabled", changed faction from neutral to player supporters faction and changed the coordinates.
      ("yourlair","My Refuge",  icon_camp_refuge|pf_disabled|pf_village, no_menu, pt_none, fac_player_supporters_faction,0,ai_bhvr_hold,0,(1,1),[]),
 

kalarhan

Python Saint
Count
WBNWVCWF&S
study the village script and check if the lair already has all the flags. Flags are not a reference to the values configured on module_parties.py, but the slots done with scripts.
 

Blooorp

Recruit
Took me a while but finally managed to view the value of slots x)
I checked the lair slots and it had no culture, so I added two lines to the lair creation menu :
Code:
          (faction_get_slot, ":lair_culture", "fac_player_faction", slot_faction_culture),
          (party_set_slot, "p_yourlair", slot_center_culture, ":lair_culture"),
Code:
  ("build_refuge_new",0,
    "Your men await your orders to start building the refuge. There is enough material collected so far, and what may be missing can be purchased in nearby villages.^^" +
    "Total Cost: 1000 peningas.^" +
    "Time need: 6 hours.",
    "none",
    [(set_background_mesh, "mesh_pic_camp"),
    ],
    [
      ("refuge_here",[(eq, "$lair_on", 0),],"So order.",
        [
          (str_clear,s1),
          
          (troop_remove_gold, "trp_player", 1000),
          (party_relocate_near_party, "p_yourlair", "p_main_party"),
          (call_script, "script_give_center_to_lord", "p_yourlair", "trp_player", 0),
          #(party_set_slot, "p_yourlair", slot_party_type, spt_castle),
          (faction_get_slot, ":lair_culture", "fac_player_faction", slot_faction_culture),
          (party_set_slot, "p_yourlair", slot_center_culture, ":lair_culture"),
          (enable_party, "p_yourlair"),
          (display_message, "@After you buy the materials, your men build a permanent shelter for you."),
          (assign, "$lair_on", 1),
          (party_set_slot, "$g_encountered_party", slot_lair_improve, 0),
          #personal
          (assign, "$captain_ok", hire_captainno),
          (assign, "$hire_priest1", hire_priest3),
          (assign, "$bard_type", hire_bard3),
          (assign, "$hire_tavernkeeper1", hire_tavernkeeper2),
          (assign, "$hire_whore1", hire_whore5),
          (assign, "$hire_trainer1", hire_trainer2),
          (assign, "$hire_barber1", hire_barber5),
          (assign, "$hire_smith1", hire_smith2),
          (assign, "$hire_armorer1", hire_armorer2),
          (assign, "$hire_cook1", hire_cook2),
          ###no hired
          (assign, "$captain_hired_on", 0), # no contratado chief, hired
          (assign, "$priest_hired_on", 0), #contratado chief, hired
          (assign, "$bard_hired_on", 0), # no contratado chief, hired
          (assign, "$tavernkeeper_hired_on", 0), # no contratado chief, hired
          (assign, "$whore_hired_on", 0), #contratado chief, hired
          (assign, "$trainer_hired_on", 0), #contratado chief, hired
          
          (assign, "$smith_hired_on", 0), #contratado chief, hired
          (assign, "$armorer_hired_on", 0), #contratado chief, hired
          (assign, "$barber_hired_on", 0), #contratado chief, hired
          (assign, "$cook_hired_on", 0), #contratado chief, hired
          ###
          
          #tiempo de construccion
          (assign,"$g_presentations_next_presentation",-1),
          (presentation_set_duration,0),
          (assign,"$g_camp_mode", 1),
          (assign, "$g_infinite_camping", 0),
          (assign, "$g_player_icon_state", pis_camping),
          
          (rest_for_hours, 6, 5, 1), #rest while no attackable
          (assign,"$temp",6), #Obliga descanso al salir
          (change_screen_return),
          ##
          ##                 (leave_encounter),
          ##                 #(change_screen_map),
          ##		 (jump_to_menu, "mnu_auto_return_to_map"),#phaiak
        ]
      ),
      
      ("resume_travelling",[],"Back.",
        [
          (change_screen_return),
        ]
      ),
    ]
  ),

And now it works !
Thanks kalarhan for hinting me towards the right direction, I was thinking about a lot of things but not that x)
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Modding is all about the details. Check the tutorial on logging if you try another feature In tHe future, it makes it easy to test values and find mistakes.

Happy modding
 
Has anyone figured out exactly how the religion ratios works? I'm trying to make the lords convert less considering the short time frame and this is what I could find in the files.

#gente cristiana
      (try_for_range, ":center_no", centers_begin, centers_end),
        (try_begin),
          (neg|party_slot_eq, ":center_no", slot_center_religion, 2), #skip villages which are pagan.
          (party_set_slot,":center_no",slot_center_religion, 1), #el resto son cristianos
          (store_random_in_range, ":rand", 51, 90), #valores de fe 1: Is this the faith values for Christian centers and villages, meaning christianity should be between 51-90%?
          (party_set_slot, ":center_no", slot_center_faithratio, ":rand"),
        (else_try),
          (party_slot_eq, ":center_no", slot_center_religion, 2), #anade fe a las villas paganas
          (store_random_in_range, ":rand", 5, 40), # ratio is christian/pagan 2: Question 1 suddenly makes less sense to me, so here the pagan areas have between 5-40% of what? Christianity?
          (party_set_slot, ":center_no", slot_center_faithratio, ":rand"),
        (try_end),
      (try_end),
      ## setup Friese, Denmark
      (store_random_in_range, ":rand", 50, 60), #valores de fe 3: Which faith is being referred to here? Would it be correct to assume Christianity as this is Dorestad?
      (party_set_slot, "p_town_11", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 45, 60), #valores de fe
      (party_set_slot, "p_castle_63", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 45, 60), #valores de fe
      (party_set_slot, "p_castle_64", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 10), #valores de fe
      (party_set_slot, "p_town_4", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 15), #valores de fe 4: This refers to the town below, which is Tunsberg. So, if I want to reduce the chance of the Norwegian king converting to Christianity, just set the values to 0 or comment it out and it will be 100% pagan due to the earlier line "(party_set_slot,"p_town_5",slot_center_religion, 2),"
      (party_set_slot, "p_town_5", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 15), #valores de fe
      (party_set_slot, "p_castle_50", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 15), #valores de fe
      (party_set_slot, "p_castle_56", slot_center_faithratio, ":rand"),
      ## end Friese
 

AfLIcTeD

Sergeant at Arms
King Yngvar said:
Has anyone figured out exactly how the religion ratios works? I'm trying to make the lords convert less considering the short time frame and this is what I could find in the files.

#gente cristiana
      (try_for_range, ":center_no", centers_begin, centers_end),
        (try_begin),
          (neg|party_slot_eq, ":center_no", slot_center_religion, 2), #skip villages which are pagan.
          (party_set_slot,":center_no",slot_center_religion, 1), #el resto son cristianos
          (store_random_in_range, ":rand", 51, 90), #valores de fe 1: Is this the faith values for Christian centers and villages, meaning christianity should be between 51-90%?
          (party_set_slot, ":center_no", slot_center_faithratio, ":rand"),
        (else_try),
          (party_slot_eq, ":center_no", slot_center_religion, 2), #anade fe a las villas paganas
          (store_random_in_range, ":rand", 5, 40), # ratio is christian/pagan 2: Question 1 suddenly makes less sense to me, so here the pagan areas have between 5-40% of what? Christianity?
          (party_set_slot, ":center_no", slot_center_faithratio, ":rand"),
        (try_end),
      (try_end),
      ## setup Friese, Denmark
      (store_random_in_range, ":rand", 50, 60), #valores de fe 3: Which faith is being referred to here? Would it be correct to assume Christianity as this is Dorestad?
      (party_set_slot, "p_town_11", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 45, 60), #valores de fe
      (party_set_slot, "p_castle_63", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 45, 60), #valores de fe
      (party_set_slot, "p_castle_64", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 10), #valores de fe
      (party_set_slot, "p_town_4", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 15), #valores de fe 4: This refers to the town below, which is Tunsberg. So, if I want to reduce the chance of the Norwegian king converting to Christianity, just set the values to 0 or comment it out and it will be 100% pagan due to the earlier line "(party_set_slot,"p_town_5",slot_center_religion, 2),"
      (party_set_slot, "p_town_5", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 15), #valores de fe
      (party_set_slot, "p_castle_50", slot_center_faithratio, ":rand"),
      (store_random_in_range, ":rand", 5, 15), #valores de fe
      (party_set_slot, "p_castle_56", slot_center_faithratio, ":rand"),
      ## end Friese
I believe this is the wrong section, this just sets up fief religions at the beginning of the game. Doesn't affect Lord  conversion rates.

What you want is in simple triggers.
Look for "Active NPCs weekly ON AVERAGE". Scroll down to conversion chances.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
VC Dev on how to use the ferry system

Phaiak said:
Let me elaborate a bit further on the "on-rails travel" on rt_bridge: it is just a "bait" for the AI. As soon as they touch the bait (rt_bridge) they will be transformed into a party that can perform free travel on the sea. So the AI expects it to be a "on-rails travel" as long as they are on land, but as soon as they are on water, nobody will use the rails. The rails are a illusion.

The problem is that the party that takes the player captive does not adhere to the rails, but rather goes all over the place at it pleases them (it?) even on terrain that should be unpassable.
passable terrains for a party with the pf_is_ship flag are: rt_water, rt_river and rt_bridge
The party that takes the player captive does not need rt_bridge at all. rt_bridge is only the bait to get the land AI parties in the water.

on the flag "pf_is_ship": it is used on module_parties.py and module_party_templates.py on the definition of a party (think a party created to use ships like a fisher or trader)
-> it can also be used on a dynamic way, or as a ON/OFF switch, by using this operation
Code:
(party_set_flags, "p_transporter", pf_is_ship, 1),
--> the party "transporter" has the flag as ON (value=1). You can set it to OFF (value=0). This is used for example on the player party as you alternate between land and sea travel.
 
AfLIcTeD said:
I believe this is the wrong section, this just sets up fief religions at the beginning of the game. Doesn't affect Lord  conversion rates.

What you want is in simple triggers.
Look for "Active NPCs weekly ON AVERAGE". Scroll down to conversion chances.

Thanks, I found it.
        # Clearing conversion fails
        (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
        (try_begin),
          (troop_slot_eq, ":troop_no", slot_troop_conv, 1),
          (troop_set_slot, ":troop_no", slot_troop_conv, 0),
         
          # Player's converts
        (else_try),
          (troop_slot_eq, ":troop_no", slot_troop_conv, 2),
          (try_begin),
            (eq, ":religion", 1),
            (troop_set_slot, ":troop_no", slot_troop_religion, 2),
          (else_try),
            (troop_set_slot, ":troop_no", slot_troop_religion, 1),
          (try_end),
          (val_add, ":controversy", 5),
          (troop_set_slot, ":troop_no", slot_troop_controversy, ":controversy"),
          (troop_set_slot, ":troop_no", slot_troop_conv, 0),
         
          # Random conversion
        (else_try),
          (assign, ":chance", 1),
         
          #lord will convert to religion favored by faction/lords 3x faster, so on average only 1/3 faction will be a different religion
          #faction religion
          (try_begin),
            (eq, ":religion", 1),
            (faction_slot_eq, ":faction", slot_faction_religion, cb3_pagan),
            (val_add, ":chance", 1),
          (else_try),
            (eq, ":religion", 2),
            (faction_slot_eq, ":faction", slot_faction_religion, cb3_christian),
            (val_add, ":chance", 1),
          (try_end),
         
          #don't convert to the "wrong" religion if already in too much trouble
          (this_or_next|gt, ":chance", 1),
          (lt, ":controversy", 40),
         
          #lords' religion
          (assign, ":rel_comp", 0),
          (try_for_range, ":active_npc", active_npcs_begin, active_npcs_end),
            (troop_slot_eq, ":active_npc", slot_troop_occupation, slto_kingdom_hero),
            (store_faction_of_troop, ":npc_faction", ":active_npc"),
            (eq, ":npc_faction", ":faction"),
            (neq, ":active_npc", ":troop_no"),
            (troop_get_slot, ":religion1",":active_npc", slot_troop_religion),
            (try_begin),
              (eq, ":religion1", ":religion"),
              (val_add, ":rel_comp", -1),
            (else_try),
              (val_add, ":rel_comp", 1),
            (try_end),
          (try_end),
          # (assign, reg33, ":rel_comp"),
          # (display_message, "@{reg33} more lords with a different religion"),
          (try_begin),
            (gt, ":rel_comp", 0),
            (val_add, ":chance", 1),
          (try_end),
         
          #lord personalities
          (try_begin),
            (this_or_next|troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_cunning),
            (troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_debauched),
            (val_add, ":chance", 2),
          (else_try),
            (this_or_next|troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_roguish),
            (troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_quarrelsome),
            (val_add, ":chance", 1),
          (try_end),
          # (assign, reg32, ":chance"),
          # (str_store_troop_name, s31, ":troop_no"),
          # (display_message, "@{s31} has a {reg32} chance of conversion"),
         
          (store_random_in_range, ":conv", 0, 150), #lord will convert on average n = log(.5)/log(1.00 - 1/150) = 103 weeks = 2 years
          # (assign, reg33, ":conv"),
          # (display_message, "@Random is {reg33}"),
          (lt, ":conv", ":chance"),
          (try_begin),
            (eq, ":religion", 1),
            (troop_set_slot, ":troop_no", slot_troop_religion, 2),
          (else_try),
            (troop_set_slot, ":troop_no", slot_troop_religion, 1),
          (try_end),
          (val_add, ":controversy", 5),
          (troop_set_slot, ":troop_no", slot_troop_controversy, ":controversy"),
        (try_end),
        # End conversion

I'm not really sure what all these numbers are and how to limit the conversion so I'm simply going to try to remove everything after "random conversion", I guess I should keep in the last (try_end) for player's converts.

Edit: It should be working, no new types of CTDS discovered, haven't noticed any pagans go Christian but I only tested 200 days.
 

AfLIcTeD

Sergeant at Arms
I'm trying to make it so any uncollected rents for AI lords will be automatically collected at the end of the week. Just like the player.
If I add this code in to "calculate_weekly_net_income_and_add_to_wealth" section in scripts, would it work?

Code:
(try_for_range, ":center_no", centers_begin, centers_end),
        (party_slot_eq, ":center_no", slot_town_lord, ":troop_no"),
        
        (party_get_slot, ":accumulated_rents", ":center_no", slot_center_accumulated_rents),
        (party_get_slot, ":accumulated_tariffs", ":center_no", slot_center_accumulated_tariffs),        
        (val_add, ":weekly_income", ":accumulated_rents"),
        (val_add, ":weekly_income", ":accumulated_tariffs"),        
        
        (party_set_slot, ":center_no", slot_center_accumulated_rents, 0),
        (party_set_slot, ":center_no", slot_center_accumulated_tariffs, 0),
	  (try_end),

EDIT. So I added it and it seems to be working, so I guess I have my answer.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
this change conflicts with "troop_does_business_in_center", as the idea is that lords need to visit their centers to get the cash (it is not automatic), recruit troops while doing it, etc.

Not a big deal, but the debug message (with cheat on) wont work, and you should keep a eye on the economy (lord wealth over time). Volunteers are free for NPCs anyway.

performance wise is not a good change, but the impact will be too small for you to notice it.
 

AfLIcTeD

Sergeant at Arms
kalarhan said:
this change conflicts with "troop_does_business_in_center", as the idea is that lords need to visit their centers to get the cash (it is not automatic), recruit troops while doing it, etc.

Not a big deal, but the debug message (with cheat on) wont work, and you should keep a eye on the economy (lord wealth over time). Volunteers are free for NPCs anyway.

performance wise is not a good change, but the impact will be too small for you to notice it.

The main reason I wanted it was to make it so lords with alot of feifs won't be poor all the time. Once they start to get alot of fiefs they can't collect the rents fast enough to maintain all of their troops and garrisons. So alot of the time they get stuck in loops of losing troops as they can't afford them, so they try to recruit more as they don't have enough, to then lose them again. so on.

I have been using it a while now and there isn't really that much difference, lords will still visit their fiefs to collect rents if they need them,
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Viking-AllFather said:
My question is how to enable death for Lords-Kings ?
I need it because its more RP.

it is the same as Warband, so you will need to study the game code and implement a few changes on how things work. I recommend you visit the Forge if you need help with the basics, as they have all the tutorials there.

short answer: move the troops to a non-kingdom faction and update their notes. How you handle the rest (like balance) is up to your own rules.

edit: sandbox only. For storyline you would need to review what happens with each quest to prevent breaking the game.
 

Ujwarius

Recruit
kalarhan said:
Viking-AllFather said:
My question is how to enable death for Lords-Kings ?
I need it because its more RP.

it is the same as Warband, so you will need to study the game code and implement a few changes on how things work. I recommend you visit the Forge if you need help with the basics, as they have all the tutorials there.

short answer: move the troops to a non-kingdom faction and update their notes. How you handle the rest (like balance) is up to your own rules.

edit: sandbox only. For storyline you would need to review what happens with each quest to prevent breaking the game.

Can you be so kind to explain me over PM,i dont know what should i open to do it.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Viking-AllFather said:
Can you be so kind to explain me over PM,i dont know what should i open to do it.

unfortunately it is not a simple thingy, so you would need to learn how to do it yourself, as there is no ready-to-copy tutorial available for this feature. Modding is like this, you can do pretty much anything you want to, but that requires some time invested learning the how-to.

if you decide to try you can always visit the Forge Q&A thread to post questions as you find issues/problems. People will help you with little things, but it is not likely that they will do the entire thingy for you.
 
Hey,

So I've been trying to get Swyters Cartographer to work with VC, I have the newest version. I direct it to the right path, the modsys folder but it never works. Is it due to differences in code compared to MB native and if so, is there any way to "fix it"?

Many thanks
 
Top Bottom