Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Where in ModSys can I find the part that governs the display "delivered X damage" or "delivered X damage to horse"? I looked through all the relevant modules and didn't find it. I'm trying to add a third category for a specific type of horse (camel).
 
how can i mod battle size persistently? I mean like VC, without requiring battle sizer or editing rgl_config.  Adding "battle_size_min=100  battle_size_max=500" lines to module.ini changes only the values seeming on the slider in game options and doesn't affect the game.
 
kalarhan said:
litdum said:
how can i mod battle size persistently?

see https://forums.taleworlds.com/index.php/topic,359437.msg8629841.html#msg8629841, should help understand how it works.
Thank you very much! and of course also to Leonion.  It works. The only thing i cannot figure is:
Leonion said:
For example, you can multiple all necessary values in mission_templates by 4 and then, to make numbers in "Options" fit the reality of field battles, you will need to set battle_size_min = 120 and battle_size_max = 504, but the BS in sieges will still be different.
How did he find 504 for battle_size_max? Shoudn't it be 150x4=600? Is it an unimportant mistake or does it make any sense?
 
I changed module_items.py by assigning a bunch of weapons and armors to specific factions. However, when I try to compile, I get an error where process_operations fails to import module_items - saying there is a syntax error on line 2310 of module_items. Problem is, module_items has 2309 lines of code. Any ideas what's going on?
 
Quick question to everybody,

If one wants to mimic the way firearms have different sounds at different distances like in WFaS, The Deluge or L'aigle, where would one proceed to do that especially for singleplayer(and maybe multiplayer for later :lol:)and why?

I ask this since I've been bothered by how even at the end of a map I can hear the firing sound like it was a few feet away from me and this have been something that I've always wanted to fix since I started modding Warband from modding WFaS and I've been trying to tackle this issue of mine for the past few days without and success other than tidying up my game_missile_launch script to be less blocky and bit as organized as the NW version.

Anyways my only assumption is either the mission_templates or the game_missile_launch script.
 
Hello everyone.

Could anyone tell what shader types there are for armours?
Some armours I am currently testing have weird shader
issues like some part being almost white.
 
Mike12096 said:
Quick question to everybody,

If one wants to mimic the way firearms have different sounds at different distances like in WFaS, The Deluge or L'aigle, where would one proceed to do that especially for singleplayer(and maybe multiplayer for later :lol:)and why?

I ask this since I've been bothered by how even at the end of a map I can hear the firing sound like it was a few feet away from me and this have been something that I've always wanted to fix since I started modding Warband from modding WFaS and I've been trying to tackle this issue of mine for the past few days without and success other than tidying up my game_missile_launch script to be less blocky and bit as organized as the NW version.

Anyways my only assumption is either the mission_templates or the game_missile_launch script.
game_missile_launch is the way to go.
Just get the distance between the weapon and mission cam and play different sounds according to that distance, that's it.
 
Can someone tell me how face textures work? I edited module_skins to reactivate old faces, and the new options appeared in the game, but they're all white (meaning they're missing textures) despite me adding the textures to the textures folder. How do I make the head mesh "see" the textures? :???:
 
Hey folks,

I've been thinking about ways to make magic work, and I was wondering if something like this would be possible;

Lets say we have a Throwing item, Fireball. Can we make it so when a troop equips the item, they set their Power Throw to 0 and adjusts their Throwing skill to, say, their Firearms skill? And then when they switch to something other than Fireball (or Ice Shard or whatever other magic items there are), their Throwing skill and Power Throw is returned to normal?

And would that be done in scripts, simple_triggers, or mission_templates? Or a combination of them?
 
TheCaitularity said:
And would that be done in scripts, simple_triggers, or mission_templates? Or a combination of them?

you need to review the basic tutorials, as you are mixing concepts that are not compatible above.

world map / campaign is one thingy. Events on that part are handled from simple triggers/triggers files, plus others like map icons, etc

scenes is another thingy. Mission template handles the events on them. You also have events for items, props, etc, only on scenes (they dont make sense on the campaign).

scripts are either reusable pieces of code OR hooks for the engine. You can call them from anywhere, but the operations you are using need to be within the current context (scene X campaign).

UI is a mixed bag so lets skip that for now haha.


With all that said you need to study the difference between a TROOP and a AGENT, then check the operations available for AGENTS and see what you can do around skills and weapons used by AGENTS. Probably the easiest solution is to remove a weapon to force the use of the other, but you can also work around the AI or the engine rules if you want to.
 
_Sebastian_ said:
Mike12096 said:
Quick question to everybody,

If one wants to mimic the way firearms have different sounds at different distances like in WFaS, The Deluge or L'aigle, where would one proceed to do that especially for singleplayer(and maybe multiplayer for later :lol:)and why?

I ask this since I've been bothered by how even at the end of a map I can hear the firing sound like it was a few feet away from me and this have been something that I've always wanted to fix since I started modding Warband from modding WFaS and I've been trying to tackle this issue of mine for the past few days without and success other than tidying up my game_missile_launch script to be less blocky and bit as organized as the NW version.

Anyways my only assumption is either the mission_templates or the game_missile_launch script.
game_missile_launch is the way to go.
Just get the distance between the weapon and mission cam and play different sounds according to that distance, that's it.

Simple as that?

Well I have tried to do what you said recently however I am somewhat struggling on how to do so as I've thought of many ways of implementing that like using a call script within game_missile_launch in the particle effects part/the weapon items part or perhaps using some slots to assign. There is also the problem where once I implement it and have the game compile without problems I get the firearms to use the default crossbow firing sound upon firing as if assigning them to another sound became non-existent.

Here is what I have as my Game_missile_launch if anyone wants to have a crack at it along with that other script that's being called within game_missile_launch.

Game_Missile_Launch
Code:
  # script_game_missile_launch
  # Input: arg1 = shooter_agent_id, arg2 = weapon_item_id, pos1 = weapon_item_position
  # Output: none 
  ("game_missile_launch",
    [ 
	(store_script_param, ":item_id", 2),
	(try_begin),
			(gt, ":item_id", -1),
			(item_get_type, ":item_type", ":item_id"),
		(try_begin),
		  (neg|multiplayer_is_dedicated_server),#only client side
			(try_begin),
			(is_between, ":item_type", itp_type_crossbow, itp_type_musket),
			(assign, ":flashpan_pos_x", 0),
			(assign, ":flashpan_pos_y", 0),
			(assign, ":flashpan_pos_z", 0),
			(assign, ":muzzle_pos_x", 0),
			(assign, ":muzzle_pos_y", 0),
			(assign, ":muzzle_pos_z", 0),
				(try_begin),
				(is_between, ":item_id", "itm_arquebus", "itm_cross_foot_musket_1b_melee"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 12),
				(assign, ":muzzle_pos_x", 1.7),
				(assign, ":muzzle_pos_y", 115),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(this_or_next|eq, ":item_id", "itm_tutorial_crossbow"),
				(eq, ":item_id", "itm_practice_crossbow"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 12),
				(assign, ":muzzle_pos_x", 1.7),
				(assign, ":muzzle_pos_y", 115),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(is_between, ":item_id", "itm_flintlock_pistol_brown", "itm_torch"),
				(assign, ":flashpan_pos_x", 2),
				(assign, ":flashpan_pos_y", 13),
				(assign, ":muzzle_pos_x", 28),
				(assign, ":muzzle_pos_y", 34),
				(eq, ":item_id", itp_type_pistol),
				(else_try),
				(is_between, ":item_id", "itm_mamluk_old_matchlock", "itm_flintlock_pistol_brown"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 14),
				(assign, ":muzzle_pos_x", 1.2),
				(assign, ":muzzle_pos_y", 118),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(is_between, ":item_id", "itm_flintlock_carbine_red", "itm_swadian_carbine_1"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 13),
				(assign, ":muzzle_pos_x", 1.2),
				(assign, ":muzzle_pos_y", 100),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(is_between, ":item_id", "itm_nord_carbine_1", "itm_mamluk_old_matchlock"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 14),
				(assign, ":muzzle_pos_x", 1.3),
				(assign, ":muzzle_pos_y", 105),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(is_between, ":item_id", "itm_swadian_carbine_1", "itm_cross_carbine_1"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 15),
				(assign, ":muzzle_pos_x", 1.8),
				(assign, ":muzzle_pos_y", 110),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(is_between, ":item_id", "itm_cross_carbine_1", "itm_nord_carbine_1"),
				(assign, ":flashpan_pos_x", -4),
				(assign, ":flashpan_pos_y", 12),
				(assign, ":muzzle_pos_x", 1.4),
				(assign, ":muzzle_pos_y", 110),
				(eq, ":item_id", itp_type_crossbow),
				(else_try),
				(eq, ":item_id", "itm_wheellock_carbine"),
				(assign, ":flashpan_pos_x", -3),
				(assign, ":flashpan_pos_y", 13),
				(assign, ":muzzle_pos_x", 0),
				(assign, ":muzzle_pos_y", 83),
				(eq, ":item_id", itp_type_crossbow),
				(try_end),
				#(call_script, "script_oim_on_musket_on_attack", itp_type_musket, 0, 83, -3, -69), #actual positions 0, 83, -3, 14
				#(try_begin),
				#(eq, ":item_type", itp_type_crossbow),		  
				#(val_sub, ":muzzle_pos_x", 8),#this is needed, because the particles dont appear at the correct position
				#(val_sub, ":flashpan_pos_x", 8),#this is needed, because the particles dont appear at the correct position
				#(val_sub, ":muzzle_pos_z", 3),#this is needed, because the particles dont appear at the correct position
				#(val_sub, ":flashpan_pos_z", 3),#this is needed, because the particles dont appear at the correct position
				#(try_end),
					
				(set_fixed_point_multiplier, 100),
				(copy_position, pos2, pos1),
				(position_move_x, pos1, ":flashpan_pos_x"),
				(position_move_y, pos1, ":flashpan_pos_y"),
				(position_move_z, pos1, ":flashpan_pos_z"),

				(position_move_x, pos2, ":muzzle_pos_x"),
				(position_move_y, pos2, ":muzzle_pos_y"),
				(position_move_z, pos2, ":muzzle_pos_z"),
				
				(particle_system_burst_no_sync, "psys_oim_musket_powder_a", pos1, 8),#was 1
				(particle_system_burst_no_sync, "psys_oim_pistol_powder_b", pos1, 15),#was 10
				(assign, ":sound_id", -1),#NW code
				(try_begin),#pistol/musket
					(eq, ":item_type", itp_type_pistol),
					#(position_rotate_z, pos1, -45),
					#(position_rotate_z, pos2, -45),
					(particle_system_burst_no_sync, "psys_oim_pistol_smoke", pos2, 8),
					(particle_system_burst_no_sync, "psys_oim_pistol_fire", pos2, 8),
					(particle_system_burst_no_sync, "psys_oim_pistol_flash", pos2, 8),
					(assign, ":sound_id", "snd_release_pistol"),
					#(copy_position, pos60, pos2),
					#(call_script, "script_firearm_sound_at_x_distance", itp_type_pistol, "snd_release_musket"),
				(else_try),
					(eq, ":item_type", itp_type_crossbow),
					(particle_system_burst_no_sync, "psys_oim_musket_smoke", pos2, 8),
					(particle_system_burst_no_sync, "psys_oim_musket_fire", pos2, 8),
					(particle_system_burst_no_sync, "psys_oim_musket_flash", pos2, 8),
					(assign, ":sound_id", "snd_release_musket"),
					#(copy_position, pos60, pos2),
					#(call_script, "script_firearm_sound_at_x_distance", itp_type_crossbow, "snd_release_musket"),
				(try_end),
				(gt, ":sound_id", -1),#NW code
				(play_sound_at_position, ":sound_id", pos2),#NW code
			#(copy_position, pos60, pos2),
			#(call_script, "script_firearm_sound_at_x_distance", itp_type_crossbow, "snd_release_musket"),
			#(call_script, "script_firearm_sound_at_x_distance", itp_type_pistol, "snd_release_pistol"),
				#(call_script, "script_multiplayer_server_play_sound_at_position", "snd_release_musket"),
		(try_end),
	(try_end),    
 ]),

Firearm_sound_at_x_distance
Code:
	# script_firearm_sound_at_x_distance
	# input: 
	#		type (pistol or musket),
	#		sound_id
	#		pos2 (muzzle),
	#		pos60(mission_camera_position)
	# output: none

	("firearm_sound_at_x_distance",
	[
	 (store_script_param, ":item_type", 1),
	 (store_script_param, ":sound_id", 2),
		(try_begin),
			#(is_between, ":sound_id", 0, "snd_sounds_end"),
			(mission_cam_get_position, pos60),
			(get_distance_between_positions_in_meters, ":distance", pos60, pos2),
			(is_between, ":item_type", itp_type_crossbow, itp_type_musket),
			(assign, ":sound_id", -1),
			(try_begin),
				#(eq, ":item_type", itp_type_crossbow),
				#(try_for_range, ":distance", 0, 50),
				#(le, ":distance", 50),
				#(assign, ":sound_id", "snd_release_musket"),
			#(else_try),
				(eq, ":item_type", itp_type_crossbow),
				(try_for_range, ":distance", 50, 1000),
				(le, ":distance", 200),
				(assign, ":sound_id", "snd_release_musket_medium"),
				(le, ":distance", 1000),
				(assign, ":sound_id", "snd_release_musket_far"),
			(else_try),
				(eq, ":item_type", itp_type_pistol),
				(try_for_range, ":distance", 50, 1000),
				(le, ":distance", 200),
				(assign, ":sound_id", "snd_release_pistol_medium"),
				(le, ":distance", 1000),
				(assign, ":sound_id", "snd_release_pistol_far"),
			(try_end),
		(gt, ":sound_id", -1),
		(play_sound_at_position, ":sound_id", pos2),
		(try_end),
	]), 
 
Well the game plays the crossbow sound because most of your firearms are handled as crossbow's, so make them a musket item type and change your condition checks accordingly.

Code:
(try_for_range, ":distance", 50, 1000),
(le, ":distance", 200),
(assign, ":sound_id", "snd_release_musket_medium"),
(le, ":distance", 1000),
(assign, ":sound_id", "snd_release_musket_far"),
What are you doing here?
You create a damn long non-sense loop (which you actually never close properly) and then you check if the current loop's iteration is <= 200.... the second check will also always never fail.
 
_Sebastian_ said:
Well the game plays the crossbow sound because most of your firearms are handled as crossbow's, so make them a musket item type and change your condition checks accordingly.

Code:
(try_for_range, ":distance", 50, 1000),
(le, ":distance", 200),
(assign, ":sound_id", "snd_release_musket_medium"),
(le, ":distance", 1000),
(assign, ":sound_id", "snd_release_musket_far"),
What are you doing here?
You create a damn long non-sense loop (which you actually never close properly) and then you check if the current loop's iteration is <= 200.... the second check will also always never fail.

Well, playing with this black geometry isn't my forte as for why I have my firearms as itp_type_crossbow is kinda simple, Vertex mesh animation. If I use the itp_type_musket/pistol they would never show the hammer striking the lock into the pan hence why they are as they are.

Also I just believed I've fixed my problem just now.

Code:
	# script_firearm_sound_at_x_distance
	# input: 
	#		type (pistol or musket),
	#		sound_id
	#		pos2 (muzzle),
	#		pos60(mission_camera_position)
	# output: none

	("firearm_sound_at_x_distance",
	[
	 (store_script_param, ":item_type", 1),
	 (store_script_param, ":sound_id", 2),
		(try_begin),
			#(is_between, ":sound_id", 0, "snd_sounds_end"),
			(mission_cam_get_position, pos60),
			(get_distance_between_positions_in_meters, ":distance", pos60, pos2),
			(is_between, ":item_type", itp_type_crossbow, itp_type_musket),
			(assign, ":sound_id", -1),
			(try_begin),
				(eq, ":item_type", itp_type_crossbow),
				(is_between, ":distance", 0, 50),
				#(try_for_range, ":distance", 0, 50),
				(le, ":distance", 50),
				(assign, ":sound_id", "snd_release_musket"),
			(else_try),
				(eq, ":item_type", itp_type_crossbow),
				(is_between, ":distance", 50, 200),
				#(try_for_range, ":distance", 50, 200),
				(le, ":distance", 200),
				(assign, ":sound_id", "snd_release_musket_medium"),
			(else_try),
				(eq, ":item_type", itp_type_crossbow),
				(is_between, ":distance", 200, 1000),
				#(try_for_range, ":distance", 200, 1000),
				(le, ":distance", 1000),
				(assign, ":sound_id", "snd_release_musket_far"),
			(else_try),
				(eq, ":item_type", itp_type_pistol),
				(is_between, ":distance", 0, 50),
				(le, ":distance", 50),
				(assign, ":sound_id", "snd_release_pistol"),
			(else_try),
				(eq, ":item_type", itp_type_pistol),
				(is_between, ":distance", 50, 200),
				#(try_for_range, ":distance", 50, 200),
				(le, ":distance", 200),
				(assign, ":sound_id", "snd_release_pistol_medium"),
			(else_try),
				(eq, ":item_type", itp_type_pistol),
				(is_between, ":distance", 200, 1000),
				(le, ":distance", 1000),
				(assign, ":sound_id", "snd_release_pistol_far"),
			(try_end),
		(gt, ":sound_id", -1),
		(play_sound_at_position, ":sound_id", pos2),
		(try_end),
	]), 

EDIT: Apparently it needs a bit more work as now my guys at certain distances from where the player is won't have a firing sound but yeah it still functions.
 
@Mike12096
I was writing an answer and you just fixed some stuff :grin:
It looks better but with dumping some unnecessary stuff you can do this:

Firearm_sound_at_x_distance
Code:
	# script_firearm_sound_at_x_distance
	# input: 
	#		type (pistol or musket),
	#		pos2 (muzzle),
	#		pos60(mission_camera_position)
	# output: none

	("firearm_sound_at_x_distance",
	[
		(store_script_param_1, ":item_type"),
		(mission_cam_get_position, pos60),
		(get_distance_between_positions_in_meters, ":distance", pos60, pos2),
		(assign, ":sound_id", -1),
		(try_begin),
			(eq, ":item_type", itp_type_crossbow),
			(try_begin),
				(le, ":distance", 50),
				(assign, ":sound_id", "snd_release_musket"),
			(else_try),
				(le, ":distance", 200),
				(assign, ":sound_id", "snd_release_musket_medium"),
			(else_try),
				(le, ":distance", 1000),
				(assign, ":sound_id", "snd_release_musket_far"),
			(try_end),
		(else_try),
			(eq, ":item_type", itp_type_pistol),
			(try_begin),
				(le, ":distance", 200),
				(assign, ":sound_id", "snd_release_pistol_medium"),
			(else_try),
				(le, ":distance", 1000),
				(assign, ":sound_id", "snd_release_pistol_far"),
			(try_end),
		(try_end),
		(try_begin),
			(gt, ":sound_id", -1),
			(play_sound_at_position, ":sound_id", pos2),
		(try_end),
	]),

And a remainder, never leave can-fail statements out of try blocks like you did at the end. They crash the code  :dead:
 
Status
Not open for further replies.
Back
Top Bottom