Modding Q&A [For Quick Questions and Answers]

正在查看此主题的用户

状态
不接受进一步回复。
Hi guys. I am still wainting for my mod to be authorised at moddb so I use my free time to search for errors. So have found something which is serious I am afraid.

How to find which script is not working well if I got such kind of message:
script error on opcode 101 Invalid Party ID 395 line no 122 At game Triggers trigger no 23 consequences

in partyID my last party is
插入代码块:
p_reserved_5 = 252
- how to identify opcode 101? and this trigger no23?

 
MadGuarang 说:
in partyID my last party is
插入代码块:
p_reserved_5 = 252
- how to identify opcode 101? and this trigger no23?

1) If the error is on worldmap you are looking for module_triggers.py or module_simple_triggers.py. Message will let you know
2) If the error is on a mission/scene then look at mission_templates, unless it is a error related to items/props (message will also let you know)

TLDR: you need to read the error message and follow the instructions

3) open header_operations.py (download Lav's modules) and look for the number 101. That will lead you to the correct operation name.

4) Line 122: count from zero (line 0, line 1, ...) until you find line 122

5) Trigger 23: same deal (trigger 0, trigger 1, ...) until you find trigger 23. If its from a mission template you may need to look at your .txt file first.

6) Parties don't stop at the end of module_parties.py. All the dynamic ones you see in the game (like caravans, bandits, etc) also have a ID (number).
 
Well, let's see:

opcode 101 is a
插入代码块:
hero_can_join                         =  101  # (hero_can_join, [party_id]),

the error was on the world map, so it has to be module_triggers. Because it is the only place it has formula "hero_can_join" at:
插入代码块:
(hero_can_join, ":npc"),
in the trigger:
插入代码块:
#Process morale and determine personality clashes
  (0, 0, 24,
   [],
[

#Count NPCs in party and get the "grievance divisor", which determines how fast grievances go away
#Set their relation to the player
        (assign, ":npcs_in_party", 0),
        (assign, ":grievance_divisor", 100),
        (try_for_range, ":npc1", companions_begin, companions_end),
            (main_party_has_troop, ":npc1"),
            (val_add, ":npcs_in_party", 1),
        (try_end),
        (val_sub, ":grievance_divisor", ":npcs_in_party"),
        (store_skill_level, ":persuasion_level", "skl_persuasion", "trp_player"),
        (val_add, ":grievance_divisor", ":persuasion_level"),
        (assign, reg7, ":grievance_divisor"),

#        (display_message, "@{!}Process NPC changes. GD: {reg7}"),



##Activate personality clash from 24 hours ago
        (try_begin), #scheduled personality clashes require at least 24hrs together
             (gt, "$personality_clash_after_24_hrs", 0),
             (eq, "$disable_npc_complaints", 0),
             (try_begin),
                  (troop_get_slot, ":other_npc", "$personality_clash_after_24_hrs", slot_troop_personalityclash_object),
                  (main_party_has_troop, "$personality_clash_after_24_hrs"),
                  (main_party_has_troop, ":other_npc"),
                  (assign, "$npc_with_personality_clash", "$personality_clash_after_24_hrs"),
             (try_end),
             (assign, "$personality_clash_after_24_hrs", 0),
        (try_end),
#

         
        (try_for_range, ":npc", companions_begin, companions_end),
###Reset meeting variables
            (troop_set_slot, ":npc", slot_troop_turned_down_twice, 0),
            (try_begin),
                (troop_slot_eq, ":npc", slot_troop_met, 1),
                (troop_set_slot, ":npc", slot_troop_met_previously, 1),
            (try_end),

###Check for coming out of retirement
            (troop_get_slot, ":occupation", ":npc", slot_troop_occupation),
            (try_begin),
                (eq, ":occupation", slto_retirement),
                (troop_get_slot, ":renown_min", ":npc", slot_troop_return_renown),

                (str_store_troop_name, s31, ":npc"),
                (troop_get_slot, ":player_renown", "trp_player", slot_troop_renown),
                (assign, reg4, ":player_renown"),
                (assign, reg5, ":renown_min"),
#                (display_message, "@{!}Test {s31}  for retirement return {reg4}, {reg5}."),

                (gt, ":player_renown", ":renown_min"),
                (troop_set_slot, ":npc", slot_troop_personalityclash_penalties, 0),
                (troop_set_slot, ":npc", slot_troop_morality_penalties, 0),
                (troop_set_slot, ":npc", slot_troop_occupation, 0),
            (try_end),


#Check for political issues
			(try_begin), #does npc's opponent pipe up?
				(troop_slot_ge, ":npc", slot_troop_days_on_mission, 5),
				(troop_slot_eq, ":npc", slot_troop_current_mission, npc_mission_kingsupport),

				(troop_get_slot, ":other_npc", ":npc", slot_troop_kingsupport_opponent),
				(troop_slot_eq, ":other_npc", slot_troop_kingsupport_objection_state, 0),
				
				(troop_set_slot, ":other_npc", slot_troop_kingsupport_objection_state, 1),
				
				(str_store_troop_name, s3, ":npc"),
				(str_store_troop_name, s4, ":other_npc"),

				(try_begin),
					(eq, "$cheat_mode", 1),
					(display_message, "str_s4_ready_to_voice_objection_to_s3s_mission_if_in_party"),
				(try_end),
			(try_end),

			#Check for quitting
            (try_begin),
                (main_party_has_troop, ":npc"),
				
                (call_script, "script_npc_morale", ":npc"),
                (assign, ":npc_morale", reg0),

                (try_begin),
                    (lt, ":npc_morale", 20),
                    (store_random_in_range, ":random", 0, 100),
                    (val_add, ":npc_morale", ":random"),
                    (lt, ":npc_morale", 20),
                    (assign, "$npc_is_quitting", ":npc"),
                (try_end),

				#Reduce grievance over time (or augment, if party is overcrowded
                (troop_get_slot, ":grievance", ":npc", slot_troop_personalityclash_penalties),
                (val_mul, ":grievance", 90),
                (val_div, ":grievance", ":grievance_divisor"),
                (troop_set_slot, ":npc", slot_troop_personalityclash_penalties, ":grievance"),

                (troop_get_slot, ":grievance", ":npc", slot_troop_morality_penalties),
                (val_mul, ":grievance", 90),
                (val_div, ":grievance", ":grievance_divisor"),
                (troop_set_slot, ":npc", slot_troop_morality_penalties, ":grievance"),


				#Change personality grievance levels
                (try_begin),
                    (this_or_next|troop_slot_ge, ":npc", slot_troop_personalityclash_state, 1),
                        (eq, "$disable_npc_complaints", 1),
                    (troop_get_slot, ":object", ":npc", slot_troop_personalityclash_object),
                    (main_party_has_troop, ":object"),
                    (call_script, "script_reduce_companion_morale_for_clash", ":npc", ":object", slot_troop_personalityclash_state),
                (try_end),
                (try_begin),
                    (this_or_next|troop_slot_ge, ":npc", slot_troop_personalityclash2_state, 1),
                        (eq, "$disable_npc_complaints", 1),
                    (troop_get_slot, ":object", ":npc", slot_troop_personalityclash2_object),
                    (main_party_has_troop, ":object"),
                    (call_script, "script_reduce_companion_morale_for_clash", ":npc", ":object", slot_troop_personalityclash2_state),
                (try_end),
                (try_begin),
                    (this_or_next|troop_slot_ge, ":npc", slot_troop_personalitymatch_state, 1),
                        (eq, "$disable_npc_complaints", 1),
                    (troop_get_slot, ":object", ":npc", slot_troop_personalitymatch_object),
                    (main_party_has_troop, ":object"),
                    (troop_get_slot, ":grievance", ":npc", slot_troop_personalityclash_penalties),
                    (val_mul, ":grievance", 9),
                    (val_div, ":grievance", 10),
                    (troop_set_slot, ":npc", slot_troop_personalityclash_penalties, ":grievance"),
                (try_end),


				
#Check for new personality clashes

				#Active personality clash 1 if at least 24 hours have passed
                (try_begin),
                    (eq, "$disable_npc_complaints", 0),
                    (eq, "$npc_with_personality_clash", 0),
                    (eq, "$npc_with_personality_clash_2", 0),
                    (eq, "$personality_clash_after_24_hrs", 0),
                    (troop_slot_eq, ":npc", slot_troop_personalityclash_state, 0),
                    (troop_get_slot, ":other_npc", ":npc", slot_troop_personalityclash_object),
                    (main_party_has_troop, ":other_npc"),
                    (assign, "$personality_clash_after_24_hrs", ":npc"),
                (try_end),

				#Personality clash 2 and personality match is triggered by battles
				(try_begin),
					(eq, "$npc_with_political_grievance", 0),
				
					(troop_slot_eq, ":npc", slot_troop_kingsupport_objection_state, 1),
					(assign, "$npc_with_political_grievance", ":npc"),
				(try_end),

			#main party does not have troop, and the troop is a companion
			(else_try), 
				(neg|main_party_has_troop, ":npc"),
				(eq, ":occupation", slto_player_companion),

				
				(troop_get_slot, ":days_on_mission", ":npc", slot_troop_days_on_mission),
				(try_begin),
					(gt, ":days_on_mission", 0),
					(val_sub, ":days_on_mission", 1),
					(troop_set_slot, ":npc", slot_troop_days_on_mission, ":days_on_mission"),
				(else_try), 
					(troop_slot_ge, ":npc", slot_troop_current_mission, 1),
					
					#If the hero can join
					(this_or_next|neg|troop_slot_eq, ":npc", slot_troop_current_mission, npc_mission_rejoin_when_possible),
						(hero_can_join, ":npc"),
						
					(assign, "$npc_to_rejoin_party", ":npc"),
				(try_end),
            (try_end),
        (try_end),
    ]),

however now I am not sure how to find a trigger (possibly I don't understand because of my poor english).

If I count from 0 to 122 -> after "(hero_can_join, ":npc")," ??? should I look up or down? I should count every line, even empty or every one?

Thanks to somebody and kalarhan solved! Answer below. Thank you guys!
 
MadGuarang 说:
however now I am not sure how to find a trigger (possibly I don't understand because of my poor english).

If I count from 0 to 122 -> after "(hero_can_join, ":npc")," ??? should I look up or down? I should count every line, even empty or every one?

well you don't need it anymore, but it is important to learn the how for future issues:

1) find the trigger: count the triggers on module_triggers.py until you find #22. First is #0. Second is #1...

2) line of code: each command (operation + parameters) counts as a "line". Comments, empty lines, etc, won't count. A comment is a line that starts with #, like
插入代码块:
#Personality clash 2 and personality match is triggered by battles

插入代码块:
#Check for new personality clashes

				#Active personality clash 1 if at least 24 hours have passed
0                (try_begin),
1                   (eq, "$disable_npc_complaints", 0),
2                    (eq, "$npc_with_personality_clash", 0),
3                    (eq, "$npc_with_personality_clash_2", 0),
                #    (eq, "$personality_clash_after_24_hrs", 0),
4                    (troop_slot_eq, ":npc", slot_troop_personalityclash_state, 0),
5                    (troop_get_slot, ":other_npc", ":npc", slot_troop_personalityclash_object),

6                    (main_party_has_troop, ":other_npc"),

7                    (assign, "$personality_clash_after_24_hrs", ":npc"),
8                (try_end),
 
Hello.
I have a couple of questions to you modders here:


In header_operations in the module_system what stands the cur_item_add_mesh operation for?
Is it possible to use this operation for more accurate character equimpment customization by writing a special code, that allows to attach additional mesh objects to player's equiment parts.? E.g adding a shoulder pauldron mesh to an armor worn by the player that hasn't any shoulder pauldrons on it or adding a chrest on the helmet?


And the next question:

What effects has the agility skill, besides letting an character run faster and giving extra Weapon Proficieny points and raising the skill limit of certain skills that are affected by it? With agilty, in the case of the game, I understand that it is the possibility of performing greater and faster body movements, so that ingame the higher the characters agility is the faster he can swing, similar to what weapon prof does. I experimented a bit with it by exporting my character stats, changing the agility attribute to 2000 and importing the char stats back to the game. The result of it was that my charcter ran by far faster than any horse in the game, as I expected, but that was it.
It didn't changed the speed of my swings or anything else that has an dircect effect on my char's combat abilities apart from giving me an ridiculous amount of weapon prof points.  This makes me think that Agility isn't really as effective for direct combat as the Strenght attribute, since it only increases running speed to a very low extent even at higer agility level, so that doesn't really make a remarkable difference in comabt, and merely gives you 5-10 weapon prof point per level by default in most mods. On the other side, strength directly gives you one HP and improves damage more recognizable than agility does to running speed.


And another thing:

Is there any open source code in which strenght has a more 'realistic' effect on a troop's combat ability? I try to explain the thought behind this question.
When sombody has more physical strength, he is not only able to apply more power to an object but also moving and lifting an object with less effort and much faster than someone with less strength. So ingame this should mean that troops with higher strength should not only make more damage with a melee weapon but also swing a very heavy weapon at least a bit faster than a troops with considerably less strength. I.e so that strenght level serves as multiplier for weapon swing speed and depending on how heavy the weapon is the  higher the bonus of extra speed is. The swing speed of A very heavy weapon like a maul would be more affected by strenght while an light warpon like an one handed sword, would benefit more from weapon proficiency.

But in the game strength only modifies damage dealt with a melee weapon, and I just find it lame that, a troop with lower strengt is able to swing a maul much faster due to his high weapon prof than a troop with very high strength but low wepon prof.
Is there an operation that can determine weapon swing speed or the swing speed of an agent? Or an OS code that does something similar or do I have to figure that out and write one by myself?


Hope someone can answer me these questions.
 
Hi all! I've generated 5 new faces for French soldiers (most of them with moustage and beard as Napoleon III had, very popular in France at that time), but when I checked in the game, some of French soldiers have other hair than what I have set. There are only 5 face kinds in range, with own names, added to the end of list of faces, there are no face types with hair meshes a_la_russian_grenadier or a_la_hussard_v2, but some soldiers have them, as on this screenshot. Is it possible to make faces exactly as I've generated?

wGCbQP5YqaU.jpg

And also second question - is it possible to vary size of human's skeleton, so soldiers will be not of the same height, and some troops will be bigger than others (as grenadiers will be bigger than voltigeurs)?
 
Ivkolya 说:
is it possible to vary size of human's skeleton, so soldiers will be not of the same height,

yeap, you can create extra skins and use the scale variable to change the height (as long it is small changes it will be OK, won't work to create a gigant of 10meters tho)

VC source has a example. They have 3 heights for normal characters, plus 1 extra height for kids.

https://forums.taleworlds.com/index.php/topic,349080.0.html
 
SuperCommando 说:
Hello.
I have a couple of questions to you modders here:
You can't change swing speed for agents directly, you have to change proficiency levels probably or make copies of items that are faster. You can of course scale down the default effects of strength/agility by using the following operations.
插入代码块:
agent_set_max_hit_points               = 2090   # set absolute to 1 if value is absolute, otherwise value will be treated as relative number in range [0..100]    # (agent_set_max_hit_points,<agent_id>,<value>,[absolute]),
agent_set_damage_modifier              = 2091   # (agent_set_damage_modifier, <agent_id>, <value>), # value is in percentage, 100 is default
agent_set_accuracy_modifier            = 2092   # (agent_set_accuracy_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_speed_modifier               = 2093   # (agent_set_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_reload_speed_modifier        = 2094   # (agent_set_reload_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_use_speed_modifier           = 2095   # (agent_set_use_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_visibility                   = 2096   # (agent_set_visibility, <agent_id>, <value>), # 0 for invisible, 1 for visible.
agent_get_crouch_mode                  = 2097   # (agent_ai_get_crouch_mode, <destination>, <agent_id>),
agent_set_crouch_mode                  = 2098   # (agent_ai_set_crouch_mode, <agent_id>, <value>), # 0-1
agent_set_ranged_damage_modifier       = 2099   # (agent_set_ranged_damage_modifier, <agent_id>, <value>), # value is in percentage, 100 is default

As for your first question, it does exactly what it says, adding on a mesh with a number of caveats. Note that in Native the operation (or more precisely the trigger it works in) is for helmets and armor only (it works for all items in inventory but it doesn't get called in missions). You can use the following script to append meshes
插入代码块:
def add_mesh(item_meshes):
  cur_meshes = [(store_trigger_param_1, ":agent_no"),(ge, ":agent_no", 0)]
  for mesh in item_meshes if not isinstance(item_meshes, basestring) else [item_meshes]:
    cur_meshes.append((str_store_string, s1, mesh))
    cur_meshes.append((cur_item_add_mesh, s1))
  return (ti_on_init_item, cur_meshes)
And use it like this
插入代码块:
["gold_tourney_helmet","Gold Tourney Helmet",[("hood_a",0)],itp_type_head_armor,0,126, weight(2)|head_armor(16),imodbits_none, [add_mesh("@helmet_fur_b")], ],
 
kalarhan 说:
Ivkolya 说:
is it possible to vary size of human's skeleton, so soldiers will be not of the same height,

yeap, you can create extra skins and use the scale variable to change the height (as long it is small changes it will be OK, won't work to create a gigant of 10meters tho)

VC source has a example. They have 3 heights for normal characters, plus 1 extra height for kids.

https://forums.taleworlds.com/index.php/topic,349080.0.html

Thank you very much, kalarhan, I will look into it:smile:

Somebody 说:
SuperCommando 说:
Hello.
I have a couple of questions to you modders here:
You can't change swing speed for agents directly, you have to change proficiency levels probably or make copies of items that are faster. You can of course scale down the default effects of strength/agility by using the following operations.
插入代码块:
agent_set_max_hit_points               = 2090   # set absolute to 1 if value is absolute, otherwise value will be treated as relative number in range [0..100]    # (agent_set_max_hit_points,<agent_id>,<value>,[absolute]),
agent_set_damage_modifier              = 2091   # (agent_set_damage_modifier, <agent_id>, <value>), # value is in percentage, 100 is default
agent_set_accuracy_modifier            = 2092   # (agent_set_accuracy_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_speed_modifier               = 2093   # (agent_set_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_reload_speed_modifier        = 2094   # (agent_set_reload_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_use_speed_modifier           = 2095   # (agent_set_use_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_visibility                   = 2096   # (agent_set_visibility, <agent_id>, <value>), # 0 for invisible, 1 for visible.
agent_get_crouch_mode                  = 2097   # (agent_ai_get_crouch_mode, <destination>, <agent_id>),
agent_set_crouch_mode                  = 2098   # (agent_ai_set_crouch_mode, <agent_id>, <value>), # 0-1
agent_set_ranged_damage_modifier       = 2099   # (agent_set_ranged_damage_modifier, <agent_id>, <value>), # value is in percentage, 100 is default

As for your first question, it does exactly what it says, adding on a mesh with a number of caveats. Note that in Native the operation (or more precisely the trigger it works in) is for helmets and armor only (it works for all items in inventory but it doesn't get called in missions). You can use the following script to append meshes
插入代码块:
def add_mesh(item_meshes):
  cur_meshes = [(store_trigger_param_1, ":agent_no"),(ge, ":agent_no", 0)]
  for mesh in item_meshes if not isinstance(item_meshes, basestring) else [item_meshes]:
    cur_meshes.append((str_store_string, s1, mesh))
    cur_meshes.append((cur_item_add_mesh, s1))
  return (ti_on_init_item, cur_meshes)
And use it like this
插入代码块:
["gold_tourney_helmet","Gold Tourney Helmet",[("hood_a",0)],itp_type_head_armor,0,126, weight(2)|head_armor(16),imodbits_none, [add_mesh("@helmet_fur_b")], ],

Somebody, it's very interesting and useful code, thank you.
This reminded me about another question, answer on which I've searched a long time ago. Is it possible to make sets of items? I mean, I don't want to mix uniforms, so player won't be able to wear coat of one regiment, hat of another and pants of third. I solved this partially by combining whole uniform in one mesh, it works fine for body and legs part of uniform (but I needed also combine human's body mesh as well and make invisible calfs), but it didn't work for hat, because in that case I can't assign to the hat item type "hat", and so I can see hat from inside instead from not seeing it at all as it meant to be.
 
For item sets you just set an arbitrary restriction (by removing it before a mission or via tableau shenanigans) and then force the appropriate hat to be equipped once the agent actually spawns. You can of course dynamically append meshes based on criteria such as troop slots or what other items they're wearing. Create a near-invisible mesh (or a part of the hat like the brim) and set that as the base, then add on the meshes you actually want. The downside is additional complexity and being unable to adjust stats based on mesh appearance (which can be alleviated by having multiple base items).
 
Somebody 说:
For item sets you just set an arbitrary restriction

another alternative: instead of restrictions you can add bonus to each piece the player is using from the set, something quite popular with RPG games.

1 piece: no bonus
2 pieces: +1 STR bonus
3 pieces: +1 AGI pieces
4 pieces: +10% damage bonus

^ just a example

You can show the bonus (possible and current) using the extra text from items (which is dynamic).
script_game_get_item_extra_text
script_game_get_skill_modifier_for_troop
 
Somebody 说:
For item sets you just set an arbitrary restriction (by removing it before a mission or via tableau shenanigans) and then force the appropriate hat to be equipped once the agent actually spawns. You can of course dynamically append meshes based on criteria such as troop slots or what other items they're wearing. Create a near-invisible mesh (or a part of the hat like the brim) and set that as the base, then add on the meshes you actually want. The downside is additional complexity and being unable to adjust stats based on mesh appearance (which can be alleviated by having multiple base items).
Thank you for answer! Sorry, I'm quite new to Python (took lessons on the Coursera, but it isn't enough), so it's hard to me to understand how should I do it:smile: Maybe is this method realized already in some mod or script, so I can use it as example for my mod and my meshes?

kalarhan 说:
Somebody 说:
For item sets you just set an arbitrary restriction

another alternative: instead of restrictions you can add bonus to each piece the player is using from the set, something quite popular with RPG games.

1 piece: no bonus
2 pieces: +1 STR bonus
3 pieces: +1 AGI pieces
4 pieces: +10% damage bonus

^ just a example

You can show the bonus (possible and current) using the extra text from items (which is dynamic).
script_game_get_item_extra_text
script_game_get_skill_modifier_for_troop

It's great idea, but unfortunately not for my mod, since all units must have their full regimental uniform. But the idea is very interesting:smile:
 
Ivkolya 说:
I'm quite new to Python
Not Python. Python is just the glue and compiler, all you need to create a mod is a 30min Python lesson (variables, arrays, tuples, indentation). The modsys uses MBScript (Mount & Blade Scripting), which you can learn with the tutorials here in the Forge.

Ivkolya 说:
Maybe some of these two alternative methods are realized already in some mod or script, so I can use it as example for my mod and my meshes?
my suggestion is roughly part of Native and VC, they use those scripts to give extra bonus to some items (like the crown). VC, as a example, has bonus/penalties for heavy armor, noble clothing, etc, just look at the game code and it should be easy to understand
 
hello guys, so i have found and discovered where is my module game_menus error but when i built no error and when i opened my game it still crahesed so i know that because of my module game_menus if someone found out what is the problem pls can you tell me https://github.com/HarryPham123/My-module-/blob/master/module_game_menus.py
 
How does walking sounds system works ?

You know, if you try to walk in interior scenes, you can hear snd_footstep_wood_*
If you try to walk at exterior scenes, you can hear snd_footstep_*

I want to change it, and make it material or prop based. Like when you are on a wooden base, then you should hear wood sound, not a dirt sound.
I couldn't find anything in module_* files. Any ideas ?
 
Though I'm not planning on trying it too soon if possible, is there any way to edit formations?

I'm making a (American) Civil War mod and would like at one point to have the front rank in two-rank formations to stand, and also possibly to add a "skirmish formation," where everybody in the formation kneels.
 
David Dire 说:
edit formations?

you can check the Formations OSP (currently newest version can be seen on VC source code), and other kits for things like skirmisher. You can do it all with modsys, but depending on what you want you will need to study some geometry and special operations (for AI, etc).

Start with the kits to see how they are used and go from there



KhergitKhan 说:
How does walking sounds system works ?

worldmap is done via module_map_icons.py
插入代码块:
("player",0,"player", avatar_scale, snd_footstep_grass, [icon_tableau_trigger,]),
see other cases for parties like ships, lords, etc

for scenes they are mostly hardcoded. Sound ID #17 is footstep on grass. You can't change that ID number (position in the module_sounds.py). You could play with sound operations to play different sounds depending on events and triggers.
插入代码块:
################################################################################
# [ Z13 ] SOUNDS AND MUSIC TRACKS
################################################################################

  # There are two types of sound in the game: sounds and tracks. Sounds are just
  # short sound effects. They can be positional (i.e. emitted by some object on
  # the scene or by player's opponent during the dialog). They can be generic
  # sound effects, like playing some drums when player meets mountain bandits.

  # Tracks are the background music. The game works as a kind of a musuc box,
  # cycling the available melodies according to the situation. It is up to the
  # Module System developer, however, to tell the game what the situation is.
  # There are two factors which you can tell the game: situation and culture.
  # So you can tell the game that the situation is "ambush" and the culture is
  # "khergits", and the game will select the musuc tracks which fit this
  # combination of situation and culture and will rotate them randomly. And of
  # course, you can also tell the game to play one specific track if you want.

play_sound_at_position   =  599  # (play_sound_at_position, <sound_id>, <position>, [options]),
                                 # Plays a sound in specified scene position. See sf_* flags in header_sounds.py for reference on possible options.
play_sound               =  600  # (play_sound, <sound_id>, [options]),
                                 # Plays a sound. If the operation is called from agent, scene_prop or item trigger, then the sound will be positional and 3D. See sf_* flags in header_sounds.py for reference on possible options.
play_track               =  601  # (play_track, <track_id>, [options]),
                                 # Plays specified music track. Possible options: 0 = finish current then play this, 1 = fade out current and start this, 2 = stop current abruptly and start this
play_cue_track           =  602  # (play_cue_track, <track_id>),
                                 # Plays specified music track OVER any currently played music track (so you can get two music tracks playing simultaneously). Hardly useful.
music_set_situation      =  603  # (music_set_situation, <situation_type>),
                                 # Sets current situation(s) in the game (see mtf_* flags in header_music.py for reference) so the game engine can pick matching tracks from module_music.py. Use 0 to stop any currently playing music (it will resume when situation is later set to something).
music_set_culture        =  604  # (music_set_culture, <culture_type>),
                                 # Sets current culture(s) in the game (see mtf_* flags in header_music.py for reference) so the game engine can pick matching tracks from module_music.py. Use 0 to stop any currently playing music (it will resume when cultures are later set to something).
stop_all_sounds          =  609  # (stop_all_sounds, [options]), 
                                 # Stops all playing sounds. Version 1.153 options: 0 = stop only looping sounds, 1 = stop all sounds. Version 1.143 options: 0 = let current track finish, 1 = fade it out, 2 = stop it abruptly.
store_last_sound_channel =  615  # (store_last_sound_channel, <destination>),
                                 # Version 1.153+. UNTESTED. Stores the sound channel used for the last sound operation.
stop_sound_channel       =  616  # (stop_sound_channel, <sound_channel_no>),
                                 # Version 1.153+. UNTESTED. Stops sound playing on specified sound channel.
 
Somebody 说:
As for your first question, it does exactly what it says, adding on a mesh with a number of caveats. Note that in Native the operation (or more precisely the trigger it works in) is for helmets and armor only (it works for all items in inventory but it doesn't get called in missions). You can use the following script to append meshes
插入代码块:
def add_mesh(item_meshes):
  cur_meshes = [(store_trigger_param_1, ":agent_no"),(ge, ":agent_no", 0)]
  for mesh in item_meshes if not isinstance(item_meshes, basestring) else [item_meshes]:
    cur_meshes.append((str_store_string, s1, mesh))
    cur_meshes.append((cur_item_add_mesh, s1))
  return (ti_on_init_item, cur_meshes)
And use it like this
插入代码块:
["gold_tourney_helmet","Gold Tourney Helmet",[("hood_a",0)],itp_type_head_armor,0,126,weight(2)|head_armor(16),imodbits_none, [add_mesh("@helmet_fur_b")], ],
Thank you Somebody for clarifying it to me and for the piece of code you provided!
This operation  could ebable new options for armor customization, especially when the player wants to be mercenary type of character who wants to differ from the ordinary soldiers of kingdom.

Somebody 说:
You can't change swing speed for agents directly, you have to change proficiency levels probably or make copies of items that are faster. You can of course scale down the default effects of strength/agility by using the following operations.
插入代码块:
agent_set_max_hit_points               = 2090   # set absolute to 1 if value is absolute, otherwise value will be treated as relative number in range [0..100]    # (agent_set_max_hit_points,<agent_id>,<value>,[absolute]),
agent_set_damage_modifier              = 2091   # (agent_set_damage_modifier, <agent_id>, <value>), # value is in percentage, 100 is default
agent_set_accuracy_modifier            = 2092   # (agent_set_accuracy_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_speed_modifier               = 2093   # (agent_set_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_reload_speed_modifier        = 2094   # (agent_set_reload_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_use_speed_modifier           = 2095   # (agent_set_use_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]
agent_set_visibility                   = 2096   # (agent_set_visibility, <agent_id>, <value>), # 0 for invisible, 1 for visible.
agent_get_crouch_mode                  = 2097   # (agent_ai_get_crouch_mode, <destination>, <agent_id>),
agent_set_crouch_mode                  = 2098   # (agent_ai_set_crouch_mode, <agent_id>, <value>), # 0-1
agent_set_ranged_damage_modifier       = 2099   # (agent_set_ranged_damage_modifier, <agent_id>, <value>), # value is in percentage, 100 is default
Thanks again. I'm aware of those operations. Unfortunately they are not really useful to what I want to do, as I want to change the swing speed without having to change proficiency levels, so that higher strength can improve swing speed with heavier weapons relatively more than with light weapons.There is already an agent operation for ranged weapon reload speed. I wonder why the devs, out of all these operations that are in the module system, haven't integrated an operation that would modify agent or item swing speed.
 
SuperCommando 说:
I wonder why the devs, out of all these operations that are in the module system, haven't integrated an operation that would modify agent or item swing speed

engine devs only add operations they need for something. If no designer dev asked for it...  :mrgreen:

look at all the new operations since 1.153. They were requested (mostly) by the VC team (designers) for the VC DLC.
 
状态
不接受进一步回复。
后退
顶部 底部