SP Tutorial Module System Recruit your custom troops in your own Kingdom

Currently Viewing (Users: 0, Guests: 1)

Vatarr

Recruit
WBWF&S
Best answers
0
The code provided does infact work in 1.143, just make sure when you create your unit it is under the player support faction and not the player faction!
 

Lord Dimitri

Regular
Best answers
0
In my module system (vesion 1.143) i only erase this:

"center_no" and my module system has no problems but i don`t test it
 

Michiko

Knight
WB
Best answers
0
This works for me. I edited it a bit so that it's a random chance to get either the original faction's troops or your kingdom's troops. I don't want the original faction's troops to disappear forever if you dominate their faction. Here's the code for it. Put it where the OP said, which is actually inside the section ("update_volunteer_troops_in_village",
Code:
# For player kingdom troops.
         (store_faction_of_party, ":center_faction", ":center_no"),
         (store_random_in_range, ":random_no", 0, 2),
            (try_begin),
               (gt, ":random_no", 0),
               (try_begin),
                  (is_between, ":center_faction", "fac_kingdom_1", "fac_kingdoms_end"),
                  (faction_get_slot, ":volunteer_troop", ":center_faction", slot_faction_tier_1_troop),
               (try_end),
            (else_try),
               (eq, ":random_no", 0),
               (try_begin),
                  (eq, ":center_faction", "fac_player_supporters_faction"),
                  (assign, ":volunteer_troop", "trp_YOUR_CUSTOM_TROOP_HERE"),
               (try_end),
            (try_end),
            
         # End.
This setting gives you a 33% chance to recruit your new kingdom troops. If you want to change the odds, change the random values. The way it's set up now is that if the :random_no (will come up as 0, 1 or 2) turns out to be 0, that's when the village will give you your new kingdom troops.
 

Delzaros

Sergeant
WBNW
Best answers
0
Is is possible to make a second version of "slot_faction_tier_1_troop"?
So that the lords always take the native troops and the player always recruit another sort from the different kingdom villages? (While being no king yourself.)
I'm working on a mod and if its possible it basicly will sort my current issue.
 

GunFred

Squire
Best answers
0
Watchtower said:
Hi
Is there possible to make own culture in MB 1.154 (with diplomacy mod)?
Yes it is but my way is not perfect even though I think my issues are rather easy to fix. I would not mind explaing how to make a custom culture available for player kingdom if you want me to but you must use the diplomacy Module System incase you did not know that.
 

bowlie

Veteran
Best answers
0
Has anyone got this to work with the latest warband? 1.53 or something? im using that and this just isnt working. No error messages, but its not giving me  new recruits. Im using the module / python system
 

GunFred

Squire
Best answers
0
When I tried this guide I only managed to enable custom troop tree for myself but my lords and companions refused to recruit my custom units. But if you use the Diplomacy mod then you can just add a new "ghost" faction which culture and troop tree you then take over when you become a King and you and your lords will recruit your new troops.
 

LOLLord Ben

Recruit
Best answers
0
Yeah I know this thread is sleeping, but I update my code for Warband to allow recruiting of one single type of unit for your kingdom AND the "standard" kingdoms - it allows you to get a specific troop GUARANTEED, now it is fixed to also do that when you have your own kingdom.

Code:
	 # MOD begin
       (store_faction_of_party, ":center_faction", ":center_no"),
       (try_begin),
         (is_between, ":center_faction", "fac_kingdom_1", "fac_kingdoms_end"),
         (faction_get_slot, ":volunteer_troop", ":center_faction", slot_faction_tier_1_troop),
         (assign, ":volunteer_troop", "XXX"),
	(else_try),
         (eq, ":center_faction", "fac_player_supporters_faction"),
         (assign, ":volunteer_troop", "XXX"),
       (try_end),       
	 # MOD end
Just replace XXX with your type.


Now if you want to have a certain chance to recruit DIFFERENT types of units, use this:
Code:
	 # MOD begin
       (store_faction_of_party, ":center_faction", ":center_no"),
       (try_begin),
         (is_between, ":center_faction", "fac_kingdom_1", "fac_kingdoms_end"),
         (faction_get_slot, ":volunteer_troop", ":center_faction", slot_faction_tier_1_troop),
	(store_random_in_range, ":trptpmodifier", 0, 4),
	(try_begin),
	(eq, ":trptpmodifier", 0),
	(assign, ":volunteer_troop_tier", 1),
	(else_try),
	(eq, ":trptpmodifier", 1),
	(assign, ":volunteer_troop_tier", 1),
	(else_try),
	(eq, ":trptpmodifier", 2),
	(assign, ":volunteer_troop_tier", 1),
	(else_try),
	(eq, ":trptpmodifier", 3),
         (assign, ":volunteer_troop", "XXX1"),
	(else_try),
	(eq, ":trptpmodifier", 4),
         (assign, ":volunteer_troop", "XXX2"),
	(try_end),
	(else_try),
         (eq, ":center_faction", "fac_player_supporters_faction"),
         (assign, ":volunteer_troop", "XXX3"),
       (try_end),       
	 # MOD end
It checks a random number on script update, picks a choice from the list 0-4, and if the number is 3 or 4, it picks a different troop type then the standard "tier 1 troop", troops XXX1 and XXX2 -> replace those with the troop types you want to have a chance to get.

You can add more "tries" and "equals" with more numbers by changing (store_random_in_range, ":trptpmodifier", 0, XYZ), where you can change XYZ to like 100.

Then you'd have to add 100 lines of (tries) and equals, and the chances are gonna be baaaad, there already is a low chance to get a different troop -> about every 6.th village will hold troops XXX1 or XXX2.

If you have your own kingdom, on the other hand, you always get the troop you want, remove that checkline to make the script pick the first section.
 

ForfiterX

Regular
Best answers
0
@LOLLord Ben
Do you have scripts.txt for this?
I don't want the module way but i really want the .txt way.
Thanks.

@EDIT
Ok never mind i got a way to work it out using .txt
 

LOLLord Ben

Recruit
Best answers
0
ForfiterX said:
[...]
Ok never mind i got a way to work it out using .txt
Cool :smile:  Yeah sorry I am too busy working on many things.

@Sinister
I might know a solution to make this work for Lords, it only needs additions on the "npc recruit from villages" script part, its directly under the part we are looking at. But it may require some recoding to only allow playerfaction to recruit, and not everybody. I havent tried that, since it can really mess up everybodies armies if not coded correctly.
Meaning, the wrong people recruit the player-only units, or custom troops or whatever.
 

XxXxVxXxX

Recruit
Best answers
0
I know this is a really old topic, but whenever I try to recruit my own troops, it says "# The populace is indifferent to you volunteer to join you"
It also gives me the script error:

SCRIPT ERROR ON OPCODE: 2324: Invalid Troop ID: 930; LINE NO: 22:
At Game menu menu_recruit_volunteers.
At Game menu menu_recruit_volunteers.
At Game menu menu_recruit_volunteers.

Whats really frustrating is that I've actually got this to work once, I even added 6 more troops ...
But when I tried to add the custom troops to the diplomacy mod in another module, it started giving me this error.
Now even in Native I still get this script error.
I've even tried the same steps on a backup I created, but I'm still getting this same error ...

Does anyone have any suggestions or ideas on how to fix this?
Thanks!
 

epicboy12332

Veteran
WB
Best answers
0
Isn't there any way to make it so that you don' have to wait for a few in game days when you recruit from village? I don't I want to wait 3 days to recruit my own faction troops.
 

Zarax

Recruit
Best answers
0
Hi, sorry for resurrecting this topic.
I tried to replace 360287970189640610 with 360287970189640025 in order to get village farmers but it appears units are not linear.
Any idea which ID should I use to get village farmers?

Thanks!
 

Ryantheskinny

Sergeant at Arms
Best answers
0
Resurrecting this to try and get help adding something like this to VC want to be able to recruit faction culture troops in castles/cities and leave villages as is. Any help would be appreciated and I am trying to use the python source code to do this.

Tried adding a code I found in the VC subthread for mods but it didn't work.

The code:

try_for_range, ":center_no", centers_begin, centers_end),
(store_faction_of_party, ":party_faction", ":center_no"),
(faction_get_slot, ":faction_culture", ":party_faction", slot_faction_culture),
(party_set_slot, ":center_no", slot_center_culture, ":faction_culture"),

Am I supposed to put this in scripts.py?