Change Race of Player depending on Starting Faction?

Users who are viewing this thread

Max2150

Regular
tl;dr I would like to be able change race of player when starting in certain factions, but due to bad coding player can't be female. help please  :oops:

So I have added two new skins, 'Asian' man and 'Mideast' man. They work fine.

I was wondering how I could make it so when a player chooses a faction such as 'Khergit' or 'Sarranid' they start with these faces.

I have done this by using:

Code:
(assign, "$character_gender",

in this code:

Code:
 (try_begin), #Starting region benefits
			(eq, "$background_answer_5", kingdom_1), # Swadia
			(val_add, ":prof_polearm", 15),
			(val_add, ":prof_onehand", 10),
			(val_add, ":prof_archery", 5),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_6"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_praven"),
		(else_try),
			(eq, "$background_answer_5", kingdom_2), # Vaegir
			(val_add, ":prof_archery", 15),
			(val_add, ":prof_polearm", 10),
			(val_add, ":prof_onehand", 5),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_8"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_reyvadin"),
		(else_try),
			(eq, "$background_answer_5", kingdom_3), # Khergit
			(val_add, ":prof_archery", 15),
			(val_add, ":prof_onehand", 10),
			(val_add, ":prof_twohand", 5),
			(troop_set_type, "trp_player", 3),
            (assign, "$character_gender", tf_asian),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_10"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_wuchang"),
			#(troop_set_type,"trp_player", 3),
		(else_try),
			(eq, "$background_answer_5", kingdom_4), # Nord
			(val_add, ":prof_twohand", 15),
			(val_add, ":prof_throwing", 10),
			(val_add, ":prof_onehand", 5),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_1"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_sargoth"),
		(else_try),
			(eq, "$background_answer_5", kingdom_5), # Rhodoks
			(val_add, ":prof_crossbow", 15),
			(val_add, ":prof_onehand", 10),
			(val_add, ":prof_polearm", 5),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_5"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_jelkala"),
		(else_try),
		    (eq, "$background_answer_5", kingdom_6), # Sarranid
			(val_add, ":prof_onehand", 15),
			(val_add, ":prof_twohand", 10),
			(val_add, ":prof_archery", 5),
			(troop_set_type, "trp_player", 4),
            (assign, "$character_gender", tf_mideast),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_19"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_shariz"),
			#(troop_set_type,"trp_player", 4),
		(else_try),
			(eq, "$background_answer_5", kingdom_8), # Sarranid
			(val_add, ":prof_archery", 15),
			(val_add, ":prof_onehand", 10),
			(val_add, ":prof_twohand", 5),
			(troop_set_type, "trp_player", 3),
            (assign, "$character_gender", tf_asian),
			# replaces some native game menu code
			(assign, "$current_town", "p_town_18"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_luoyang"),
			#(troop_set_type,"trp_player", 3),
		(else_try),
			(eq, "$background_answer_5", kingdom_9), # Sarranid
			(val_add, ":prof_archery", 15),
			(val_add, ":prof_onehand", 10),
			(val_add, ":prof_twohand", 5),
			# replaces some native game menu code
			(troop_set_type, "trp_player", 3),
            (assign, "$character_gender", tf_asian),
			(assign, "$current_town", "p_town_23"),
			(assign, "$g_starting_town", "$current_town"),
			(assign, "$g_journey_string", "str_journey_to_chengdu"),
			#(troop_set_type,"trp_player", 3),
		(else_try),
		    (display_message, "@ERROR: No valid faction designated."),
		(try_end),

However, I am using a one page character creation screen, and when selecting starting faction the 'choose gender' box keeps switching to 'woman' (because I'm changing gender and there is no option for asian or mideast).

What I would like to do is prevent that from happening, but also when doing this the player cannot be a woman, they are always male (because of the gender code again).
Anyone know of what code I should be using instead as well as where to insert it?

Thanks - Max
 
Max2150 said:
tl;dr I would like to be able change race of player when starting in certain factions, but due to bad coding player can't be female. help please  :oops:

So I have added two new skins, 'Asian' man and 'Mideast' man. They work fine.

you need a male and a female skin for each culture/race/type, like [Asian Male] and [Asian Female] to use a similar system to Native.

You will also need to update how dialogs/menus/scripts/... use the skin information for gender (as Native assumes you are either 0 or 1). And so on. Some modules use a global variable instead of skin (type) to save the information. Other a reg like reg59. You can use a script call to replace the basic operation call. Up to you.
 
Thank you kalarhan, but I have made no progress on completing this task due to my incompetency.

I have no idea whether using the change gender code is a good idea. Not only this, but I have no idea where to put this code if I want the player to change race dependant of chosen faction.  :sad:

Thanks for the help though :smile:
 
Max2150 said:
I have no idea whether using the change gender code is a good idea. Not only this, but I have no idea where to put this code if I want the player to change race dependant of chosen faction.  :sad:

it works just fine, and it has being done several times over the years on many mods. If you want this feature to your mod, there is not tech-issue here.

Using the starting menu (or whatever you use) to apply the change works fine.

Extend the header_troops.py with your new types. Using a number like "3" or "5" will just lead to bugs and mistakes.

Native:
Code:
#Troop flags
tf_male           = 0
tf_female         = 1
tf_undead         = 2

 
Back
Top Bottom