changing faction troops after a rebellion....

Users who are viewing this thread

say I help the nords rebel, is there any way I could set it so their culture is changed and they get a complete new set of troops?
 
Oops. Sorry for making that post post (now deleted), I was quite drunk while doing it and the code was wrong. :grin: Anyway, I'm now with a clear head and I've been fiddling around with this. This is what I've got so far.
Code:
    (24, 0, ti_once,
	    [(store_current_day, ":current_day", reg(0)),
		  (eq, ":current_day", 14),
		],
		[(store_random_in_range, ":random_kingdom", kingdoms_begin,kingdoms_end),
		 (try_begin),
		    (faction_set_slot, "fac_advanced_culture", slot_faction_tier_1_troop, "trp_advanced_recruit"),
		    (faction_set_slot, "fac_advanced_culture", slot_faction_tier_2_troop, "trp_advanced_militia"),
		    (faction_set_slot, "fac_advanced_culture", slot_faction_tier_3_troop, "trp_advanced_infantry"),
		    (faction_set_slot, "fac_advanced_culture", slot_faction_tier_4_troop, "trp_advanced_knight"),
		    (faction_set_slot, ":random_kingdom", slot_faction_culture, "fac_advanced_culture"),
		 (try_end),
		 (try_begin),
		    (faction_slot_eq, ":random_kingdom", slot_faction_culture, "fac_advanced_culture"),
			 (faction_set_slot, ":random_kingdom", slot_faction_deserter_troop, "trp_advanced_deserter"),
			 (faction_set_slot, ":random_kingdom", slot_faction_guard_troop, "trp_advanced_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_messenger_troop, "trp_advanced_messenger"),
			 (faction_set_slot, ":random_kingdom", slot_faction_prison_guard_troop, "trp_advanced_prison_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_castle_guard_troop, "trp_advanced_castle_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_a, "pt_advanced_reinforcements_a"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_b, "pt_advanced_reinforcements_b"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_c, "pt_advanced_reinforcements_c"),
		 (try_end),
       (str_store_faction_name, s1, ":random_kingdom"),
       (dialog_box, "@{s1} is now deemed to be the most advanced Kingdom in Calradia!"),
		 ]),

It should actually work. I'm going to test it soon, just shared it so perhaps someone can perfect it even more.
cdvader

EDIT: Updated the code.
 
Well, at first you should 'prepare' all the Upgrade's in module_troops.py . Something like this.

upgrade("trp_advanced_recruit, "next"),
upgrade("next", "next again"),
upgrade("next again", "trp_advanced_knight"),

And so on. Then, with my script, it sets the Tier 1 troop to "trp_advanced_recruit", basically where all the 'new' Upgrades begin. And then you have a dynamic kingdom/troop tree change. The Lord parties will, eventually, start using the new troops too. Once they get the new reinforcement wave or lose in a battle, they will have the new troops at their side.

cdvader
 
Yes. The village recruiting is based on the Tier system. If your relation is high, you get Tier 1 troops. If your relation is good, you get Tier 2 troops. If you relation is excellent, you get Tier 3 troops. And if your relation is outstanding, you get Tier 4 troops.

The (upgrade) feature links all the troops together for the player. That's the "actual" troop tree. The pt_reinforcements are used by NPCs.

cdvader
 
Well... At first, I was planning to keep this (not-so-little) piece of script to my own. But, ah, what the hell, I'll share it with you lot. Basically, what the new code does, well actually, what the new code was meant to do was first check the script every 24 hours that is it day 14 or greater, if it is then launch the consuqences block. In the consuqences block, the script has two choices to check. The first choice is that the player has the Scepter of Viranno item, then it would set the new kingdoms culture, troop-tree, name and colour to viranno_culture. The same thing for Pulanos.

My original plan was to have a pretty long quest which would involve some killing, investigasting and tracking and in the end, you would have to defeat a 'God-King' and get a choice between two Scepters. One of the Scepters would determine the fate of one of the three kingdoms (in the script, it's 5, I edited that). But sadly, I can't do that anymore, since some code snippets are bugged and cannot be used..  :cry:

Alright, enough babbling. Here's the code.
Code:
    #Dynamic Kingdom-Change trigger by CdVader.
    (24, 0, ti_once, 
	    [(store_current_day, ":current_day", reg(0)),
		  (ge, ":current_day", 14)],
		[(store_random_in_range, ":random_kingdom", "fac_kingdom_1","fac_kingdom_5"),
		 (str_store_faction_name, s1, ":random_kingdom"),
		 (try_begin),
		    (player_has_item, "itm_scepter_of_viranno"), #Set Viranno culture Tier tree.
		    (faction_set_slot, "fac_viranno_culture", slot_faction_tier_1_troop, "trp_viranno_recruit"),
			 (faction_set_slot, "fac_viranno_culture", slot_faction_tier_2_troop, "trp_viranno_militia"),
			 (faction_set_slot, "fac_viranno_culture", slot_faction_tier_3_troop, "trp_viranno_footman"),
			 (faction_set_slot, "fac_viranno_culture", slot_faction_tier_4_troop, "trp_viranno_infantry"),
			 (faction_set_slot, "fac_viranno_culture", slot_faction_tier_5_troop, "trp_viranno_knight"),
		 (else_try),
		    (player_has_item, "itm_scepter_of_pulanos"), #Set Pulanos culture Tier tree.
			 (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_1_troop, "trp_pulanos_recruit"),
			 (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_2_troop, "trp_pulanos_militia"),
			 (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_3_troop, "trp_pulanos_footman"),
			 (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_4_troop, "trp_pulanos_infantry"),
			 (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_5_troop, "trp_pulanos_knight"),
		 (end_try),
		 (try_begin),
		    (player_has_item, "itm_scepter_of_viranno"), #Set Viranno faction base ready.
		    (faction_set_slot, ":random_kingdom", slot_faction_culture, "fac_viranno_culture"),
			#(faction_set_slot, ":random_kingdom", slot_faction_leader, "trp_viranno_leader"), #Bugged.
			#(faction_set_name, ":random_kingdom", "@Kingdom of Viranno"), #Bugged.
			(faction_set_color, ":random_kingdom", 0x30D5C8), #Turqoise.
		 (else_try),
		    (player_has_item, "itm_scepter_of_pulanos"), #Set Pulanos faction base ready.
			 (faction_set_slot, ":random_kingdom", slot_faction_culture, "fac_pulanos_culture"),
			#(faction_set_slot, ":random_kingdom", slot_faction_leader, "trp_pulanos_leader"), #Bugged.
			#(faction_set_name, ":random_kingdom", "@Kingdom of Pulanos"), #Bugged.
			(faction_set_color, ":random_kingdom", 0xAAAAAA), #Gray.
		 (try_end),
		 (try_begin),
		    (faction_slot_eq, ":random_kingdom", slot_faction_culture, "fac_viranno_culture"), #Set Viranno troop-tree.
			 (faction_set_slot, ":random_kingdom", slot_faction_deserter_troop, "trp_viranno_deserter"),
			 (faction_set_slot, ":random_kingdom", slot_faction_guard_troop, "trp_viranno_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_messenger_troop, "trp_viranno_messenger"),
			 (faction_set_slot, ":random_kingdom", slot_faction_prison_guard_troop, "trp_viranno_prison_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_castle_guard_troop, "trp_viranno_castle_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_a, "pt_viranno_reinforcements_a"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_b, "pt_viranno_reinforcements_b"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_c, "pt_viranno_reinforcements_c"),
		 (else_try),
		    (faction_slot_eq, ":random_kingdom", slot_faction_culture, "fac_pulanos_culture"), #Set Pulanos troop-tree.
			 (faction_set_slot, ":random_kingdom", slot_faction_deserter_troop, "trp_pulanos_deserter"),
			 (faction_set_slot, ":random_kingdom", slot_faction_guard_troop, "trp_pulanos_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_messenger_troop, "trp_pulanos_messenger"),
			 (faction_set_slot, ":random_kingdom", slot_faction_prison_guard_troop, "trp_pulanos_prison_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_castle_guard_troop, "trp_pulanos_castle_guard"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_a, "pt_pulanos_reinforcements_a"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_b, "pt_pulanos_reinforcements_b"),
			 (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_c, "pt_pulanos_reinforcements_c"),
		 (try_end),
		 (str_store_faction_name, s2, ":random_kingdom"),
		 (dialog_box, "@{s1} is reformed, and now known as {s2}."),
		]),

So what exactly is bugged? See for yourself.

a) Setting the faction leader.
Sadly, the 'faction_set_slot' with the 'slot_faction_leader' is completely bugged. It ONLY adds the faction leader when there is none present. It doesn't overwrite the existing faction leader. And so far, I haven't found any kind of a script which removes the old faction leader.

b) Changing the faction name.
The 'faction_set_name' is basically working, actually, only that it's bugged, yet again. It does overwrite the name, but it doesn't overwrite the "old" strings. So, for example, if you press Q and go to Factions, you see "Kingdom of Pulanos" but when you click on it, you see "Kingdom of <existing kingdom> is being ruled by <existing king>".

Everything else is working, however. To get this trigger working properly you need to add new troops (module_troops.py), new reinforcements (module_party_templates.py), new items (module_items.py), new Upgrade tree (module_troops.py again), and lastly, new cultures (module_factions.py). Of course, feel free to edit it so it doesn't require items. You can do whatever you want with it, but it never hurts to get credited. :smile:
cdvader
 
I'm sure I've seen scripts involving removing the old faction leader, I'll take a look.

EDIT: Do you want the old leader to be removed as in "dead"?
 
Okay, I've managed to figure it out. Basically, what the new part of the code does, is assign the correct kingdom to the correct king. Afterwards, it sets the correct king to "template" faction. Then it adds the new king.

Simply paste this code in very bottom of module_triggers.py, right before the end ']'.
Code:
    (24, 0, ti_once,
	    [(store_current_day, ":current_day", reg(0)),
		  (ge, ":current_day", 14)],
		[(store_random_in_range, ":random_kingdom", "fac_kingdom_1","fac_kingdom_5"),
		 (assign, ":kingdom_leader", -1),
		 (str_store_faction_name, s1, ":random_kingdom"),
		 (try_begin),
		     (player_has_item, "itm_scepter_of_viranno"),
		     (faction_set_slot, "fac_viranno_culture", slot_faction_tier_1_troop, "trp_viranno_recruit"),
			  (faction_set_slot, "fac_viranno_culture", slot_faction_tier_2_troop, "trp_viranno_militia"),
			  (faction_set_slot, "fac_viranno_culture", slot_faction_tier_3_troop, "trp_viranno_footman"),
			  (faction_set_slot, "fac_viranno_culture", slot_faction_tier_4_troop, "trp_viranno_infantry"),
			  (faction_set_slot, "fac_viranno_culture", slot_faction_tier_5_troop, "trp_viranno_knight"),
		 (else_try),
		     (player_has_item, "itm_scepter_of_pulanos"),
			  (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_1_troop, "trp_pulanos_recruit"),
			  (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_2_troop, "trp_pulanos_militia"),
			  (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_3_troop, "trp_pulanos_footman"),
			  (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_4_troop, "trp_pulanos_infantry"),
			  (faction_set_slot, "fac_pulanos_culture", slot_faction_tier_5_troop, "trp_pulanos_knight"),
		 (end_try),
	    (try_begin),
		     (assign, ":kingdom_leader", 1),
	        (troop_is_hero, ":kingdom_leader"),
	        (eq, ":kingdom_leader", "trp_kingdom_1_lord"),
		     (assign, ":kingdom_leader", "fac_kingdom_1"),
	    (else_try),
		     (assign, ":kingdom_leader", 1),
		     (troop_is_hero, ":kingdom_leader"),
			  (eq, ":kingdom_leader", "trp_kingdom_2_lord"),
			  (assign, ":kingdom_leader", "fac_kingdom_2"),
		 (else_try),
		     (assign, ":kingdom_leader", 1),
		     (troop_is_hero, ":kingdom_leader"),
			  (eq, ":kingdom_leader", "trp_kingdom_3_lord"),
			  (assign, ":kingdom_leader", "fac_kingdom_3"),
		 (else_try),
		     (assign, ":kingdom_leader", 1),
		     (troop_is_hero, ":kingdom_leader"),
			  (eq, ":kingdom_leader", "trp_kingdom_4_lord"),
			  (assign, ":kingdom_leader", "fac_kingdom_4"),
		 (else_try),
		     (assign, ":kingdom_leader", 1),
		     (troop_is_hero, ":kingdom_leader"),
			  (eq, ":kingdom_leader", "trp_kingdom_5_lord"),
			  (assign, ":kingdom_leader", "fac_kingdom_5"),
		 (try_end),
       (try_begin),
           (player_has_item, "itm_scepter_of_viranno"),
			  (eq, ":kingdom_leader", 1),
           (faction_set_slot, ":random_kingdom", slot_faction_culture, "fac_viranno_culture"),
			  (faction_set_slot, "fac_template_faction", slot_faction_state, sfs_active),
			  (troop_set_slot, ":kingdom_leader", slot_troop_change_to_faction, "fac_template_faction"),
			  (troop_set_slot, ":kingdom_leader", slot_troop_original_faction, "fac_template_faction"),
			  (faction_set_slot, "fac_template_faction", slot_faction_state, sfs_inactive),
           (faction_set_slot, ":random_kingdom", slot_faction_leader, "trp_viranno_leader"),
           (faction_set_color, ":random_kingdom", 0x30D5C8),
       (else_try),
           (player_has_item, "itm_scepter_of_pulanos"),
			  (eq, ":kingdom_leader", 1),
           (faction_set_slot, ":random_kingdom", slot_faction_culture, "fac_pulanos_culture"),
			  (faction_set_slot, "fac_template_faction", slot_faction_state, sfs_active),
			  (troop_set_slot, ":kingdom_leader", slot_troop_change_to_faction, "fac_template_faction"),
			  (troop_set_slot, ":kingdom_leader", slot_troop_original_faction, "fac_template_faction"),
			  (faction_set_slot, "fac_template_faction", slot_faction_state, sfs_inactive),
           (faction_set_slot, ":random_kingdom", slot_faction_leader, "trp_pulanos_leader"),
           (faction_set_color, ":random_kingdom", 0xAAAAAA),
       (try_end),
		 (try_begin),
		     (faction_slot_eq, ":random_kingdom", slot_faction_culture, "fac_viranno_culture"),
			  (faction_set_slot, ":random_kingdom", slot_faction_deserter_troop, "trp_viranno_deserter"),
			  (faction_set_slot, ":random_kingdom", slot_faction_guard_troop, "trp_viranno_guard"),
			  (faction_set_slot, ":random_kingdom", slot_faction_messenger_troop, "trp_viranno_messenger"),
			  (faction_set_slot, ":random_kingdom", slot_faction_prison_guard_troop, "trp_viranno_prison_guard"),
			  (faction_set_slot, ":random_kingdom", slot_faction_castle_guard_troop, "trp_viranno_castle_guard"),
			  (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_a, "pt_viranno_reinforcements_a"),
			  (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_b, "pt_viranno_reinforcements_b"),
			  (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_c, "pt_viranno_reinforcements_c"),
		 (else_try),
		     (faction_slot_eq, ":random_kingdom", slot_faction_culture, "fac_pulanos_culture"),
			  (faction_set_slot, ":random_kingdom", slot_faction_deserter_troop, "trp_pulanos_deserter"),
			  (faction_set_slot, ":random_kingdom", slot_faction_guard_troop, "trp_pulanos_guard"),
			  (faction_set_slot, ":random_kingdom", slot_faction_messenger_troop, "trp_pulanos_messenger"),
			  (faction_set_slot, ":random_kingdom", slot_faction_prison_guard_troop, "trp_pulanos_prison_guard"),
			  (faction_set_slot, ":random_kingdom", slot_faction_castle_guard_troop, "trp_pulanos_castle_guard"),
			  (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_a, "pt_pulanos_reinforcements_a"),
			  (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_b, "pt_pulanos_reinforcements_b"),
			  (faction_set_slot, ":random_kingdom", slot_faction_reinforcements_c, "pt_pulanos_reinforcements_c"),
		 (try_end),
		 (str_store_faction_name, s2, ":random_kingdom"),
		 (dialog_box, "@{s1} is reformed, and is now known as {s2}."),
		]),

And, of course, all the other code, what you must be making on your own ... I won't share them. For the template faction, simply put this in the very bottom of module_factions.py
Code:
  ("template_faction","Template Faction",0, 0.9, [], []),


Note 1: Also, you can greatly simplify your script and your own work by using only one Culture at a time. I just wanted to keep it nicely organized.
Note 2: The code is untested in-game, but it compiled fine for me and I'm pretty sure it works.
cdvader
 
Jubal, does it work? I got rid of my old "testing" ModuleSystem (crapped it up) and I don't feel like making new troops & party templates. I'm lazy.  :smile:

Because if it doesn't, I can perfect it.
cdvader
 
I won't have time to test the longer trigger for a while (I'm away Sun-Fri in Cambridge). I'll get the shorter one looked at, the one that's just for changing faction troops.
 
Hey! I think I got the (faction_set_name) to work. Just add this line after (faction_set_name).

Code:
(call_script, "script_update_faction_notes", ":random_kingdom"),

cdvader.
 
Back
Top Bottom