Recruiting Troops From Owner's Faction

Users who are viewing this thread

See now I can copy, cut, and, paste numbers that the Magelord provided. But everything you just said lost me. xD Perhaps I should wait awhile for you guys (that know what you are doing) to smooth things out and get it all figured.
 
Basically, what you want to do is make your own kingdom, but have Swadian troops, is that right?

Edit: Replacing player_faction with player_supporters_faction slaps me around the head for being a fool. Entering a village overloads the log with every single lord that doesn't hate me. Apparently, player_supporters is anyone who won't try to engage me in combat on sight.
 
Atamawood said:
Yes that best describes what I want haha.

Won't he still run into Morale problems if he ever goes to war with the 'real' Swadians?  I too am waiting on the finished product (tho I would also need a balanced troop tree that would show up once I got my own fief (the fief I get when I first join a faction would be sweet)).
 
Atamawood said:
Morale problems are always real easy to fix with a few minor changes in script.txt  :wink:

"face-palm"  duh, you're right.  And I've even tweaked my own (using TweakMB), so I shoulda known.  Tho it doesn't deal with the morale loss from using same troops as the enemy, so that's probably why it didn't occur to me.  And 'that' morale loss is driving me bonkers in my current game.  I was a Vaegir Lord, most of my troops were Vaegir, I go indepedent and a couple months later on, Vaegir declares war on me.  So there I was, up a creek - without a paddle.  lol

<off to find the tweak to remove that particular irritant>
 
I have no idea if a tweak exists to remove that morale tweak. Speaking of which, does it only appear in Warband? I don't remember having any problems in pre-Warband.

Also, my problem's still up in the air for any experienced coders looking to help a newbie. =D
 
I wonder if I'm allowed to bump after a day... Ah well. Back to the front page you go.

To recap, I'm trying to allow players to recruit from villagers depending on the faction the village belongs to. If it belongs to the player and the player doesn't have any troops in his/her faction, it'll recruit volunteers from the village's original faction. If the player has custom troops belonging to his/her faction, it recruits those custom troops.

I'm pretty sure Prophesy of Pendor got this working (You recruit Pendorians), so I don't see why it shouldn't work in Warband...
 
Great thread, after playing warband i too was thinking why i can't have my own player recruit. This will make your kingdom the more fun to play since you will be getting your own kingdom troop to fight the other kingdom with.

I know beserker pride made a kingdom management script in with you are able to recruit your own soldier type maybe small adjustment should be made to make that compatible with war band, i will look into this and report later.
 
dunde said:
And no wonder that the "fac_player_supporters_faction" doesnt work for you, for you got the fiefs from editor, not from normal gameplay of native. As long as I know, "fac_player_faction" will be main party onlly, and if player has own kingdom later (as I use 1.011, with kingdom management mod) then it will be "fac_player_supporters_faction" and a global variable "$player_kingdom" that save the faction.

What dunde said is true. You may have screwed the game by manually modifying it with the editor. You should debug your own game. Add a trigger that prints the faction your character belongs to. Can you do it?
Let us know, I'll try to help.

 
Personnaly Im looking for somethign similar with 1 variation ! I simply want my troups ( that I created  (with a new basic peasent unit )) to be avalaible from 1 village I will add to the map .. If anybody knwo How I can achieve that  ( I guess I have to add the town / castle / village  first but then .. )  how can I make a created village generate the recruit I created for My unit tree
 
Atamawood said:
So does anybody know a way of player faction villages producing a certain cultures troops?

What dunde posted makes sense to me. After the line:
Code:
(party_get_slot, ":center_culture", ":center_no", slot_center_culture),

Add these lines to get Swadian Units:
Code:
	   (party_get_slot, ":center_lord", ":center_no", slot_town_lord), # Get Troop ID of center's lord
	   (try_begin),
		   (ge, ":center_lord", 0), # If Center has lord
		   (store_troop_faction, ":faction" , ":center_lord"), # Get Faction of the lord
		   (eq, ":faction", "fac_player_supporters_faction"), 
		   (assign, ":center_culture", "fac_culture_1"), # Set Swadian units
	   (try_end),

If you don't want to compile the ms, just paste the following code in the scripts.txt inside your mod. Be sure to substitute the correct lines, the script is named update_volunteer_troops_in_village:
Code:
update_volunteer_troops_in_village -1
 42 23 2 1224979098644774912 1 521 3 1224979098644774913 1224979098644774912 26 521 3 1224979098644774914 1224979098644774912 19 521 3 1224979098644774915 1224979098644774912 7 4 0 30 2 1224979098644774915 0 2173 2 1224979098644774916 1224979098644774915 31 2 1224979098644774916 432345564227567630 2133 2 1224979098644774914 432345564227567623 3 0 522 3 1224979098644774917 1224979098644774914 41 2133 2 1224979098644774918 1 2123 3 1224979098644774919 1224979098644774913 10 6 3 1224979098644774920 0 1224979098644774919 2136 3 1224979098644774921 0 100 2147483678 2 1224979098644774921 10 2136 3 1224979098644774921 0 2 1561 3 1224979098644774922 1224979098644774917 1224979098644774921 4 0 2147483680 2 1224979098644774922 0 1561 3 1224979098644774922 1224979098644774917 0 3 0 32 2 1224979098644774922 0 2105 2 1224979098644774918 1 2133 2 1224979098644774917 1224979098644774922 3 0 2133 2 1224979098644774923 7 4 0 30 2 1224979098644774913 5 2133 2 1224979098644774923 1224979098644774913 2108 2 1224979098644774923 2 2105 2 1224979098644774923 10 5 0 2147483678 2 1224979098644774913 0 2133 2 1224979098644774923 0 3 0 2107 2 1224979098644774923 3 2120 3 1224979098644774924 2 1224979098644774918 2108 2 1224979098644774923 1224979098644774924 2136 3 1224979098644774925 0 1224979098644774923 501 3 1224979098644774912 92 1224979098644774917 501 3 1224979098644774912 93 1224979098644774925
 
from what i could see, there are 4 files to edit. the first one would be module_troops you need to first create your own troop types.

Then edit the party templates there you can set your own kingdom reinforcements seeing as to now we have 6 factions make it faction 7.

Then edit module faction create your new culture and name it culture_7

The last one will be module_scripts probably more difficult then the others.

I used beserker pride kingdom management for this one better look at his template first.

http://forums.taleworlds.com/index.php/topic,82591.0.html

it is far easier using his then edit it further to suit your own needs for warband.

As for the village vollenteer looks pretty good to one who wrote before me.


Seems to be working. I manage to recycle kingdom management to work with warband.

if you copy the units from module troops and paste those from berserk pride in it and edit the other 2 files above and then

Code:
("village_recruit_volunteers_recruit",#KKM RECRUIT special from whichever faction you are.
    [(store_faction_of_party, ":center_faction", "$current_town"),
     (try_begin),
     (eq,":center_faction","fac_player_supporters_faction"),
     (assign,":volunteer_troop","trp_rebel_recruit"),#had to directly assign what volunteer troop would be.  But it now works.
     #(faction_get_slot, ":volunteer_troop", "fac_player_supporters_faction", slot_faction_tier_1_troop),
     (else_try),
     (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (try_end),     
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (store_skill_level, ":skill", "skl_persuasion", "trp_player"),#persuasion addition
     (val_add, ":volunteer_amount", ":skill"),#persuasion addition
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

Paste this in module scripts you will be able to recruit your own player faction unit. so you can now edit your own player faction troops this way.

So now you can even use the tool troop editor and it will be easier to manage.


To those that want to try it, here is my copy, and source code included. i don't have much time to edit more stuff so use it as you will.

http://www.megaupload.com/?d=1RXM0Q4H
 
Topper said:
dunde said:
And no wonder that the "fac_player_supporters_faction" doesnt work for you, for you got the fiefs from editor, not from normal gameplay of native. As long as I know, "fac_player_faction" will be main party onlly, and if player has own kingdom later (as I use 1.011, with kingdom management mod) then it will be "fac_player_supporters_faction" and a global variable "$player_kingdom" that save the faction.

What dunde said is true. You may have screwed the game by manually modifying it with the editor. You should debug your own game. Add a trigger that prints the faction your character belongs to. Can you do it?
Let us know, I'll try to help.

Yeah, I'm new to the whole process of coding, so while I can fiddle around, chances are I'll end up breaking something. I probably can add a trigger that prints the faction my character belongs to though... I'll give it a try. Here's what I think I should do (Might be wrong):

Code:
{str_store_faction_name,s33),":player_faction"),

(display_message, "@Your current faction is {s33}.")

Edit: Gah, this gives me an Invalid Syntax error when compiling. I'm too n00b for this! T_T

dzorro said:
from what i could see, there are 4 files to edit. the first one would be module_troops you need to first create your own troop types.

Then edit the party templates there you can set your own kingdom reinforcements seeing as to now we have 6 factions make it faction 7.

Then edit module faction create your new culture and name it culture_7

The last one will be module_scripts probably more difficult then the others.

I used beserker pride kingdom management for this one better look at his template first.

http://forums.taleworlds.com/index.php/topic,82591.0.html

it is far easier using his then edit it further to suit your own needs for warband.

As for the village vollenteer looks pretty good to one who wrote before me.


Seems to be working. I manage to recycle kingdom management to work with warband.

if you copy the units from module troops and paste those from berserk pride in it and edit the other 2 files above and then

Code:
("village_recruit_volunteers_recruit",#KKM RECRUIT special from whichever faction you are.
    [(store_faction_of_party, ":center_faction", "$current_town"),
     (try_begin),
     (eq,":center_faction","fac_player_supporters_faction"),
     (assign,":volunteer_troop","trp_rebel_recruit"),#had to directly assign what volunteer troop would be.  But it now works.
     #(faction_get_slot, ":volunteer_troop", "fac_player_supporters_faction", slot_faction_tier_1_troop),
     (else_try),
     (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (try_end),     
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (store_skill_level, ":skill", "skl_persuasion", "trp_player"),#persuasion addition
     (val_add, ":volunteer_amount", ":skill"),#persuasion addition
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

Paste this in module scripts you will be able to recruit your own player faction unit. so you can now edit your own player faction troops this way.

So now you can even use the tool troop editor and it will be easier to manage.


To those that want to try it, here is my copy, and source code included. i don't have much time to edit more stuff so use it as you will.

http://www.megaupload.com/?d=1RXM0Q4H

I'll give this a try as well. I'll just download the whole thing and work with it, if you don't mind. xD
 
Hey dzorro Just to understand properly ( sorry im nto really godo I downloaded your package ) do I need to edit anythign myself or simply copy paste some of the files included in the package you gave me ?    ( also the package is exactly liek native just with a seventh kingdom right ?


And jsut to know do we have to start as the owner of that kingdom  or can it be independant like any other ( even thought I want my units from that kingdoms I want to have to conquer it liek any other kingdom )
 
kirinelf said:
Code:
{str_store_faction_name,s33),":player_faction"),

(display_message, "@Your current faction is {s33}.")

Edit: Gah, this gives me an Invalid Syntax error when compiling. I'm too n00b for this! T_T

This is the correct trigger, substitute one of the empty ones at the end of the file module_simple_triggers.py, firing every 24 hours:
Code:
(1,
   [
    (store_troop_faction, ":faction", "trp_player"),
    (str_store_faction_name, s33, ":faction"),
    (display_message, "@Your faction is {s33}"),
   ]),
 
dzorro said:
Code:
("village_recruit_volunteers_recruit",#KKM RECRUIT special from whichever faction you are.
    [(store_faction_of_party, ":center_faction", "$current_town"),
     (try_begin),
     (eq,":center_faction","fac_player_supporters_faction"),
     (assign,":volunteer_troop","trp_rebel_recruit"),#had to directly assign what volunteer troop would be.  But it now works.
     #(faction_get_slot, ":volunteer_troop", "fac_player_supporters_faction", slot_faction_tier_1_troop),
     (else_try),
     (party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (try_end),     
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (store_skill_level, ":skill", "skl_persuasion", "trp_player"),#persuasion addition
     (val_add, ":volunteer_amount", ":skill"),#persuasion addition
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

The problem with this code is that in the village menu it will display the name of the original troops: it's just a visual thing but it may bother someone. Besides, at line 5, "trp_rebel_recruit" must be substituted by the name of the recruit that you have added to the game, the same name in module_troops.py.
Other than these 2 details, it should work.
 
Snutze said:
Hey dzorro Just to understand properly ( sorry im nto really godo I downloaded your package ) do I need to edit anythign myself or simply copy paste some of the files included in the package you gave me ?    ( also the package is exactly liek native just with a seventh kingdom right ?


And jsut to know do we have to start as the owner of that kingdom  or can it be independant like any other ( even thought I want my units from that kingdoms I want to have to conquer it liek any other kingdom )

yes it's just like native. but with kingdom 7, that is why i given the source so you can edit your own thing. far easier that way. yes you need to start your own kingdom first before you are able to recruit your own units. you can't conquer them since they belong to your kingdom, when you first capture a castle see them more like a rebel kingdom. Witch you use to conquer the game.

The problem with this code is that in the village menu it will display the name of the original troops: it's just a visual thing but it may bother someone. Besides, at line 5, "trp_rebel_recruit" must be substituted by the name of the recruit that you have added to the game, the same name in module_troops.py.
Other than these 2 details, it should work.

Yes i noticed this too, but i could not find mnu where to change that detail if you can, please do change it.
 
I think I've lost myself in this thread.  :mrgreen:

Let's proceed with order.

Atamawood can you confirm if what I wrote before is working for you?

dzorro said:
The problem with this code is that in the village menu it will display the name of the original troops: it's just a visual thing but it may bother someone. Besides, at line 5, "trp_rebel_recruit" must be substituted by the name of the recruit that you have added to the game, the same name in module_troops.py.
Other than these 2 details, it should work.

Yes i noticed this too, but i could not find mnu where to change that detail if you can, please do change it.

Here. Go to module_game_menus.py, find menu "recruit_volunteers", after this line:
Code:
[(party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
Paste this:
Code:
(store_faction_of_party, ":center_faction", "$current_town"),
(try_begin),
  (eq, ":center_faction", "fac_player_supporters_faction"),
  (assign, ":volunteer_troop", "trp_your_recruit"),
(try_end),

Remember to change "trp_your_recruit" to the name of the unit created and added to the game.

I still think that the "correct" way to mod this is by changing the script "update_volunteer_troops_in_village", which is what dunde suggested at the beginning.
 
Back
Top Bottom