[Solved] Changing Castle and Town Guard Generation

Users who are viewing this thread

n4v32x

Recruit
Hello,

So I've been tinkering with the mod for a couple of days trying to change the way factions and cultures work. I've made it so that when a faction conquers a castle or town, recruits in that area (including villagers) will become of the controller faction's culture instead of the original. I've also added a new culture and troop tree for the player faction and the ability to choose the culture of the faction from any of the 21.

I want to do the same thing for guards, however it is proving rather difficult. I've managed to make the castle guards change from the default generic guys to faction specific, but it does so based on the default culture of the faction and not the current one, unlike the recruits. For the town guards (when you take a walk) they seem to be locked to the original town faction and culture, no matter what I change.

So right now, if I have my own faction, my retinue would be of one culture, my indoor guards would be of another culture and my outdoor guards would be of yet another culture. I would like all three to be the same one.

The areas I've been tinkering with the most are "Take a walk around the streets." section in module_game_menus.py for the town guards and the #adding guards section under the "enter court" script in module_scripts.py for the castle ones. Maybe these are not the right places to change?

I could provide the changes that I've tried, but there are so many of them that it's probably not helpful.

Any help would be appreciated. Thanks
 
Well, I don't have the answer for your question but i'd be awesome if you could share your work with custom troop trees etc. I'd like to play with my own faction so that would be awesome if you share  :razz:
 
I will, but it is kind of fiddly so I can't just make a submod because it would conflict with pretty much everything else, but I could describe the process so you can do it yourself I guess.

I've managed to get villages and towns/castles to update to my current culture which I can choose through a menu, and I've also figured out how to get outdoor guards to do the same. I am still stuck at changing the guards to reflect the culture and not the faction. I'm trying to modify the diplomacy script that does it based on the lord's original culture so that it's the current culture instead.

The logic is that all clans are of the same culture, Japanese, so the differences would be in how the troops are equipped, not anything major like steppe archers vs western knights. As a result, it would be reasonable that when a clan takes over territory, recruits and, as a result, trained troops would reflect the new leadership after a few days (which is like a month in extrapolated time). Guards would update instantly since they would probably come from the standing army.

I've gotten basically 80% to work as intended, although I've encountered a weird bug that I don't know the source of: the player spawns instead of the prison guard when he is the ruler of the castle/town and there is an additional instance of the player where you are supposed to spawn from that has the dialog and functionality of the chamberlain... it's weird.

Anyway, if you know what you're supposed to be changing it shouldn't be much work, mostly in editing the troops to be how you like them to be. I just have no clue what I'm doing so I'm trial and erroring it up until it works and having to compile, start a new game and do all the setup every time I want to test things makes the process pretty slow.

So yeah, don't hold your breath. If you want I can PM you the process I've figured out so far so that you may tinker with it yourself.
 
Okay. I have successfully implemented my idea and it works properly.

If you want to do it as well, the process is pretty simple:

First of all you want to re-enable the player faction in module_scripts.py which in Gekokujo 3.0 and 3.1 is disabled by comments between
Code:
#gekokujo 3.0 get rid of player culture start
so search for that and remove the comments, but keep what is inbetween. You may also update the troop and party template names into whatever you want them to be when you add them later in the troop editor.

While you are here, go down to the scripts update_volunteer_troops_in_village and update_npc_volunteer_troops_in_village and replace
Code:
(party_get_slot, ":center_culture", ":center_no", slot_center_culture)

    with

(store_faction_of_party, ":center_culture", ":center_no")
This makes it so that recruitment centers update with your selected culture when the scripts update (after 72 hours).

Also, somewhere with all the other scripts, include
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"),
	  (try_end),
This will update the culture of locations for non-recruitment purposes.

Now onto module_game_menus.py we want to update the town and castle instances so they pull the new culture, like with the recruitment centers. Search for "Take a walk" and you should find them. Here, where you see
Code:
(party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),

   replace with

(store_faction_of_party, ":town_original_faction", "$current_town"),
I also changed the variable to :town_current_faction for flavor, but you don't have to. You have to do the same thing for both the streets (town) and the courtyard (castle).

Now, you should be set in here, but maybe you want to change your faction's culture to something other than the default you defined in module_scripts. For that you need a menu (in here) or dialog (not here). I went with a menu that you can implement like this: http://pastebin.com/q76RLjAp (Pastebin because code is too long lel)
Where you put the menu is up to you, I put the first part in the camp menu between Re-dye and Retire and the bulk of the code next to the "retirement_verify" menu code.

Finally, you need to go to module_party_templates.py and add your templates next to the other (I did kingdom_21) and module_troops.py to add your troops. I just cloned a culture that I thought was close enough and then edited it later with Morgh's editor, so you don't have to add/change all the stats and equipment by hand. Anyway, make sure all the names and variables are the same in all the places you edited things.

Now you can compile and all should be well.

Edit: I forgot to mention, you should probably also edit the villager and ji-samurai names to remove the region, so that when land changes hands you don't recruit villagers from Aki in Mikawa. I just changed all of them to reflect their ruling clan instead of the region for immersion.

Edit2: So I found out later that vassals and patrols won't update to your faction properly. You can fix this by doing the same kind of change from above (removing the ..._original_faction input) in the scripts that set reinforcements and patrols in module_scripts. You can do this in the middle of a save and it will be fine, but troops already recruited will not be updated, only future ones.
 
I wish i could do the things you said above BUT im an hardcore module system hater (cuz i dont really understand anythng) but im glad you found the solution i just wish someone would upload files as a submod  :roll:
 
This is what happens when i try to mess with module system  :lol:  :facepalm:

module.png
 
thanks that was good to know i was sick of having to recruit the troops of my enemies lol but the last part of your tuto is a little bit confusing i hoped if you could explain more but good thing you did i think many people would love to do that the same as me!!
 
What's the difference between update_volunteer_troops_in_village and update_npc_volunteer_troops_in_village? Which function does what? They look to be the same to me.
 
PPQ_Purple said:
What's the difference between update_volunteer_troops_in_village and update_npc_volunteer_troops_in_village? Which function does what? They look to be the same to me.
i might be wrong but i think update volunteers is for the troops and npc is for village elder and your treasure guy and non dying characters i guess again i'm not that good at coding!!
 
Yes it does effect the lords that serve you. They recruit the troops of the culture that you choose. update_npc_volunteer_troops_in_village this script is for that.
 
Aruda said:
Yes it does effect the lords that serve you. They recruit the troops of the culture that you choose. update_npc_volunteer_troops_in_village this script is for that.
So update_volunteer_troops_in_village is for the player recruiting and update_npc_volunteer_troops_in_village is for your lords?
 
Aruda said:
Interesting.

Than it might help me. You see, basically what I am doing is jury rigging a new culture in without actually adding it as a culture. I am not defining a new culture from scratch the proper way but instead I just edited the update_volunteer_troops_in_village function so that when a boolean is tripped all cultures are ignored and the troops are from a tree I defined.

The reason for this is that I don't want my custom culture to be selectable (you can't change into it) and that you can't ever change out of it if you are in it. So using the normal system is out of the question. And I managed to get it to work for the player. Now I just need to expand that to the lords.
 
PPQ_Purple said:
Aruda said:
Interesting.

Than it might help me. You see, basically what I am doing is jury rigging a new culture in without actually adding it as a culture. I am not defining a new culture from scratch the proper way but instead I just edited the update_volunteer_troops_in_village function so that when a boolean is tripped all cultures are ignored and the troops are from a tree I defined.

The reason for this is that I don't want my custom culture to be selectable (you can't change into it) and that you can't ever change out of it if you are in it. So using the normal system is out of the question. And I managed to get it to work for the player. Now I just need to expand that to the lords.
woah how did you do it !!
can you tell me !! and can you explain more!!
i really like your ideas i hope i can test that work for you !!!
and just a question are you trying to create a new system ? or just something else ? i really would love to see your work!! gambari !!!
 
imado552 said:
PPQ_Purple said:
Aruda said:
Interesting.

Than it might help me. You see, basically what I am doing is jury rigging a new culture in without actually adding it as a culture. I am not defining a new culture from scratch the proper way but instead I just edited the update_volunteer_troops_in_village function so that when a boolean is tripped all cultures are ignored and the troops are from a tree I defined.

The reason for this is that I don't want my custom culture to be selectable (you can't change into it) and that you can't ever change out of it if you are in it. So using the normal system is out of the question. And I managed to get it to work for the player. Now I just need to expand that to the lords.
woah how did you do it !!
can you tell me !! and can you explain more!!
i really like your ideas i hope i can test that work for you !!!
and just a question are you trying to create a new system ? or just something else ? i really would love to see your work!! gambari !!!
Basically my end goal is to add a new troop tree and a couple of quests that make you convert to it. We'll talk details once it's done.
 
PPQ_Purple said:
imado552 said:
PPQ_Purple said:
Aruda said:
Interesting.

Than it might help me. You see, basically what I am doing is jury rigging a new culture in without actually adding it as a culture. I am not defining a new culture from scratch the proper way but instead I just edited the update_volunteer_troops_in_village function so that when a boolean is tripped all cultures are ignored and the troops are from a tree I defined.

The reason for this is that I don't want my custom culture to be selectable (you can't change into it) and that you can't ever change out of it if you are in it. So using the normal system is out of the question. And I managed to get it to work for the player. Now I just need to expand that to the lords.
woah how did you do it !!
can you tell me !! and can you explain more!!
i really like your ideas i hope i can test that work for you !!!
and just a question are you trying to create a new system ? or just something else ? i really would love to see your work!! gambari !!!
Basically my end goal is to add a new troop tree and a couple of quests that make you convert to it. We'll talk details once it's done.
go for it !!
i can't wait to see it and hope it works well for yea!!
 
f**k it i did everything and checked other forums but no i can't seem to make it work if you my friend did then send me your MS to be able to do it as well i can't find that option in camp after i became king or great lord no matter how long i wait and the troops are still the original faction and yes i did it all correctly !!!!
 
Back
Top Bottom