Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Is it possible to compile only some parts of a mod? I want a way to compile only the troops and item file to distribute to a team member so he can make changes, compile and test them himself.
 
KratosMKII said:
Is it possible to compile only some parts of a mod? I want a way to compile only the troops and item file to distribute to a team member so he can make changes, compile and test them himself.

you can run the process_XXX.py files yourself, the .bat file just runs all of them in a certain order. As there are plenty of dependencies you will need to study and see what you need to do for each .txt file.

items is a easy one, while troops depends on items, and so on.

now the second part above didnt make sense, so not sure what you are trying to do on "to distribute to a team member so he can make changes, compile and test them himself". The other dude will also need all module_XXX.py files, you cant send him .txt files if he will need to compile code for other stuff.
 
Got another question: How do i turn custom battles on again? 1257 have them disabled.

kalarhan said:
KratosMKII said:
Is it possible to compile only some parts of a mod? I want a way to compile only the troops and item file to distribute to a team member so he can make changes, compile and test them himself.

you can run the process_XXX.py files yourself, the .bat file just runs all of them in a certain order. As there are plenty of dependencies you will need to study and see what you need to do for each .txt file.

items is a easy one, while troops depends on items, and so on.

now the second part above didnt make sense, so not sure what you are trying to do on "to distribute to a team member so he can make changes, compile and test them himself". The other dude will also need all module_XXX.py files, you cant send him .txt files if he will need to compile code for other stuff.
Thank you. I meant to send him the module files required to compile module_troops and module_items.

Edit: I run process_troops.py and in the console it says that it's exporting troop data. It then closes but it only generates .pyc files. What to do with them?
 
KratosMKII said:
Edit: I run process_troops.py and in the console it says that it's exporting troop data. It then closes but it only generates .pyc files. What to do with them?

process_XXX.py creates the XXXX.txt files. So check your module folder and the new file should be there (as normal).

in other words: instead of creating ALL .txt files, you created just ONE .txt file.

*.pyc files can be ignored/removed (they are machine code created from the *.py files. It is a Python thingy. If curious you can google to learn more about it)
 
Heraldic deployable pavise

Hi all,

I've spent too much time trying to resolve this.
When shiled spawns as a scene prop, instead of the heraldry I get only a black surface.


Here is  code:
module_items
["pavise", "Tower Shield",  [("tableau_shield_pavise_3_new" ,0)], itp_merchandise|itp_type_shield|itp_cant_use_on_horseback|itp_wooden_parry, itcf_carry_board_shield,470 , weight(6)|hit_points(500)|body_armor(1:cool:|spd_rtng(7:cool:|shield_width(43)|shield_height(90),imodbits_shield, [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_pavise_shield_3", ":agent_no", ":troop_no")])]],
module_tableau _materials
  ("pavise_shield_3a", 0, "sample_shield_matte", 512, 512, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),

      (init_position, pos1),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 120),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 116, 0),
      (init_position, pos1),
      (position_set_z, pos1, 10),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_shield_pavise_3", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

module_mission_templates

      #pavise
Pavise = (0, 0, 0,
        [],
        [

            (get_player_agent_no, ":player_agent"),
            (agent_get_position, pos2, ":player_agent"),
            #==click g && has pavise
            (try_begin),
                #(agent_has_item_equipped, ":player_agent", "itm_pavise"),
                (agent_get_wielded_item, ":shield_item", ":player_agent", 1),
                (eq, ":shield_item", "itm_pavise"),
                (key_clicked, key_g),
                (clear_omitted_keys),
         
                (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
                (position_move_y, pos2, 50),
                (set_spawn_position, pos2),

                (assign, ":pav_found", 0),#pf
                #FOR # props if prop at LATENT spot
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (eq, ":pav_found", 0),#pf
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (position_get_z, ":z_coor", pos3),
                    (eq, ":z_coor", -100*100),#-100 LATENT spot

                    (prop_instance_set_position, ":scene_prop_id", pos2),#pavise move
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                    (assign, ":pav_found", 1),#pf
                (try_end),

                (try_begin),
                    (lt, ":pav_found", 1),#pf

                    (spawn_scene_prop, "spr_pavise"),#pavise spawn
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                (try_end),
            (try_end),

            (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
            #==click h && near proped pavise
            (try_begin),
                (key_clicked, key_h),
                (clear_omitted_keys),
                #FOR # props if prop close to player
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (get_distance_between_positions, ":player_distance", pos2, pos3),
                    (le, ":player_distance", 100),

                    (position_set_z, pos3, -100*100),#-100 LATENT spot
                    (prop_instance_set_position, ":scene_prop_id", pos3),#pavise move

                    (set_spawn_position, pos2),
                    (position_move_y, pos2, 50),
                    (spawn_item, "itm_pavise"),#pavise spawn
                (try_end),
                #(scene_prop_set_visibility, ":scene_prop_id", 0),
                #(init_position, pos1),
            (try_end),

        ])
module_scene_props:
  ("pavise",sokf_moveable|sokf_destructible,"tableau_shield_pavise_prop_3","bo_tableau_shield_pavise_prop_3", [
    #check_castle_door_use_trigger,

  (ti_on_init_scene_prop,
    [  (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_3a", "trp_player"),
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
   
  (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),
   
      (assign, ":rotate_side", 86),
   
      (try_begin),
        (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),   
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),
   
        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),
   
        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        #(assign, reg0, ":z_difference"),
        #(display_message, "@{!}z dif : {reg0}"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]),     

    (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),     
      (store_trigger_param_2, ":damage"),
   
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
        (play_sound, "snd_dummy_hit"),
      (else_try),
        (neg|multiplayer_is_server),
        (play_sound, "snd_dummy_destroyed"),
      (try_end),

      (try_begin),
        (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),

        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (try_end),   
    ]),
  ]),

Please help

THANKS.
 
Cigic said:
Heraldic deployable pavise

Hi all,

I've spent too much time trying to resolve this.
When shiled spawns as a scene prop, instead of the heraldry I get only a black surface.


Here is  code:
module_items
["pavise", "Tower Shield",  [("tableau_shield_pavise_3_new" ,0)], itp_merchandise|itp_type_shield|itp_cant_use_on_horseback|itp_wooden_parry, itcf_carry_board_shield,470 , weight(6)|hit_points(500)|body_armor(1:cool:|spd_rtng(7:cool:|shield_width(43)|shield_height(90),imodbits_shield, [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_pavise_shield_3", ":agent_no", ":troop_no")])]],
module_tableau _materials
  ("pavise_shield_3a", 0, "sample_shield_matte", 512, 512, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),

      (init_position, pos1),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 120),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 116, 0),
      (init_position, pos1),
      (position_set_z, pos1, 10),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_shield_pavise_3", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

module_mission_templates

      #pavise
Pavise = (0, 0, 0,
        [],
        [

            (get_player_agent_no, ":player_agent"),
            (agent_get_position, pos2, ":player_agent"),
            #==click g && has pavise
            (try_begin),
                #(agent_has_item_equipped, ":player_agent", "itm_pavise"),
                (agent_get_wielded_item, ":shield_item", ":player_agent", 1),
                (eq, ":shield_item", "itm_pavise"),
                (key_clicked, key_g),
                (clear_omitted_keys),
         
                (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
                (position_move_y, pos2, 50),
                (set_spawn_position, pos2),

                (assign, ":pav_found", 0),#pf
                #FOR # props if prop at LATENT spot
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (eq, ":pav_found", 0),#pf
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (position_get_z, ":z_coor", pos3),
                    (eq, ":z_coor", -100*100),#-100 LATENT spot

                    (prop_instance_set_position, ":scene_prop_id", pos2),#pavise move
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                    (assign, ":pav_found", 1),#pf
                (try_end),

                (try_begin),
                    (lt, ":pav_found", 1),#pf

                    (spawn_scene_prop, "spr_pavise"),#pavise spawn
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                (try_end),
            (try_end),

            (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
            #==click h && near proped pavise
            (try_begin),
                (key_clicked, key_h),
                (clear_omitted_keys),
                #FOR # props if prop close to player
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (get_distance_between_positions, ":player_distance", pos2, pos3),
                    (le, ":player_distance", 100),

                    (position_set_z, pos3, -100*100),#-100 LATENT spot
                    (prop_instance_set_position, ":scene_prop_id", pos3),#pavise move

                    (set_spawn_position, pos2),
                    (position_move_y, pos2, 50),
                    (spawn_item, "itm_pavise"),#pavise spawn
                (try_end),
                #(scene_prop_set_visibility, ":scene_prop_id", 0),
                #(init_position, pos1),
            (try_end),

        ])
module_scene_props:
  ("pavise",sokf_moveable|sokf_destructible,"tableau_shield_pavise_prop_3","bo_tableau_shield_pavise_prop_3", [
    #check_castle_door_use_trigger,

  (ti_on_init_scene_prop,
    [  (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_3a", "trp_player"),
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
   
  (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),
   
      (assign, ":rotate_side", 86),
   
      (try_begin),
        (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),   
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),
   
        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),
   
        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        #(assign, reg0, ":z_difference"),
        #(display_message, "@{!}z dif : {reg0}"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]),     

    (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),     
      (store_trigger_param_2, ":damage"),
   
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
        (play_sound, "snd_dummy_hit"),
      (else_try),
        (neg|multiplayer_is_server),
        (play_sound, "snd_dummy_destroyed"),
      (try_end),

      (try_begin),
        (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),

        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (try_end),   
    ]),
  ]),

Please help

THANKS.

the problem may lay here, in module_scene_props:
Code:
(cur_scene_prop_set_tableau_material, "tableau_pavise_shield_3a", "trp_player"),
As header_operations describes this operation as:
Can only be used inside ti_on_init_scene_prop trigger in module_scene_props.py. Assigns tableau to the scene prop instance. Value of <instance_code> will be passed to tableau code. Commonly used for static banners.

Your tableau code is as follows:
Code:
(store_script_param, ":banner_mesh", 1),

       (set_fixed_point_multiplier, 100),

       (init_position, pos1),
       (position_set_x, pos1, 100),
       (position_set_y, pos1, 120),
       (cur_tableau_add_mesh, ":banner_mesh", pos1, 116, 0),
       (init_position, pos1),
       (position_set_z, pos1, 10),
       (cur_tableau_add_mesh, "mesh_tableau_mesh_shield_pavise_3", pos1, 0, 0),
       (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
Now, if you look there, you're expecting a banner mesh to be passed in (store_script_param, ":banner_mesh", 1), but you are passing a troop (trp_player).
 
kalarhan said:
KratosMKII said:
Edit: I run process_troops.py and in the console it says that it's exporting troop data. It then closes but it only generates .pyc files. What to do with them?

process_XXX.py creates the XXXX.txt files. So check your module folder and the new file should be there (as normal).

in other words: instead of creating ALL .txt files, you created just ONE .txt file.

*.pyc files can be ignored/removed (they are machine code created from the *.py files. It is a Python thingy. If curious you can google to learn more about it)
Problem is that it generates only the .pyc files. When i go to the output module folder, the troop file hasn't changed at all. I went through each file and checked the dependencies. It also doesn't generate the file if i execute it in a folder with all the module files.
 
KratosMKII said:
Problem is that it generates only the .pyc files

there is no secret here. If your module system is compiling, you can run any of the files (taking care of dependencies). Remember to check your module_info.py for the path.

on a console/terminal you can run the command "python process_troops.py"

or just create a new .bat file for that
 
kalarhan said:
KratosMKII said:
Problem is that it generates only the .pyc files

there is no secret here. If your module system is compiling, you can run any of the files (taking care of dependencies). Remember to check your module_info.py for the path.

on a console/terminal you can run the command "python process_troops.py"

or just create a new .bat file for that
I made a bat file but this is what i get:
Code:
C:\Users\Username\Desktop\Troop>process_troops.py
Exporting troops data
Traceback (most recent call last):
  File "C:\Users\Username\Desktop\Troop\process_troops.py", line 110, in <module>

    save_troops()
  File "C:\Users\Username\Desktop\Troop\process_troops.py", line 38, in save_troo
ps
    for inventory_item in inventory_list:
TypeError: 'long' object is not iterable
 
KratosMKII said:
I made a bat file but this is what i get:

fix your bugs and syntax errors, verify any special dependency. If build_module.bat works, you can run troops by itself as well. As one is just a small part of the other.
 
Arch3r said:
Cigic said:
Heraldic deployable pavise

Hi all,

I've spent too much time trying to resolve this.
When shiled spawns as a scene prop, instead of the heraldry I get only a black surface.


Here is  code:
module_items
["pavise", "Tower Shield",  [("tableau_shield_pavise_3_new" ,0)], itp_merchandise|itp_type_shield|itp_cant_use_on_horseback|itp_wooden_parry, itcf_carry_board_shield,470 , weight(6)|hit_points(500)|body_armor(1:cool:|spd_rtng(7:cool:|shield_width(43)|shield_height(90),imodbits_shield, [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_pavise_shield_3", ":agent_no", ":troop_no")])]],
module_tableau _materials
  ("pavise_shield_3a", 0, "sample_shield_matte", 512, 512, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),

      (init_position, pos1),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 120),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 116, 0),
      (init_position, pos1),
      (position_set_z, pos1, 10),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_shield_pavise_3", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

module_mission_templates

      #pavise
Pavise = (0, 0, 0,
        [],
        [

            (get_player_agent_no, ":player_agent"),
            (agent_get_position, pos2, ":player_agent"),
            #==click g && has pavise
            (try_begin),
                #(agent_has_item_equipped, ":player_agent", "itm_pavise"),
                (agent_get_wielded_item, ":shield_item", ":player_agent", 1),
                (eq, ":shield_item", "itm_pavise"),
                (key_clicked, key_g),
                (clear_omitted_keys),
         
                (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
                (position_move_y, pos2, 50),
                (set_spawn_position, pos2),

                (assign, ":pav_found", 0),#pf
                #FOR # props if prop at LATENT spot
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (eq, ":pav_found", 0),#pf
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (position_get_z, ":z_coor", pos3),
                    (eq, ":z_coor", -100*100),#-100 LATENT spot

                    (prop_instance_set_position, ":scene_prop_id", pos2),#pavise move
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                    (assign, ":pav_found", 1),#pf
                (try_end),

                (try_begin),
                    (lt, ":pav_found", 1),#pf

                    (spawn_scene_prop, "spr_pavise"),#pavise spawn
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                (try_end),
            (try_end),

            (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
            #==click h && near proped pavise
            (try_begin),
                (key_clicked, key_h),
                (clear_omitted_keys),
                #FOR # props if prop close to player
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (get_distance_between_positions, ":player_distance", pos2, pos3),
                    (le, ":player_distance", 100),

                    (position_set_z, pos3, -100*100),#-100 LATENT spot
                    (prop_instance_set_position, ":scene_prop_id", pos3),#pavise move

                    (set_spawn_position, pos2),
                    (position_move_y, pos2, 50),
                    (spawn_item, "itm_pavise"),#pavise spawn
                (try_end),
                #(scene_prop_set_visibility, ":scene_prop_id", 0),
                #(init_position, pos1),
            (try_end),

        ])
module_scene_props:
  ("pavise",sokf_moveable|sokf_destructible,"tableau_shield_pavise_prop_3","bo_tableau_shield_pavise_prop_3", [
    #check_castle_door_use_trigger,

  (ti_on_init_scene_prop,
    [  (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_3a", "trp_player"),
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
   
  (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),
   
      (assign, ":rotate_side", 86),
   
      (try_begin),
        (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),   
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),
   
        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),
   
        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        #(assign, reg0, ":z_difference"),
        #(display_message, "@{!}z dif : {reg0}"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]),     

    (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),     
      (store_trigger_param_2, ":damage"),
   
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
        (play_sound, "snd_dummy_hit"),
      (else_try),
        (neg|multiplayer_is_server),
        (play_sound, "snd_dummy_destroyed"),
      (try_end),

      (try_begin),
        (this_or_next|multiplayer_is_server),
      (neg|game_in_multiplayer_mode),

        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (try_end),   
    ]),
  ]),

Please help

THANKS.

the problem may lay here, in module_scene_props:
Code:
(cur_scene_prop_set_tableau_material, "tableau_pavise_shield_3a", "trp_player"),
As header_operations describes this operation as:
Can only be used inside ti_on_init_scene_prop trigger in module_scene_props.py. Assigns tableau to the scene prop instance. Value of <instance_code> will be passed to tableau code. Commonly used for static banners.

Your tableau code is as follows:
Code:
(store_script_param, ":banner_mesh", 1),

       (set_fixed_point_multiplier, 100),

       (init_position, pos1),
       (position_set_x, pos1, 100),
       (position_set_y, pos1, 120),
       (cur_tableau_add_mesh, ":banner_mesh", pos1, 116, 0),
       (init_position, pos1),
       (position_set_z, pos1, 10),
       (cur_tableau_add_mesh, "mesh_tableau_mesh_shield_pavise_3", pos1, 0, 0),
       (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
Now, if you look there, you're expecting a banner mesh to be passed in (store_script_param, ":banner_mesh", 1), but you are passing a troop (trp_player).

Yep, thanks a lot, very well spotted.  Most of them expect troop to be passed in.

I passed the mesh this way:

  (ti_on_init_scene_prop,
    [  (store_trigger_param_1, ":instance_no"),
        (store_trigger_param_2, ":agent_no"),
        (agent_get_troop_id, ":troop_no", ":agent_no"),
        (call_script, "script_agent_troop_get_banner_mesh", ":agent_no", ":troop_no"),
(assign, ":mesh", reg0),
    (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_3a", ":mesh"),
        (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
   

and now it works!!
*EDIT Sometime works sometimes shows wrong banner, sometimes default red and black.

But I get this error:
295fyv6.jpg



Here is agent_troop_get_banner_mesh script:

  #script_agent_troop_get_banner_mesh
  # INPUT: agent_no, troop_no
  # OUTPUT: banner_mesh
  ("agent_troop_get_banner_mesh",
    [
      (store_script_param, ":agent_no", 1),
      (store_script_param, ":troop_no", 2),
      (assign, ":banner_troop", -1),
      (assign, ":banner_mesh", "mesh_banners_default_b"),
      (try_begin),
        (lt, ":agent_no", 0),
        (try_begin),
          (ge, ":troop_no", 0),
          (this_or_next|troop_slot_ge, ":troop_no", slot_troop_banner_scene_prop, 1),
          (eq, ":troop_no", "trp_player"),
          (assign, ":banner_troop", ":troop_no"),
        (else_try),
          (is_between, ":troop_no", companions_begin, companions_end),
          (assign, ":banner_troop", "trp_player"),
        (else_try),
          (assign, ":banner_mesh", "mesh_banners_default_a"),
        (try_end),
      (else_try),
        (eq, "$g_is_quick_battle", 1),
        (agent_get_team, ":agent_team", ":agent_no"),
        (try_begin),
          (eq, ":agent_team", 0),
          (assign, ":banner_mesh", "$g_quick_battle_team_0_banner"),
        (else_try),
          (assign, ":banner_mesh", "$g_quick_battle_team_1_banner"),
        (try_end),
      (else_try),
        (game_in_multiplayer_mode),
        (agent_get_group, ":agent_group", ":agent_no"),
        (try_begin),
          (neg|player_is_active, ":agent_group"),
          (agent_get_player_id, ":agent_group", ":agent_no"),
        (try_end),
        (try_begin),
          #if player banners are not allowed, use the default banner mesh
          (eq, "$g_multiplayer_allow_player_banners", 1),
          (player_is_active, ":agent_group"),
          (player_get_banner_id, ":player_banner", ":agent_group"),
          (ge, ":player_banner", 0),
          (store_add, ":banner_mesh", ":player_banner", arms_meshes_begin),
          (assign, ":already_used", 0),
          (try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end), #wrong client data check
            (faction_slot_eq, ":cur_faction", slot_faction_banner, ":banner_mesh"),
            (assign, ":already_used", 1),
          (try_end),
          (eq, ":already_used", 0), #otherwise use the default banner mesh
        (else_try),
          (agent_get_team, ":agent_team", ":agent_no"),
          (team_get_faction, ":team_faction_no", ":agent_team"),

          (try_begin),
            (agent_is_human, ":agent_no"),
            (faction_get_slot, ":banner_mesh", ":team_faction_no", slot_faction_banner),
          (else_try),
            (agent_get_rider, ":rider_agent_no", ":agent_no"),
            #(agent_get_position, pos1, ":agent_no"),
            #(position_get_x, ":pos_x", pos1),
            #(position_get_y, ":pos_y", pos1),
            #(assign, reg0, ":pos_x"),
            #(assign, reg1, ":pos_y"),
            #(assign, reg2, ":agent_no"),
            #(display_message, "@{!}agent_no:{reg2}, pos_x:{reg0} , posy:{reg1}"),
            (try_begin),
              (ge, ":rider_agent_no", 0),
              (agent_is_active, ":rider_agent_no"),
              (agent_get_team, ":rider_agent_team", ":rider_agent_no"),
              (team_get_faction, ":rider_team_faction_no", ":rider_agent_team"),
              (faction_get_slot, ":banner_mesh", ":rider_team_faction_no", slot_faction_banner),
            (else_try),
              (assign, ":banner_mesh", "mesh_banners_default_c"),
            (try_end),
          (try_end),
        (try_end),
      (else_try),
        (agent_get_troop_id, ":troop_id", ":agent_no"),
        (this_or_next|troop_slot_ge,  ":troop_id", slot_troop_banner_scene_prop, 1),
        (eq, ":troop_no", "trp_player"),
        (assign, ":banner_troop", ":troop_id"),
      (else_try),
        (agent_get_party_id, ":agent_party", ":agent_no"),
        (try_begin),
          (lt, ":agent_party", 0),
          (is_between, ":troop_id", companions_begin, companions_end),
          (main_party_has_troop, ":troop_id"),
          (assign, ":agent_party", "p_main_party"),
        (try_end),
        (ge, ":agent_party", 0),
        (party_get_template_id, ":party_template", ":agent_party"),
        (try_begin),
          (eq, ":party_template", "pt_deserters"),
          (assign, ":banner_mesh", "mesh_banners_default_c"),
        (else_try),
          (is_between, ":agent_party", centers_begin, centers_end),
          (is_between, ":troop_id", companions_begin, companions_end),
          (neq, "$talk_context", tc_tavern_talk),
          #this should be a captured companion in prison
          (assign, ":banner_troop", "trp_player"),
        (else_try),
          (is_between, ":agent_party", centers_begin, centers_end),
          (party_get_slot, ":town_lord", "$g_encountered_party", slot_town_lord),
          (ge, ":town_lord", 0),
          (assign, ":banner_troop", ":town_lord"),
        (else_try),
          (this_or_next|party_slot_eq, ":agent_party", slot_party_type, spt_kingdom_hero_party),
          (eq, ":agent_party", "p_main_party"),
          (party_get_num_companion_stacks, ":num_stacks", ":agent_party"),
          (gt, ":num_stacks", 0),
          (party_stack_get_troop_id, ":leader_troop_id", ":agent_party", 0),
          (this_or_next|troop_slot_ge,  ":leader_troop_id", slot_troop_banner_scene_prop, 1),
          (eq, ":leader_troop_id", "trp_player"),
          (assign, ":banner_troop", ":leader_troop_id"),
        (try_end),
      (else_try), #Check if we are in a tavern
        (eq, "$talk_context", tc_tavern_talk),
        (neq, ":troop_no", "trp_player"),
        (assign, ":banner_mesh", "mesh_banners_default_d"),
      (else_try), #can't find party, this can be a town guard
        (neq, ":troop_no", "trp_player"),
        (is_between, "$g_encountered_party", walled_centers_begin, walled_centers_end),
        (party_get_slot, ":town_lord", "$g_encountered_party", slot_town_lord),
        (ge, ":town_lord", 0),
        (assign, ":banner_troop", ":town_lord"),
      (try_end),
      (try_begin),
        (ge, ":banner_troop", 0),
        (try_begin),
          (neg|troop_slot_ge, ":banner_troop", slot_troop_banner_scene_prop, 1),
          (assign, ":banner_mesh", "mesh_banners_default_b"),
        (else_try),
          (troop_get_slot, ":banner_spr", ":banner_troop", slot_troop_banner_scene_prop),
          (store_add, ":banner_scene_props_end", banner_scene_props_end_minus_one, 1),
          (is_between, ":banner_spr", banner_scene_props_begin, ":banner_scene_props_end"),
          (val_sub, ":banner_spr", banner_scene_props_begin),
          (store_add, ":banner_mesh", ":banner_spr", arms_meshes_begin),
        (try_end),
      (try_end),
      (assign, reg0, ":banner_mesh"),
    ]),


Please help.
Thanks.
 
Don't hook the code on a 0,0,0 trigger, there's a specific one just for dropping items
Code:
ti_on_item_dropped
You can't just add random parameters to triggers and hope it works. I recommend storing the player agent's id in a global and use it inside the init code, or store the banner mesh directly and pass that into the scene prop to pass to the tableau.
 
Somebody said:
Don't hook the code on a 0,0,0 trigger, there's a specific one just for dropping items
Code:
ti_on_item_dropped
You can't just add random parameters to triggers and hope it works. I recommend storing the player agent's id in a global and use it inside the init code, or store the banner mesh directly and pass that into the scene prop to pass to the tableau.

Thank you for quick response and guidance.

Would you be so kind to write me one option in more detail?
Thank you.
 
Cigic said:
Would you be so kind to write me one option in more detail?

see header_triggers.py for the list of triggers and parameters for each type. You cant use a item trigger on a scene prop, or a item trigger on a mission template trigger, and so on.

Code:
# SCENE PROP TRIGGERS (used in module_scene_props)

ti_on_scene_prop_init               = -40.0 # A scene prop instance has been created on the scene.

ti_on_init_scene_prop               = ti_on_scene_prop_init # Alternate syntax
    # trigger param 1 = prop instance_id reference

ti_on_scene_prop_hit                = -42.0 # A scene prop has been hit by some agent.
    # Note that on client-side in multiplayer missions only trigger param 1 and position registers are available. Trigger params 2..7 are only available to server or in singleplayer.
    # trigger param 1 = prop instance_id reference
    # trigger param 2 = amount of damage delivered to the scene prop (not available on client side in multiplayer)
    # trigger param 3 = attacker agent_id (not available on client side in multiplayer)
    # trigger param 4 = item_id of the weapon used to attack
    # trigger param 5 = weapon item modifier
    # trigger param 6 = item_id of missile used to attack (if attack was by ranged weapon)
    # trigger param 7 = missile item modifier
    # pos1            = position of the hit area
    # pos2            = X field holds attacker's agent_id reference
    # Trigger Result: if set, damage dealt to prop

ti_on_scene_prop_destroy            = -43.0 # A destructible scene prop has been destroyed by some agent. Does not fire on client side in multiplayer missions.
    # trigger param 1 = prop instance_id reference
    # trigger param 2 = attacker agent_id

ti_on_scene_prop_start_use          = -47.0 # An agent is attempting to activate a usable scene prop. Useful if you want a scene prop to be activated instantly without any timeout. Does not fire on client side in multiplayer missions.
    # trigger param 1 = agent_id of the agent who has started using the scene prop
    # trigger param 2 = prop instance_id reference

ti_on_scene_prop_cancel_use         = -48.0 # An agent has cancelled using the scene prop. Does not fire on client side in multiplayer missions.
    # trigger param 1 = agent_id of the agent who cancelled using the scene prop
    # trigger param 2 = prop instance_id reference

ti_on_scene_prop_use                = -44.0 # A usable scene prop has been activated by some agent. Does not fire on client side in multiplayer missions.
    # trigger param 1 = agent_id of the agent who activated the scene prop
    # trigger param 2 = prop instance_id reference

ti_on_scene_prop_is_animating       = -45.0 # Called each frame when a scene prop is animating.
    # trigger param 1 = prop instance_id reference
    # trigger param 2 = remaining animation time (apparently in 1/100th of second).

ti_on_scene_prop_animation_finished = -46.0 # Animation sequence has been completed for a scene prop.
    # trigger param 1 = prop instance_id reference

ti_scene_prop_deformation_finished  = -76.0 # Deformation sequence has been completed for a scene prop.
    # trigger param 1 = prop instance_id reference
^ example above is for props

For how to use variables like globals read https://forums.taleworlds.com/index.php/topic,142422.0.html
 
kalarhan said:
Cigic said:
Would you be so kind to write me one option in more detail?

see header_triggers.py for the list of triggers and parameters for each type. You cant use a item trigger on a scene prop, or a item trigger on a mission template trigger, and so on.

Code:
# SCENE PROP TRIGGERS (used in module_scene_props)

ti_on_scene_prop_init               = -40.0 # A scene prop instance has been created on the scene.

ti_on_init_scene_prop               = ti_on_scene_prop_init # Alternate syntax
    # trigger param 1 = prop instance_id reference

ti_on_scene_prop_hit                = -42.0 # A scene prop has been hit by some agent.
    # Note that on client-side in multiplayer missions only trigger param 1 and position registers are available. Trigger params 2..7 are only available to server or in singleplayer.
    # trigger param 1 = prop instance_id reference
    # trigger param 2 = amount of damage delivered to the scene prop (not available on client side in multiplayer)
    # trigger param 3 = attacker agent_id (not available on client side in multiplayer)
    # trigger param 4 = item_id of the weapon used to attack
    # trigger param 5 = weapon item modifier
    # trigger param 6 = item_id of missile used to attack (if attack was by ranged weapon)
    # trigger param 7 = missile item modifier
    # pos1            = position of the hit area
    # pos2            = X field holds attacker's agent_id reference
    # Trigger Result: if set, damage dealt to prop

ti_on_scene_prop_destroy            = -43.0 # A destructible scene prop has been destroyed by some agent. Does not fire on client side in multiplayer missions.
    # trigger param 1 = prop instance_id reference
    # trigger param 2 = attacker agent_id

ti_on_scene_prop_start_use          = -47.0 # An agent is attempting to activate a usable scene prop. Useful if you want a scene prop to be activated instantly without any timeout. Does not fire on client side in multiplayer missions.
    # trigger param 1 = agent_id of the agent who has started using the scene prop
    # trigger param 2 = prop instance_id reference

ti_on_scene_prop_cancel_use         = -48.0 # An agent has cancelled using the scene prop. Does not fire on client side in multiplayer missions.
    # trigger param 1 = agent_id of the agent who cancelled using the scene prop
    # trigger param 2 = prop instance_id reference

ti_on_scene_prop_use                = -44.0 # A usable scene prop has been activated by some agent. Does not fire on client side in multiplayer missions.
    # trigger param 1 = agent_id of the agent who activated the scene prop
    # trigger param 2 = prop instance_id reference

ti_on_scene_prop_is_animating       = -45.0 # Called each frame when a scene prop is animating.
    # trigger param 1 = prop instance_id reference
    # trigger param 2 = remaining animation time (apparently in 1/100th of second).

ti_on_scene_prop_animation_finished = -46.0 # Animation sequence has been completed for a scene prop.
    # trigger param 1 = prop instance_id reference

ti_scene_prop_deformation_finished  = -76.0 # Deformation sequence has been completed for a scene prop.
    # trigger param 1 = prop instance_id reference
^ example above is for props

For how to use variables like globals read https://forums.taleworlds.com/index.php/topic,142422.0.html

SOLVED!
 
While I'm getting my mod ready for release I remembered that I use some Mount&Blade 1.011 scenes. Although the resources they use are all present in Warband, would it be a breach of copyrights (hope not, I love M&B scenes)?
 
Janycz said:
Hello! How can I fix such a bug with red-green water? (Bug with cows on water I fixed: I deleted TexturesHD).

are you using the latest Warband (1.174)? Do you still have the texture issue with a new Native campaign - cows invasion? From there compare the differences with your old assets on your mod.
 
kalarhan said:
Janycz said:
Hello! How can I fix such a bug with red-green water? (Bug with cows on water I fixed: I deleted TexturesHD).

are you using the latest Warband (1.174)? Do you still have the texture issue with a new Native campaign - cows invasion? From there compare the differences with your old assets on your mod.
Recently I fixed an issue with red-green-black water. I just offed HDR in game options. No HDR = no bug. :grin:
 
Status
Not open for further replies.
Back
Top Bottom