Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I have a question about killing lords. I know Brytenwalda has implemented lord deaths, but I haven't really played around with that feature in the mod.

Say killing a faction leader, while the rest of the faction is still alive. What happens to the faction exactly?

Also, is it at all possible to implement a system whereby a faction leader has an adult heir represented as a lord, and if the faction leader dies, the heir takes over, and if the heir is already dead then it would pass to a random lord of that faction?

Additionally is it possible for faction leaders to have daughters/sons that can be married? I'm not familiar with the family system in Warband.
 
Scuba Steve said:
Say killing a faction leader, while the rest of the faction is still alive. What happens to the faction exactly?

Also, is it at all possible to implement a system whereby a faction leader has an adult heir represented as a lord, and if the faction leader dies, the heir takes over, and if the heir is already dead then it would pass to a random lord of that faction?

Additionally is it possible for faction leaders to have daughters/sons that can be married? I'm not familiar with the family system in Warband.

Native doesnt include nobles death. So if you "kill" one, it bugs the game. That is what happens lol. Of course you can just implement your own feature and then do any consequence you want with it. Kings and lords are just a troop ID related to the factions/centers. There is nothing hardcoded here stopping you from changing any of the rules.

That includes creating a family system for the king, heirs, marriage of kids, etc.
 
Dj_FRedy said:
I tried to adapt the script to multiplayer mode, now it works in agent_bots this way:
Code:
multiplayer_agent_hp_bar = (
	0, 0, 0,
		[],
		[
			(multiplayer_is_server),
			(start_presentation, "prsnt_multiplayer_agent_hp_bar"),
		])
Code:
multiplayer_agent_hp_bar,
Code:
	("multiplayer_agent_hp_bar", prsntf_read_only, 0,
		[
			(ti_on_presentation_load,
				[
					(set_fixed_point_multiplier, 1000),

					(get_max_players, ":num_players"),
					(try_for_range, ":player_no", 0, ":num_players"),
						(player_is_active, ":player_no"),
						(neg|player_is_busy_with_menus, ":player_no"),

						(player_get_team_no, ":player_team", ":player_no"),
						(lt, ":player_team", multi_team_spectator),

						(player_get_troop_id, ":player_troop", ":player_no"),
						(ge, ":player_troop", 0),

						(player_get_agent_id, ":player_agent", ":player_no"),
						(ge, ":player_agent", 0),

						(try_for_agents, ":agent_no"),
							(agent_is_human, ":agent_no"),
							(neq, ":agent_no", ":player_agent"),

							(try_begin),
								(agent_is_alive, ":agent_no"),
								(agent_get_team, ":agent_team", ":agent_no"),

								#hp bg
								(create_mesh_overlay, ":agent_hp_bg_overlay", "mesh_white_plane"),
								(overlay_set_alpha, ":agent_hp_bg_overlay", 0x44),
								(overlay_set_color, ":agent_hp_bg_overlay", 0x000000),

								#hp
								(create_mesh_overlay, ":agent_hp_overlay", "mesh_white_plane"),
								(overlay_set_alpha, ":agent_hp_overlay", 0x44),
								(try_begin),
									(eq, ":agent_team", ":player_team"),
									(overlay_set_color, ":agent_hp_overlay", 0x00FF00), #green
								(else_try),
									(overlay_set_color, ":agent_hp_overlay", 0xFF0000), #red
								(try_end),

								#size & position
								(agent_get_position, pos1, ":agent_no"),
								(agent_get_horse, ":horse_agent", ":agent_no"),
								(try_begin),
									(ge, ":horse_agent", 0),
									(position_move_z, pos1, 280, 1),
								(else_try),
									(position_move_z, pos1, 180, 1),
								(try_end),
								(position_get_screen_projection, pos2, pos1),
								(position_get_x, ":head_x_pos", pos2),
								(position_get_y, ":head_y_pos", pos2),

								#base size
								(copy_position, pos6, pos1),
								(copy_position, pos7, pos1),
								(position_move_z, pos7, 100, 1),
								(position_get_screen_projection, pos6, pos6),
								(position_get_screen_projection, pos7, pos7),
								(position_get_y, ":screen_y_pos_1", pos6),
								(position_get_y, ":screen_y_pos_2", pos7),
								(store_sub, ":base_x", ":screen_y_pos_2", ":screen_y_pos_1"),
								(val_clamp, ":base_x", 20, 161),
								(store_div, ":base_y", ":base_x", 20),
								(try_begin),
									(is_between, ":head_x_pos", -100, 1100),
									(is_between, ":head_y_pos", -100, 850),
									(agent_get_position, pos3, ":agent_no"),
									(agent_get_position, pos4, ":player_agent"),
									(get_distance_between_positions_in_meters, ":distance", pos3, pos4),
									#---------------------------------------------------------
									(le, ":distance", 80), #distance limit for showing HP bars
									#---------------------------------------------------------

									#agent no
									(agent_get_horse, ":horse_agent", ":agent_no"),
									(try_begin),
										(ge, ":horse_agent", 0),
										(position_move_z, pos3, 280, 1),
									(else_try),
										(position_move_z, pos3, 180, 1),
									(try_end),
									#player agent
									(agent_get_horse, ":player_horse", ":player_agent"),
									(try_begin),
										(ge, ":player_horse", 0),
										(position_move_z, pos4, 280, 1),
									(else_try),
										(position_move_z, pos4, 180, 1),
									(try_end),
									(position_move_z, pos3, 50, 1),
									(position_move_z, pos4, 50, 1),
									(position_has_line_of_sight_to_position, pos3, pos4),

									#hp bg
									(assign, ":x_offset", ":base_x"),
									(val_div, ":x_offset", 2),
									(val_add, ":x_offset", 1),
									(store_sub, ":hp_bg_x", ":head_x_pos", ":x_offset"),
									(store_sub, ":hp_bg_y", ":head_y_pos", 1),
									(position_set_x, pos1, ":hp_bg_x"),
									(position_set_y, pos1, ":hp_bg_y"),
									(overlay_set_position, ":agent_hp_bg_overlay", pos1),
									(store_add, ":bg_width", ":base_x", 2),
									(val_mul, ":bg_width", 50),
									(store_add, ":bg_height", ":base_y", 2),
									(val_mul, ":bg_height", 50),
									(position_set_x, pos1, ":bg_width"),
									(position_set_y, pos1, ":bg_height"),
									(overlay_set_size, ":agent_hp_bg_overlay", pos1),
									(overlay_set_alpha, ":agent_hp_bg_overlay", 0x66),

									#hp
									(store_add, ":hp_x", ":hp_bg_x", 1),
									(store_add, ":hp_y", ":hp_bg_y", 1),
									(position_set_x, pos1, ":hp_x"),
									(position_set_y, pos1, ":hp_y"),
									(overlay_set_position, ":agent_hp_overlay", pos1),
									(store_agent_hit_points, ":agent_hp", ":agent_no"),
									(store_mul, ":hp_width", ":agent_hp", 50),
									(val_mul, ":hp_width", ":base_x"),
									(val_div, ":hp_width", 100),
									(val_min, ":hp_width", ":bg_width"),
									(store_mul, ":hp_height", ":base_y", 50),
									(position_set_x, pos1, ":hp_width"),
									(position_set_y, pos1, ":hp_height"),
									(overlay_set_size, ":agent_hp_overlay", pos1),

									#text (disabled) showing hit points relative
									# (assign, reg7, ":agent_hp"),
									# (create_text_overlay, ":agent_hp_overlay", "@_{reg7}_", tf_center_justify|tf_with_outline),
									# (overlay_set_alpha, ":agent_hp_overlay", 0x44),
									# (try_begin),
										# (eq, ":agent_team", ":player_team"),
										# (overlay_set_color, ":agent_hp_overlay", 0x00FF00), #green
									# (else_try),
										# (overlay_set_color, ":agent_hp_overlay", 0xFF0000), #red
									# (try_end),
									# (position_set_x, pos1, ":hp_bg_x"),
									# (position_set_y, pos1, ":hp_bg_y"),
									# (overlay_set_position, ":agent_hp_overlay", pos1),
									# (position_set_x, pos1, 400),
									# (position_set_y, pos1, 400),
									# (overlay_set_size, ":agent_hp_overlay", pos1),

								(else_try),
									(overlay_set_alpha, ":agent_hp_bg_overlay", 0),
									(overlay_set_alpha, ":agent_hp_overlay", 0),
								(try_end),
							(try_end),
						(try_end),
					(try_end),
				]
			),
		]
	),
I have removed the slots in case you want to delete them from 'module_constants'.
You only start that presentation on the server machine itself, which makes no sense as you want to display it on client's.
When you host a server from within the game, you're the server and client at the same time, that's why it works for you, but for all other players it won't work ofc.
So make sure that you only start the presentation client side;
Code:
(neg|multiplayer_is_dedicated_server),

The player loop in your presentation code is totally pointless and will create health bars for all agents multiple times (as many times as players are on the server).
Remove the player loop, you don't need it at all.
 
I only tested the block on my local server, hence my comment from in agent_bots. I still have a lot to learn about operations used in multiplayer mode, not to mention that I know very little about how it works,  but I'm always open to new knowledge, although the singleplayer is what interests me most.

As for the player loop, a test with some more human player and I would have noticed, still, I think @mahachohan was doing it for personal/local... use, he can confirm it and if not, then we improve the block/presentation.
 
A couple of questions:
1) I've reactivated the Salt Mine, readded Galeas, he works as he should, but Barezan (the salt merchant) doesn't renew his inventory. Where/ what is the appropriate script for it?
2) I've reactivated the Four Ways Inn and made the Praven tavern scene to open when I enter it. The scene has a tavernkeeper and all the furniture, but is otherwise empty. Where do I go about making all the regular npcs to spawn here like in a regular tavern?
3) Is there a way to add team selection to tournaments without installing the tournament mini-mod? I can't figure how to set up mod-merger properly, plus I don't want all the proposed features anyway.

Thanks in advance!
 
Right now I don't have much time to answer, but I will give you a clue so that you can go by pulling the ball of wool:

1) script_refresh_center_inventories. Look at the slot: slot_town_merchant, at the beginning of the game(script_game_start) each merchant is assigned to this slot, armorer to slot_town_armorer, weaponsmith to slot_town_weaponsmith, etc.
2) Edit the scene and make sure you have the corresponding entry_points for the tavern scene.
3) menu town_tournament, script_set_items_for_tournament
 
I created my custom lord and a custom Castle. How to appoint the newly created lord to own that new custom Castle?
 
HelrothHyrmir said:
I created my custom lord and a custom Castle. How to appoint the newly created lord to own that new custom Castle?

Code:
########################################################
##  PARTY SLOTS            #############################
########################################################

slot_town_lord                 = 7

see script
Code:
  # script_give_center_to_lord
  # Input: arg1 = center_no, arg2 = lord_troop, arg3 = add_garrison_to_center
  ("give_center_to_lord",
    [
 
Hey guys! I'm trying to make my first mod, and so far none of the changes I make to the modules in my ModuleSystem folder are showing up. For instance I went in module_troops.py and changed King Harlaus' name, and I made sure that it was his in-game name and not the name that he is referenced with, but it wouldn't show up.  I tried a whole bunch of variations of this to no avail.  Also, when I run the build_module batch file, it compiles with no errors and is to the correct directory. I'm guessing I'm missing some little thing, that once I figure out what it is I can modify/add pretty much anything.

I've been following The Ultimate Introduction to Modding by Lumos. https://forums.taleworlds.com/index.php?topic=240255.0 Any help would be much appreciated! Thanks!
 
AshlegFoulke said:
Hey guys! I'm trying to make my first mod, and so far none of the changes I make to the modules in my ModuleSystem folder are showing up. For instance I went in module_troops.py and changed King Harlaus' name, and I made sure that it was his in-game name and not the name that he is referenced with, but it wouldn't show up.  I tried a whole bunch of variations of this to no avail.  Also, when I run the build_module batch file, it compiles with no errors and is to the correct directory. I'm guessing I'm missing some little thing, that once I figure out what it is I can modify/add pretty much anything.

I've been following The Ultimate Introduction to Modding by Lumos. https://forums.taleworlds.com/index.php?topic=240255.0 Any help would be much appreciated! Thanks!
Are you sure that you are compiling into the correct module path and are loading the correct module (sounds stupid and is a misstake which of course never happened to me  :mrgreen:)
Also, if you are loading the game in a different language than english, the edited name doesn't show up since you replaced his english name. For the translations you have to check the language folders.
That are my first two thoughts for now.
 
AshlegFoulke said:
none of the changes I make to the modules in my ModuleSystem folder are showing up.
open your module folder and check the files date and time. As they are destroyed and created anew when you compile the code, that date needs to match it.

-> game folder/modules/mymod/scripts.txt    date=Today time=1 minute ago

if not see answer above and review the tutorial you linked on how to setup module_info.py, plus check your OS settings.

AshlegFoulke said:
it compiles with no errors and is to the correct directory
dont tell us, show us. Copy the compilation log and post it here. Also shows a picture of the module folder.

-> common newbie mistake: check if you saved your source file module_troops.py. Notepad++, as a example, requires manual saving, otherwise your changes wont do anything.

AshlegFoulke said:
I can modify/add pretty much anything.
that is the spirit
 
Thanks for your quick and helpful responses!

While following your suggestions, I checked and re-checked my module_info.py, and I had backward slashes in the path rather than forward slashes. I changed that, and it seemed to fix the problem!

Looking back, I see that many guides and the module_info itself tell you to do this, so I'll make sure to read the instructions more carefully next time! :mrgreen:

2hXamej
(hope that image link works lol)
 
Hi guys
I have short and quick questions, how can I make the battle-maps bigger, and disable the stat loss after 757 in game days? (without tweakmb, but with the modulesys)


Thanks in advance


EDIT: Nvm. I found out.
 
Hello

does anyone know if it is possible to change an alarmed agent with weapon draw to not alarmed and to sheathe his weapon?

Operation agent_set_is_alarmed doesn't work, and operation agent_ai_set_aggressiveness neither.
 
What is the function of "Ancestor_seed" exactly?

Code:
		(try_begin),
			(is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"),
			(store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"),
			(assign, ":ancestor_seed", 1),
 
HelrothHyrmir said:
What is the function of "Ancestor_seed" exactly?

its just a variable with that name. What is it suppose to do? That depends on the code you are looking at, so check how it is used.

the basic idea seems to help create random relation (who a troop father is) inside a kingdom. But between the idea and the execution ... lol

you can also just forget this and use a direct call like

Code:
      (troop_set_slot, "trp_knight_2_5", slot_troop_father, "trp_knight_2_4"), # 4 is father of 5
      (troop_set_slot, "trp_knight_2_5", slot_troop_mother, "trp_kingdom_2_lady_2"), # 2 is mother of 5

as in the end is just a value inside a slot
 
kalarhan said:
HelrothHyrmir said:
What is the function of "Ancestor_seed" exactly?

its just a variable with that name. What is it suppose to do? That depends on the code you are looking at, so check how it is used.

the basic idea seems to help create random relation (who a troop father is) inside a kingdom. But between the idea and the execution ... lol

you can also just forget this and use a direct call like

Code:
      (troop_set_slot, "trp_knight_2_5", slot_troop_father, "trp_knight_2_4"), # 4 is father of 5
      (troop_set_slot, "trp_knight_2_5", slot_troop_mother, "trp_kingdom_2_lady_2"), # 2 is mother of 5

as in the end is just a value inside a slot

Ah, that should help a lot! Thank you!
 
Status
Not open for further replies.
Back
Top Bottom