Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Dirk Robbing said:
How is music changed during a fight once the first song is over? Is it possible to direct it to call a script or does it just automatically decide anything with mtf_sit_fight or whatever? Same with the world map.
Code:
common_custom_siege_init = (
  0, 0, ti_once, [],
  [
    (assign, "$g_battle_result", 0),
    (call_script, "script_music_set_situation_with_culture", mtf_sit_siege),
    ])

common_siege_init = (
  0, 0, ti_once, [],
  [
    (assign,"$g_battle_won",0),
    (assign,"$defender_reinforcement_stage",0),
    (assign,"$attacker_reinforcement_stage",0),
    (call_script, "script_music_set_situation_with_culture", mtf_sit_siege),
    ])

common_music_situation_update = (
  30, 0, 0, [],
  [
    (call_script, "script_combat_music_set_situation_with_culture"),
    ])

update the situation and call the script to change music (like if you are about to lose, etc)

when you win:
Code:
              # script_play_victorious_sound
              # Input: none
              # Output: none
              ("play_victorious_sound",
                [
                  (call_script, "script_music_set_situation_with_culture", mtf_sit_victorious),
              ]),
 
Hello all, a question from amateur modder here...

I'm trying to make a check if player has horses (any kind of horse will do), then this menu appears. But it doesn't seem to detect it. I took example from food check script (check if there is food, if there's any, consume). Can I ask for help?

It's in game_menus.py

Code:
("camp_action_do_the_horse",0,
   "Placeholder text: thing of another later",
   "none",
   [],
    [
	("action_do_the_horse",[
						(try_for_range, ":cur_horse", horses_begin, horses_end),
						  (player_has_item, ":cur_horse"),
						(try_end),
                             ],"Check horse condition.",
       [
		  (display_message, "@Test"),
        ]
    ),

Also is there a way to show a number of horses the player have? E.g. the menu will show as "Check horse condition (you have 10 horses)".
 
You don't set anything in that try-for-range loop. You loop through horses and check, the check passes or fails, and then .... nothing happens. You need to toss a variable in there that gets checked, something like:
Code:
	("action_do_the_horse",[
					(assign, ":has_horse", 0),	
                                        (try_for_range, ":cur_horse", horses_begin, horses_end),
						  (player_has_item, ":cur_horse"),
                                                  (assign, ":has_horse", 1),
					(try_end),
                                        (eq, ":has_horse", 1),
                             ],"Check horse condition.",
 
Oooh, so that's what the variable is used for. Thanks Caba'drin!

The other question, can I count how many horses player have inside the (try_for_range) loop? I find (store_item_kind_count), but it seems it doesn't count all horses collectively? (so it only counts 3 Courser, 1 Steppe Horse, etc)
 
HyperCharge said:
I need a guide for simple destructible walls for AoFI's cannons. I've made that, but it is not working;

Code:
("destructible_wall_damage_receive",
	[
	(store_script_param_1, ":projectile_instance"),
        (store_script_param_2, ":wall_instance"),
        (store_script_param  , ":damage", 3),
 (try_begin),
 (multiplayer_is_server),
 (game_in_multiplayer_mode),
 (assign, ":wall_hitpoints", wall_health), # wall health is 2500
 
 (this_or_next|scene_prop_get_instance, ":projectile_instance", "spr_mp_cannonball_3lb"), #get instances
 (this_or_next|scene_prop_get_instance, ":projectile_instance", "spr_mp_cannonball_6lb"),
 (scene_prop_get_instance, ":projectile_instance", "spr_mp_cannonball_12lb"),
 
 (prop_instance_get_position, pos1, ":projectile_instance"), #get the positions of instances
 (prop_instance_get_position, pos2, ":wall_instance"),
 
 (prop_instance_is_valid, ":wall_instance"), # ask that props are valid
 (prop_instance_is_valid, ":projectile_instance"),
 
 (get_distance_between_positions, ":destination", pos1, pos2), # if it is valid, ask the distance between them
 (le, ":destination", 5), # check if distance between them is lower than 5
  (try_begin), # start the party :)
  (eq, ":projectile_instance", "spr_mp_cannonball_3lb"),
  (assign, ":damage", 200),
  (val_sub, ":damage", ":wall_hitpoints"), #subtract the damage number i assigned to cannonball from wall_hitpoints.
  (display_message, "@debug: delivered 200 damage with 3lb ball!"),
  (else_try),
  (eq, ":projectile_instance", "spr_mp_cannonball_6lb"),
  (assign, ":damage", 400),
  (val_sub, ":damage", ":wall_hitpoints"),
  (display_message, "@debug: delivered 200 damage with 6lb ball!"), # show a note for debug.
  (else_try),
  (eq, ":projectile_instance", "spr_mp_cannonball_12lb"),
  (assign, ":damage", 750),
  (val_sub, ":damage", ":wall_hitpoints"),
  (display_message, "@debug: delivered 200 damage with 12lb ball!"),
  (try_end),
  (try_end),
	]),
	
	("destructible_wall_init",
	[
	(store_script_param_1, ":wall_instance"),
 (store_script_param_2, ":wall_hitpoints"),
 (try_begin),
 (assign, ":wall_hitpoints", wall_health), # wall_health is 2500
 (try_for_range, ":wall_instance", walls_begin, walls_end), # try for the walls i signed
 (try_begin), # start the destroying
 (le, ":wall_hitpoints", 0), # if wall hitpoints is equal to 0 or lower than 0
 (play_sound, "snd_dummy_destroyed"), # play the sound
		
		(prop_instance_get_position, pos1, ":wall_instance"), #get the instance
		
		(particle_system_burst, "psys_dummy_smoke", pos1, 15), # handle the particles
        (particle_system_burst, "psys_dummy_straw", pos1, 25),
		
		(try_begin),# start the replacing with an empty prop.
	      (multiplayer_is_server),
		  (set_spawn_position, pos1),
		  (spawn_scene_prop, "spr_empty"),# spawn the empty prop
		  (position_set_z, pos1, -1200),
		  (prop_instance_animate_to_position, ":wall_instance", pos1, 4), # move the destroyed wall to underground. But i want that make in 4 secons, i dont know i did correctly.
		  (prop_instance_clear_attached_missiles, ":wall_instance"), # clear the arrows attached to wall, if i dont do that, missiles will be stay in air.
		(try_end),
		(try_end),#end...
		]),

Code:
destructible_init = (ti_on_init_scene_prop,
 [

(assign, ":wall_instance", 1),
(assign, ":wall_hitpoints", wall_health),
 
 (call_script, "script_destructible_wall_init", ":wall_instance", ":wall_hitpoints"),
 
 ])
 
destructible_wall_damage_system = (ti_on_init_scene_prop,
[
(assign, ":projectile_instance", 1),
(assign, ":wall_instance", 1),
(assign, ":damage", 1),
 (call_script, "script_destructible_wall_damage_receive", ":projectile_instance", ":wall_instance", ":damage"),
 
 ])

In the game, there is no errors and positive result. Where's my fault ?

Also, assigning the variables on wall_damage_system was necessary, it was giving unassigned local variable warning.

Any ideas on this ?
 
xaliber said:
Oooh, so that's what the variable is used for. Thanks Caba'drin!

The other question, can I count how many horses player have inside the (try_for_range) loop? I find (store_item_kind_count), but it seems it doesn't count all horses collectively? (so it only counts 3 Courser, 1 Steppe Horse, etc)

Local variables persist through try_blocks, so use one of those. A val_add operation can be used to count the number of entities that fit a given criteria by adding 1 to the variable whenever those criteria are met.
 
I have a question for anyone that fiddles with Multiplayer.

I didn't even touch the banners since the last version, yet this problem started to happen:
rxNxN6F.jpg

For both factions. Something's noticeable at the edges of the banner...if anyone had this before any help is appreciated.
 
jacobhinds said:
xaliber said:
Oooh, so that's what the variable is used for. Thanks Caba'drin!

The other question, can I count how many horses player have inside the (try_for_range) loop? I find (store_item_kind_count), but it seems it doesn't count all horses collectively? (so it only counts 3 Courser, 1 Steppe Horse, etc)

Local variables persist through try_blocks, so use one of those. A val_add operation can be used to count the number of entities that fit a given criteria by adding 1 to the variable whenever those criteria are met.

I'm sorry, but I don't quite follow... so I have to iterate "try" to check every type of horses? Something like this?

Code:
	("action_do_the_horse",[
					(assign, ":has_horse", 0),	
                                        (try_for_range, ":cur_horse", horses_begin, horses_end),
						  (player_has_item, ":cur_horse"),
                                                  (assign, ":has_horse", 1),
					(try_end),
                                        (eq, ":has_horse", 1),

                                        # Count horse
                                        (try_begin),
                                                  (player_has_item, "itm_sumpter_horse"),
                                                  (store_item_kind_count, ":total_this_horse", "itm_sumpter_horse")
                                                  (val_add, ":total_horse", ":total_this_horse"),
                                        (else_try),
                                                  (player_has_item, "itm_saddle_horse"),
                                                  (store_item_kind_count, ":total_this_horse", "itm_saddle_horse")
                                                  (val_add, ":total_horse", ":total_this_horse"),
                                        (else_try),
                                                  (player_has_item, "itm_steppe_horse"),
                                                  (store_item_kind_count, ":total_this_horse", "itm_steppe_horse")
                                                  (val_add, ":total_horse", ":total_this_horse"),
                                        (else_try),
                                                   ## etc ....
                                        (try_end),
                                        (assign, reg6, ":total_horse"),
                             ],"Check horse condition (you have {reg6} horses).",
 
xaliber said:
jacobhinds said:
xaliber said:
Oooh, so that's what the variable is used for. Thanks Caba'drin!

The other question, can I count how many horses player have inside the (try_for_range) loop? I find (store_item_kind_count), but it seems it doesn't count all horses collectively? (so it only counts 3 Courser, 1 Steppe Horse, etc)

Local variables persist through try_blocks, so use one of those. A val_add operation can be used to count the number of entities that fit a given criteria by adding 1 to the variable whenever those criteria are met.

I'm sorry, but I don't quite follow... so I have to iterate "try" to check every type of horses? Something like this?

Code:
	("action_do_the_horse",[
					(assign, ":has_horse", 0),	
                                        (try_for_range, ":cur_horse", horses_begin, horses_end),
						  (player_has_item, ":cur_horse"),
                                                  (assign, ":has_horse", 1),
					(try_end),
                                        (eq, ":has_horse", 1),

                                        # Count horse
                                        (try_begin),
                                                  (player_has_item, "itm_sumpter_horse"),
                                                  (store_item_kind_count, ":total_this_horse", "itm_sumpter_horse")
                                                  (val_add, ":total_horse", ":total_this_horse"),
                                        (else_try),
                                                  (player_has_item, "itm_saddle_horse"),
                                                  (store_item_kind_count, ":total_this_horse", "itm_saddle_horse")
                                                  (val_add, ":total_horse", ":total_this_horse"),
                                        (else_try),
                                                  (player_has_item, "itm_steppe_horse"),
                                                  (store_item_kind_count, ":total_this_horse", "itm_steppe_horse")
                                                  (val_add, ":total_horse", ":total_this_horse"),
                                        (else_try),
                                                   ## etc ....
                                        (try_end),
                                        (assign, reg6, ":total_horse"),
                             ],"Check horse condition (you have {reg6} horses).",

that would work, but it is like taking a trip to the moon when all you want is to cross the street.
Use Caba's snippet, change the assign to a sum (val_add) and you will have your horse count

you should read the basic tutorial/guides on modding and syntax:  :arrow: http://forums.taleworlds.com/index.php/topic,240255.0.html
 
Hi.
To make work the operations added with patch 1.165 on dedicated server, do i need to use dedicated server files for version 1.165 ? Now i use version 1.158.
Module presentations isn't loaded by dedicated servers, right ?
Thanks.
 
dedicated servers probably do need to have the presentations.txt files, but you can remove all presentations from it, leaving just the hardcoded ones, cause it wont use any
 
What is the easiest way to limit the number of reinforcement waves to 1 for field battles?
I prefer larger party sizes (500+) and battles size around 150v150, but find it more "realistic" to have multiple engagements which start as a new wave instead of enemies spawning during a battle.
I am guessing this is hidden somewhere in the "lead_charge" mst...
 
wrwlf said:
What is the easiest way to limit the number of reinforcement waves to 1 for field battles?
I prefer larger party sizes (500+) and battles size around 150v150, but find it more "realistic" to have multiple engagements which start as a new wave instead of enemies spawning during a battle.
I am guessing this is hidden somewhere in the "lead_charge" mst...

_reinforcement_ globals and this operation
Code:
add_reinforcements_to_entry

you can see it be used on mission_templates like "lead_charge" and remove this altogether. Remember to reconsider battle advantage if you won`t let them get more troops, otherwise your battles will end up being too easy
 
kalarhan said:
wrwlf said:
What is the easiest way to limit the number of reinforcement waves to 1 for field battles?
I prefer larger party sizes (500+) and battles size around 150v150, but find it more "realistic" to have multiple engagements which start as a new wave instead of enemies spawning during a battle.
I am guessing this is hidden somewhere in the "lead_charge" mst...

_reinforcement_ globals and this operation
Code:
add_reinforcements_to_entry

you can see it be used on mission_templates like "lead_charge" and remove this altogether. Remember to reconsider battle advantage if you won`t let them get more troops, otherwise your battles will end up being too easy

Thanks again kalarhan!
 
Hello!

How does one add new races? I appear to have completely forgotten how.

**EDIT**

Nevermind, it has all come back to me now.

**EDIT 2**

Now I need help making them playable, some help would be very appreciated.
 
I'm trying to set up a Module System and Python to mod M&B Warband and have a noob question or two:

Will Module System version 1.165 work with M&B Warband version 1.168? Or do I need to find an older version of the game? (As I haven't found any newer versions of the Module System)

I figure any Python version older than 3x is good? (like 2x something).
 
Chiaro22 said:
I'm trying to set up a Module System and Python to mod M&B Warband and have a noob question or two:

Will Module System version 1.165 work with M&B Warband version 1.168? Or do I need to find an older version of the game? (As I haven't found any newer versions of the Module System)

I figure any Python version older than 3x is good? (like 2x something).

read this  :arrow: http://forums.taleworlds.com/index.php/topic,240255.0.html

You can use 1.165 modules, but download Lav's version 1.166 instead: http://forums.taleworlds.com/index.php/topic,324874.0.html. It has better documentation, it will make your modding life much easier
 
Status
Not open for further replies.
Back
Top Bottom