PYTHON SCRIPT/SCHEME EXCHANGE

Best answers
0
So i have this script:
Code:
      ("sea_travel",
       [
           (party_slot_eq,"$current_town",slot_party_type, spt_town)
        ],
         "Leave for Costa del Sol.",
         [
           (try_begin),
             (call_script, "script_cf_enter_center_location_bandit_check"),
           (else_try),
             (party_relocate_near_party,"p_main_party","p_village_9"),
             (change_screen_return),
           (try_end),
          ]),
What it does is enabling the player to travel to a specific village from the town menu.
But i need to make it only appear in a specific town, how do i do that?
 

Amman d Stazia

Master Knight
Best answers
0
Sheriff-murder said:
So i have this script:
Code:
      ("sea_travel",
       [
           (party_slot_eq,"$current_town",slot_party_type, spt_town)
        ],
         "Leave for Costa del Sol.",
         [
           (try_begin),
             (call_script, "script_cf_enter_center_location_bandit_check"),
           (else_try),
             (party_relocate_near_party,"p_main_party","p_village_9"),
             (change_screen_return),
           (try_end),
          ]),
What it does is enabling the player to travel to a specific village from the town menu.
But i need to make it only appear in a specific town, how do i do that?
replace
          (party_slot_eq,"$current_town",slot_party_type, spt_town)
with an operation to identify a specific town,

eg  (eq,"$current_town",p_zendar)
 

Amman d Stazia

Master Knight
Best answers
0
Kt0 - can this be applied to horses too?  To make a horse level up with the player?
I'm envisaging that as the player levels up, the horse gets stronger and faster (combat training, better feed, muscle development, etc)...

On further reading of your script I guess the answer is negative - the script swaps the item for a (better_item) - or else as one of the others said, you can add stats to the player...
 

MaverickJones

Sergeant
WBNWWF&S
Best answers
0
I made this random script to make companions get you troops for a price a little higher than going round all the villages, and a cheat that makes them give you 20000 gold  :cool:
I made it because i couldn't find anything about making a recruiter script when i was starting out, thought it might be useful for new modders.
Search for 'member_question_2 in module_dialogs.py
and insert this code underneath.

Code:
# Maverick Companion thing start
#Gain 20000 gold randomly if cheat mode is on
[anyone|plyr,"member_question_2", [(eq,"$cheat_mode",1)], "Cheat: Could you give me some cash from that large pot of gold?", "member_moneys",[]],
#recruit troops for a price
[anyone|plyr,"member_question_2", [], "Could you draft in some troops for me?", "member_draft_question",[]],


  [anyone, "member_moneys", [
	    (call_script, "script_troop_add_gold", "trp_player", 20000),
		], "Sure why not, there is plenty in here", "do_member_view_char",[]],
		
  [anyone, "member_draft_question", [], "So what kind of troops do you want me to get?", "member_draft_troop",[]],

  #Choose what troops you want
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Caravan guards.", "member_draft_troop_2",[ (assign, "$cost_draft", 400),(assign, "$draft_id", "trp_caravan_guard"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Watchmen.", "member_draft_troop_2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_watchman")]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Huntresses.", "member_draft_troop_2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_hunter_woman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Swadian recruits.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_swadian_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Vaegir recruits.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_vaegir_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Khergit tribesmen.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_khergit_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Nord recruits.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_nord_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Rhodok tribesmen.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_rhodok_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Looters.", "member_draft_troop_2",[(assign, "$cost_draft", 50), (assign, "$draft_id", "trp_looter"),]],
  [anyone|plyr,"member_draft_troop", [], "Never mind.", "close_window",[]],
  
  [anyone,"member_draft_troop_2",[
  		(party_add_members, "p_main_party", "$draft_id", 10),
		(troop_remove_gold, "trp_player", "$cost_draft"),
		], "It didn't take much to convince them to join you, Hope they serve you well.", "do_member_view_char",[]],
# Maverick Companion thing End
 

kt0

Knight
Best answers
0
Amman de Stazia said:
Kt0 - can this be applied to horses too?  To make a horse level up with the player?
I'm envisaging that as the player levels up, the horse gets stronger and faster (combat training, better feed, muscle development, etc)...

On further reading of your script I guess the answer is negative - the script swaps the item for a (better_item) - or else as one of the others said, you can add stats to the player...
Actually, yes, this can be applied to horses (I'm adding one to Conquest).  Clever construction of item data can swap out items seamlessly from the player's point of view.  Skill bonuses are strictly optional.  The window dressing around the system can also be trivially changed to be less magicky.  The only possible caveats are if you're hiding data in item slots or keeping a hold of item IDs elsewhere at which point you'd need to do the crossref patchups when swapping the item.

Example horse item levels:
[
"silverhoof_l1",
"Silverhoof",
[("saddle_horse", 0)],
itp_type_horse|itp_merchandise,
0,
1,
abundance(0)|body_armor(20)|difficulty(3)|hit_points(150)|horse_maneuver(43)|horse_speed(42)|horse_charge(22),
imodbits_horse_basic|imodbit_champion
],

[
"silverhoof_l2",
"Silverhoof",
[("saddle_horse", 0)],
itp_type_horse|itp_merchandise,
0,
1,
abundance(0)|body_armor(22)|difficulty(3)|hit_points(160)|horse_maneuver(44)|horse_speed(43)|horse_charge(24),
imodbits_horse_basic|imodbit_champion
],

[
"silverhoof_l3",
"Silverhoof",
[("saddle_horse", 0)],
itp_type_horse|itp_merchandise,
0,
1,
abundance(0)|body_armor(24)|difficulty(3)|hit_points(170)|horse_maneuver(45)|horse_speed(44)|horse_charge(26),
imodbits_horse_basic|imodbit_champion
],

My entries are a little more complicated than that because I've hacked the compilation process to write the code that sets up the slots for me (I'm lazy like that).  If you'd like to see that stuff, feel free to PM me. 
 

Amman d Stazia

Master Knight
Best answers
0
Thanks kt0.

Mrs de Stazia cobbled together something, implementing a new skill to decide whether the horse gets 'upgraded' or not, rather than using XP.

Can't publish it just yet, it might become part of TPW and it'll be up to the team to decide if anything should be open sourced.
 

rubik

Squire
Best answers
0
There is a big problem about upgrading the regulars all the time that you can only upgrade them one by one. If 100  regulars can upgrade, you need to click left mouse button 100 times.

I have write some code to solve the problem.

Source code:

At first, define slot_root_troop in module_constants.py, it is a troop slot. make sure it does not clash with your mod's other slot usage.

Paste the following into module_scripts.py
########################################################
## Easy regulars upgrading kit begin
########################################################
("calculate_upgrade_troops",
  [
    (call_script, "script_party_copy", "p_temp_party", "p_main_party"), ## before
    ## upgrade all troops in first upgrade path with total 1 xp
    ## everyone get 0 xp at last, but they all upgraded
    (party_upgrade_with_xp, "p_main_party", 1, 1),
    (call_script, "script_party_copy", "p_temp_party_2", "p_main_party"), ## after
   
    ## remove prisoners and heroes
    (call_script, "script_party_remove_all_prisoners", "p_temp_party"),
    (call_script, "script_party_remove_all_prisoners", "p_temp_party_2"),
    (call_script, "script_party_remove_heroes", "p_temp_party"),
    (call_script, "script_party_remove_heroes", "p_temp_party_2"),
   
    ## Initialize trp_temp_array_a, trp_temp_array_b, trp_temp_array_c
    (try_for_range, ":slot_no", 0, 32),
      (troop_set_slot, "trp_temp_array_a", ":slot_no", -1),
      (troop_set_slot, "trp_temp_array_b", ":slot_no", 0),
      (troop_set_slot, "trp_temp_array_c", ":slot_no", 0),
    (try_end),
   
    (assign, ":slot_id", 0),
    (assign, ":num_times", 1),
    (try_for_range, ":unused", 0, ":num_times"),
      ## find all current root troops
      (party_get_num_companion_stacks, ":num_stacks", "p_temp_party"),
      (try_for_range, ":cur_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":cur_troop", "p_temp_party", ":cur_stack"),
        (troop_set_slot, ":cur_troop", slot_root_troop, 1),
      (try_end),
     
      (try_for_range, ":cur_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":cur_troop", "p_temp_party", ":cur_stack"),
        (troop_get_upgrade_troop, ":upgrade_troop", ":cur_troop", 0),
        (gt, ":upgrade_troop", 0),
        (call_script, "script_party_has_troop", "p_temp_party", ":upgrade_troop"),
        (eq, reg0, 1),
        (troop_set_slot, ":upgrade_troop", slot_root_troop, 0), ## not a root troop
      (try_end),
     
      ## calculate upgrade troops and upgrade size
      (try_for_range_backwards, ":cur_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":cur_troop", "p_temp_party", ":cur_stack"),
        (gt, ":cur_troop", 0),
        (troop_slot_eq, ":cur_troop", slot_root_troop, 1),
        (party_stack_get_size, ":stack_size", "p_temp_party", ":cur_stack"),
       
        (call_script, "script_party_has_troop", "p_temp_party_2", ":cur_troop"),
        (try_begin),
          (eq, reg0, 0),
          (assign, ":stack_size_2", 0),
        (else_try),
          (party_get_num_companion_stacks, ":num_stacks_2", "p_temp_party_2"),
          (try_for_range, ":cur_stack_2", 0, ":num_stacks_2"),
            (party_stack_get_troop_id, ":cur_troop_2", "p_temp_party_2", ":cur_stack_2"),
            (eq, ":cur_troop_2", ":cur_troop"),
            (party_stack_get_size, ":stack_size_2", "p_temp_party_2", ":cur_stack_2"),
          (try_end),
        (try_end),
       
        (try_begin),
          (val_sub, ":stack_size", ":stack_size_2"),
          (gt, ":stack_size", 0),
          ## reduce the first upgrade path size
          (troop_get_upgrade_troop, ":upgrade_troop", ":cur_troop", 0),
          (party_remove_members, "p_temp_party_2", ":upgrade_troop", ":stack_size"),
          ## reduce the first upgrade path size
          (troop_set_slot, "trp_temp_array_a", ":slot_id", ":cur_troop"), ## troop which can upgrade
          (troop_set_slot, "trp_temp_array_b", ":slot_id", ":stack_size"), ## troop upgrade size
          (troop_set_slot, "trp_temp_array_c", ":slot_id", 0), ## troop upgrade second path size
          (val_add, ":slot_id", 1),
        (try_end),
       
        ## remove current root troop
        (call_script, "script_party_remove_troop", "p_temp_party", ":cur_troop"),
        (call_script, "script_party_remove_troop", "p_temp_party_2", ":cur_troop"),
      (try_end),
     
      ## do the loop once more?
      (try_begin),
        (party_get_num_companion_stacks, ":num_stacks", "p_temp_party"),
        (gt, ":num_stacks", 0),
        (val_add, ":num_times", 1), ## once more
      (try_end),
    (try_end),
  ]),

("party_has_troop",
  [
    (store_script_param_1, ":party_no"),
    (store_script_param_2, ":troop_no"),
   
    (assign, reg0, 0),
    (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
    (try_for_range, ":cur_stack", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
      (eq, ":cur_troop", ":troop_no"),
      (assign, reg0, 1),
      (assign, ":num_stacks", 0), #end the loop
    (try_end),
  ]),

("party_remove_troop",
  [
    (store_script_param_1, ":party_no"),
    (store_script_param_2, ":troop_no"),
   
    (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
    (try_for_range, ":cur_stack", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
      (eq, ":cur_troop", ":troop_no"),
      (party_stack_get_size, ":stack_size", ":party_no", ":cur_stack"),
      (party_remove_members, ":party_no", ":troop_no", ":stack_size"),
    (try_end),
  ]),

("party_remove_heroes",
  [
    (store_script_param_1, ":party_no"),
   
    (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
    (try_for_range_backwards, ":cur_stack", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
      (troop_is_hero, ":cur_troop"),
      (party_remove_members, ":party_no", ":cur_troop", 1),
    (try_end),
  ]),

("has_enough_slot",
  [
    (party_clear, "p_temp_party"),
    (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
    (try_for_range, ":stack_no", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", "p_main_party", ":stack_no"),
      (try_begin),
        (troop_get_upgrade_troop, ":upgraded_troop_1", ":cur_troop", 0),
        (gt, ":upgraded_troop_1", 0),
        (neg|main_party_has_troop, ":upgraded_troop_1"),
        (party_add_members, "p_temp_party", ":upgraded_troop_1", 1),
      (else_try),
        (troop_get_upgrade_troop, ":upgraded_troop_2", ":cur_troop", 1),
        (gt, ":upgraded_troop_2", 0),
        (neg|main_party_has_troop, ":upgraded_troop_2"),
        (party_add_members, "p_temp_party", ":upgraded_troop_2", 1),
      (try_end),
    (try_end),
    (store_num_free_stacks, ":free_stacks", "p_main_party"),
    (party_get_num_companion_stacks, ":num_stack_increase", "p_temp_party"),
   
    (try_begin),
      (ge, ":free_stacks", ":num_stack_increase"),
      (assign, reg0, 1),
    (else_try),
      (assign, reg0, 0),
    (try_end),
  ]),
########################################################
## Easy regulars upgrading kit end
########################################################

The following into module_game_menus.py:
      ("camp_action_1",[(eq,"$cheat_mode",1)],"Cheat: Walk around.",
      [(set_jump_mission,"mt_ai_training"),
        (call_script, "script_setup_random_scene"),
        (change_screen_mission),
        ]
      ),
########################################################
## Easy regulars upgrading kit begin
########################################################
    ("camp_upgrade_troops",
      [
        (call_script, "script_has_enough_slot"),
        (eq, reg0, 1),
      ],
    "Upgrade your troops.", [(jump_to_menu, "mnu_ready_upgrade")]),
   
    ("camp_upgrade_troops_no",
      [
        (call_script, "script_has_enough_slot"),
        (eq, reg0, 0),
        (disable_menu_option),
      ],
    "No slot for upgrading.", []),
########################################################
## Easy regulars upgrading kit end
########################################################
########################################################
## Easy regulars upgrading kit begin
########################################################
  ("ready_upgrade", 0,
  "{s0}",
    "none",
    [
      ## use reg10 to record wheather can continue or not
      ## use reg11 to record the progress of upgrading
      (try_begin),
        (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
        (eq, ":num_stacks", 1),
        (str_store_string, s0, "@ No one can upgrade."),
        (assign, reg10, 0),
      (else_try),
        (call_script, "script_calculate_upgrade_troops"),
        (try_begin),
          (troop_slot_eq, "trp_temp_array_a", 0, -1),
          (str_store_string, s0, "@ No one can upgrade."),
          (assign, reg10, 0),
        (else_try),
          (assign, reg10, 1),
          (assign, ":kinds_of_upgrade_troop", 0),
          (try_for_range, ":slot_id", 0, 32),
            (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_id"),
            (troop_get_slot, ":upgrade_size", "trp_temp_array_b", ":slot_id"),
            (gt, ":upgrade_troop", 0),
            (try_begin),
              (eq, ":kinds_of_upgrade_troop", 0),
              (str_store_troop_name_by_count, s1, ":upgrade_troop", ":upgrade_size"),
              (assign, reg1, ":upgrade_size"),
              (str_store_string, s0, "@{reg1} {s1} can upgrade."),
            (else_try),
              (eq, ":kinds_of_upgrade_troop", 1),
              (str_store_troop_name_by_count, s1, ":upgrade_troop", ":upgrade_size"),
              (assign, reg1, ":upgrade_size"),
              (str_store_string, s0, "@{reg1} {s1} and {s0}"),
            (else_try),
              (str_store_troop_name_by_count, s1, ":upgrade_troop", ":upgrade_size"),
              (assign, reg1, ":upgrade_size"),
              (str_store_string, s0, "@{reg1} {s1}, {s0}"),
            (try_end),
            (val_add, ":kinds_of_upgrade_troop", 1),
          (try_end),
        (try_end),
      (try_end),
    ],
    [
      ("upgrade_back", [(eq, reg10, 0)],
        "Go back.",
        [(jump_to_menu, "mnu_camp")]
      ),
     
      ("upgrade_continue", [(eq, reg10, 1)],
        "Continue...",
        [
          (jump_to_menu, "mnu_camp"),
          (assign, reg11, 0),
          (start_presentation, "prsnt_upgrade_troops"),
        ]
      ),
    ]
  ),
########################################################
## Easy regulars upgrading kit end
########################################################

The following into module_presentations.py:
########################################################   
## Easy regulars upgrading kit begin
########################################################
  ("upgrade_troops", 0, mesh_load_window, [
  (ti_on_presentation_load,
    [
      (set_fixed_point_multiplier, 1000),
      (presentation_set_duration, 999999),
     
      (assign, ":slot_id", reg11),
      ## upgrade troop and total size
      # upgrade size will not change
      (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_id"),
      (troop_get_slot, ":upgrade_size", "trp_temp_array_b", ":slot_id"),
      (str_store_troop_name_by_count, s0, ":upgrade_troop", ":upgrade_size"),
      (assign, reg3, ":upgrade_size"),
     
      ## upgrade 2nd path: troop and size
      (troop_get_slot, ":upgrade_2_size", "trp_temp_array_c", ":slot_id"),
      (troop_get_upgrade_troop, ":upgrade_2_troop", ":upgrade_troop", 1),
      (try_begin),
        (gt, ":upgrade_2_troop", 0),
        (str_store_troop_name, s2, ":upgrade_2_troop"),
        (assign, reg2, ":upgrade_2_size"),
      (try_end),
     
      ## upgrade 1st path: troop and size
      (troop_get_upgrade_troop, ":upgrade_1_troop", ":upgrade_troop", 0),
      # upgrade 1 size = upgrade size - upgrade 2 size
      (store_sub, ":upgrade_1_size", ":upgrade_size", ":upgrade_2_size"),
      (str_store_troop_name, s1, ":upgrade_1_troop"),
      (assign, reg1, ":upgrade_1_size"),
     
      (create_text_overlay, reg0, "@{reg3} {s0} can upgrade.", tf_center_justify|tf_vertical_align_center),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 450),
      (overlay_set_position, reg0, pos1),
     
      (try_begin),
        (gt, ":upgrade_2_troop", 0),
        (create_text_overlay, "$g_presentation_obj_1", "@{reg1}^^Upgrade to {s1}", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 320),
        (position_set_y, pos1, 350),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
       
        (create_text_overlay, "$g_presentation_obj_2", "@{reg2}^^Upgrade to {s2}", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 680),
        (position_set_y, pos1, 350),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
       
        (create_slider_overlay, "$g_presentation_obj_3", 0, ":upgrade_size"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 350),
        (overlay_set_val, "$g_presentation_obj_3", ":upgrade_2_size"),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
      (else_try),
        (create_text_overlay, "$g_presentation_obj_1", "@Upgrade to {s1}({reg3})", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 350),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
       
        (create_text_overlay, "$g_presentation_obj_2", "@ ", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
       
        (create_slider_overlay, "$g_presentation_obj_3", 0, 10),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_val, "$g_presentation_obj_3", 0),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
      (try_end),
     
      (create_button_overlay, "$g_presentation_obj_4", "@Previous"),
      (try_begin),
        (gt, reg11, 0),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 200),
      (else_try),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
      (try_end),
      (overlay_set_position, "$g_presentation_obj_4", pos1),
     
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 200),
      (store_add, ":next_slot", reg11, 1),
      (try_begin),
        (neg|troop_slot_eq, "trp_temp_array_a", ":next_slot", -1),
        (str_store_string, s0, "@Next"),
      (else_try),
        (str_store_string, s0, "@Done"),
      (try_end),
      (create_button_overlay, "$g_presentation_obj_5", "@{s0}"),
      (overlay_set_position, "$g_presentation_obj_5", pos1),
    ]),

  (ti_on_presentation_run,
    [
      (set_fixed_point_multiplier, 1000),

      (assign, ":slot_id", reg11),
      (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_id"),
      (troop_get_upgrade_troop, ":upgrade_2_troop", ":upgrade_troop", 1),
      (try_begin),
        (gt, ":upgrade_2_troop", 0),
        (troop_get_slot, ":upgrade_size", "trp_temp_array_b", ":slot_id"),
        (troop_get_slot, ":upgrade_2_size", "trp_temp_array_c", ":slot_id"),
        (assign, reg2, ":upgrade_2_size"),
        (store_sub, ":upgrade_1_size", ":upgrade_size", ":upgrade_2_size"),
        (assign, reg1, ":upgrade_1_size"),
       
        (overlay_set_text, "$g_presentation_obj_1", "@{reg1}^^Upgrade to {s1}"),
        (overlay_set_text, "$g_presentation_obj_2", "@{reg2}^^Upgrade to {s2}"),
      (try_end),
    ]),

  (ti_on_presentation_event_state_change,
    [
      (store_trigger_param_1, ":eek:bject"),
      (store_trigger_param_2, ":value"),

      (try_begin),
        (eq, ":eek:bject", "$g_presentation_obj_3"),
        (assign, ":slot_id", reg11),
        (troop_get_slot, ":upgrade_2_size", "trp_temp_array_c", ":slot_id"),
        (try_begin),
          (neq, ":upgrade_2_size", ":value"),
          (assign, ":upgrade_2_size", ":value"),
        (try_end),
        (troop_set_slot, "trp_temp_array_c", ":slot_id", ":upgrade_2_size"),
      (else_try),
        (eq, ":eek:bject", "$g_presentation_obj_4"),
        (val_sub, reg11, 1),
        (start_presentation, "prsnt_upgrade_troops"),
      (else_try),
        (eq, ":eek:bject", "$g_presentation_obj_5"),
        (store_add, ":next_slot", reg11, 1),
        (try_begin),
          (neg|troop_slot_eq, "trp_temp_array_a", ":next_slot", -1),
          (val_add, reg11, 1),
          (start_presentation, "prsnt_upgrade_troops"),
        (else_try),
          ## is the end, switch troops from 1st path to 2nd path
          (try_for_range, ":slot_id", 0, 32),
            (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_id"),
            (gt, ":upgrade_troop", 0),
            (troop_get_slot, ":upgrade_2_size", "trp_temp_array_c", ":slot_id"),
            (gt, ":upgrade_2_size", 0),
            (troop_get_upgrade_troop, ":upgrade_1_troop", ":upgrade_troop", 0),
            (troop_get_upgrade_troop, ":upgrade_2_troop", ":upgrade_troop", 1),
            (party_remove_members, "p_main_party", ":upgrade_1_troop", ":upgrade_2_size"),
            (party_add_members, "p_main_party", ":upgrade_2_troop", ":upgrade_2_size"),
          (try_end),
          ## all finished back to camp menu
          (presentation_set_duration, 0),
        (try_end),
      (try_end),
    ]),
  ]),
########################################################
## Easy regulars upgrading kit end
########################################################

screenshots:


 

bjorne.

Sergeant Knight
Best answers
0
Code:
["grenade","Hand_Grenade", [("throwing_stone",0)], itp_type_thrown |itp_merchandise|itp_primary ,itcf_throw_stone, 1 , weight(4)|difficulty(0)|spd_rtng(97) | shoot_speed(30) | thrust_damage(10 ,  blunt)|max_ammo(18)|weapon_length(8),imodbit_large_bag ],
 [(ti_on_weapon_attack, [(assign,":distance",99999),(try_for_agents,":agent"),
                            (particle_system_burst, ""night_smoke_1"", pos1, 15),
                            (position_move_y,pos1,10),
                            (copy_position,pos2,pos1),
                            (position_set_z_to_ground_level, pos2),
                            (get_distance_between_positions,":dist",pos1,pos2),
                            (lt,":dist",10),
                            (particle_system_burst, "fireplace_fire_big", pos1, 15),
                            (particle_system_burst, "grenade_smoke", pos1, 15),
                            (play_sound,"snd_pistol_shot"),
                            (try_for_agents,":agent"),
                               (agent_get_position,pos2,":agent"),
                               (get_distance_between_positions,":dist",pos1,pos2),
                               (lt,":dist",300),
                               (agent_set_hit_points,":agent",0,0),
                               (agent_deliver_damage_to_agent,":agent",":agent"),
                            (end_try),
                            (scene_prop_get_instance,":instance", "spr_explosion", 0),
                            (position_copy_origin,pos2,pos1),
                            (prop_instance_set_position,":instance",pos2),
                            (position_move_z,pos2,1000),
                            (prop_instance_animate_to_position,":instance",pos2,175),
                            (assign,reg5,1000),
                          (end_try),],)]],
Well I got this code from the Curtain of Fire. To test with. So I get the hang of it when trying to make grenades for my mod. And I don't really know if this will work or not. And if it doesn't what's the problem..
If you wonder why I cannot check if it works or not. It's because currently I have some virus that makes my computer to crash when I run the .bat files.
 

you1

Knight at Arms
Best answers
0
First post here so I hope I've got the right place

has someone found a way to give horses the same Heraldry coat of arms as the lord,

I've made several new horse blankets and would like to have the troops under the lord have the same blanket, the same way the troop shields work.

I guess like the Heraldry surcoats you would need a horse one,
What code should I be looking for, is it possible, I prefer to fight battles by the coat of arms and not have loads of green test boxes everywhere.
 

Slawomir of Aaarrghh

Grandmaster Knight
WBM&BWF&SVCNW
Best answers
0
I played with heraldry system a bit and I found out that it doesn't work on horses and helmets (and gloves, as I remember correctly). For some reason they ignore tableau materials and use only default material, that is assigned to the mesh in .brf file, so heraldry won't work on them (at least not in the way that it works on armors and shields).

So I guess to have different horses you'll have to clone horse mesh in BRFedit and assign them different materials.
 

you1

Knight at Arms
Best answers
0
Slawomir of Aaarrghh said:
I played with heraldry system a bit and I found out that it doesn't work on horses and helmets (and gloves, as I remember correctly). For some reason they ignore tableau materials and use only default material, that is assigned to the mesh in .brf file, so heraldry won't work on them (at least not in the way that it works on armors and shields).

So I guess to have different horses you'll have to clone horse mesh in BRFedit and assign them different materials.
Thks slawomir ,"For some reason they ignore tableau materials " this would mean somewhere an instruction is stopping or skiping, What part of the code was you working with "I played with heraldry system" my mods future depends on this working so I need to dig and find a way!
 

Slawomir of Aaarrghh

Grandmaster Knight
WBM&BWF&SVCNW
Best answers
0
you1 said:
Thks slawomir ,"For some reason they ignore tableau materials " this would mean somewhere an instruction is stopping or skiping, What part of the code was you working with "I played with heraldry system" my mods future depends on this working so I need to dig and find a way!
Well, I tried to set different materials and shaders in brf, tried to alter the scripts and tableau materials. I can make whatever I want with armors and shields, but I can do nothing with horses and helmets. Tableau materials just don't work on them for some reason. I have no idea why. I even used my own scripts that change textures on armors, but all I achieved was making horse non-transparent (shaders worked correctly, like on normal horse), but it was still using default texture form brf, not the one applied with a script.

I know SantasHelper is going to give a try to make heraldic horses work. He's a really smart fellow, so I wouldn't be suprised if he actually figured that out and made it working. Try asking him.
 

FrisianDude

Archduke
M&BWB
Best answers
0
rubik said:
There is a big problem about upgrading the regulars all the time that you can only upgrade them one by one. If 100  regulars can upgrade, you need to click left mouse button 100 times.

I have write some code to solve the problem.

Source code:

At first, define slot_root_troop in module_constants.py, it is a troop slot. make sure it does not clash with your mod's other slot usage.

Paste the following into module_scripts.py
########################################################   
## Easy regulars upgrading kit begin
########################################################   
("calculate_upgrade_troops",
  [
    (call_script, "script_party_copy", "p_temp_party", "p_main_party"), ## before
    ## upgrade all troops in first upgrade path with total 1 xp
    ## everyone get 0 xp at last, but they all upgraded
    (party_upgrade_with_xp, "p_main_party", 1, 1),
    (call_script, "script_party_copy", "p_temp_party_2", "p_main_party"), ## after
   
    ## remove prisoners
    (call_script, "script_party_remove_all_prisoners", "p_temp_party"),
    (call_script, "script_party_remove_all_prisoners", "p_temp_party_2"),
   
    ## Initialize trp_temp_array_a
    (try_for_range, ":slot_no", 0, 96),
      (troop_set_slot, "trp_temp_array_a", ":slot_no", 0),
    (try_end),
   
    (assign, ":slot_id", -1),
    (assign, ":num_times", 1),
    (try_for_range, ":unused", 0, ":num_times"),
      ## find all current root troops
      (party_get_num_companion_stacks, ":num_stacks", "p_temp_party"),
      (try_for_range, ":cur_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":cur_troop", "p_temp_party", ":cur_stack"),
        (troop_set_slot, ":cur_troop", slot_root_troop, 1),
      (try_end),
     
      (try_for_range, ":cur_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":cur_troop", "p_temp_party", ":cur_stack"),
        (troop_get_upgrade_troop, ":upgrade_troop", ":cur_troop", 0),
        (gt, ":upgrade_troop", 0),
        (call_script, "script_party_has_troop", "p_temp_party", ":upgrade_troop"),
        (eq, reg0, 1),
        (troop_set_slot, ":upgrade_troop", slot_root_troop, 0), ## not a root troop
      (try_end),
     
      ## calculate upgrade troops and upgrade size
      (try_for_range, ":cur_stack", 0, ":num_stacks"),
        (party_stack_get_troop_id, ":cur_troop", "p_temp_party", ":cur_stack"),
        (gt, ":cur_troop", -1),
        (troop_slot_eq, ":cur_troop", slot_root_troop, 1),
        (party_stack_get_size, ":stack_size", "p_temp_party", ":cur_stack"),
       
        (call_script, "script_party_has_troop", "p_temp_party_2", ":cur_troop"),
        (try_begin),
          (eq, reg0, 0),
          (assign, ":stack_size_2", 0),
        (else_try),
          (party_get_num_companion_stacks, ":num_stacks_2", "p_temp_party_2"),
          (try_for_range, ":cur_stack_2", 0, ":num_stacks_2"),
            (party_stack_get_troop_id, ":cur_troop_2", "p_temp_party_2", ":cur_stack_2"),
            (eq, ":cur_troop_2", ":cur_troop"),
            (party_stack_get_size, ":stack_size_2", "p_temp_party_2", ":cur_stack_2"),
          (try_end),
        (try_end),
       
        (try_begin),
          (val_sub, ":stack_size", ":stack_size_2"),
          (gt, ":stack_size", 0),
          ## reduce the first upgrade path size
          (troop_get_upgrade_troop, ":upgrade_troop", ":cur_troop", 0),
          (party_remove_members, "p_temp_party_2", ":upgrade_troop", ":stack_size"),
          ## reduce the first upgrade path size
          (val_add, ":slot_id", 1),
          (store_mul, ":slot_troop", ":slot_id", 3),
          (store_add, ":slot_troop_upgrade_size", ":slot_troop", 1),
          (store_add, ":slot_troop_upgrade_2_size", ":slot_troop", 2),
          (troop_set_slot, "trp_temp_array_a", ":slot_troop", ":cur_troop"), ## troop which can upgrade
          (troop_set_slot, "trp_temp_array_a", ":slot_troop_upgrade_size", ":stack_size"), ## troop upgrade size
          (troop_set_slot, "trp_temp_array_a", ":slot_troop_upgrade_2_size", 0), ## troop upgrade second path size
        (try_end),
       
        ## remove current root troop
        (call_script, "script_party_remove_troop", "p_temp_party", ":cur_troop"),
        (call_script, "script_party_remove_troop", "p_temp_party_2", ":cur_troop"),
      (try_end),
     
      ## do the loop once more?
      (try_begin),
        (party_get_num_companion_stacks, ":num_stacks", "p_temp_party"),
        (gt, ":num_stacks", 0),
        (val_add, ":num_times", 1), ## once more
      (try_end),
    (try_end),
  ]),

("party_has_troop",
  [
    (store_script_param_1, ":party_no"),
    (store_script_param_2, ":troop_no"),
   
    (assign, reg0, 0),
    (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
    (try_for_range, ":cur_stack", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
      (eq, ":cur_troop", ":troop_no"),
      (assign, reg0, 1),
      (assign, ":num_stacks", 0), #end the loop
    (try_end),
  ]),

("party_remove_troop",
  [
    (store_script_param_1, ":party_no"),
    (store_script_param_2, ":troop_no"),
   
    (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
    (try_for_range, ":cur_stack", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
      (eq, ":cur_troop", ":troop_no"),
      (party_stack_get_size, ":stack_size", ":party_no", ":cur_stack"),
      (party_remove_members, ":party_no", ":troop_no", ":stack_size"),
    (try_end),
  ]),
 
("has_enough_slot",
  [
    (party_clear, "p_temp_party"),
    (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
    (try_for_range, ":stack_no", 0, ":num_stacks"),
      (party_stack_get_troop_id, ":cur_troop", "p_main_party", ":stack_no"),
      (try_begin),
        (troop_get_upgrade_troop, ":upgraded_troop_1", ":cur_troop", 0),
        (gt, ":upgraded_troop_1", 0),
        (neg|main_party_has_troop, ":upgraded_troop_1"),
        (party_add_members, "p_temp_party", ":upgraded_troop_1", 1),
      (else_try),
        (troop_get_upgrade_troop, ":upgraded_troop_2", ":cur_troop", 1),
        (gt, ":upgraded_troop_2", 0),
        (neg|main_party_has_troop, ":upgraded_troop_2"),
        (party_add_members, "p_temp_party", ":upgraded_troop_2", 1),
      (try_end),
    (try_end),
    (store_num_free_stacks, ":free_stacks", "p_main_party"),
    (party_get_num_companion_stacks, ":num_stack_increase", "p_temp_party"),
   
    (try_begin),
      (ge, ":free_stacks", ":num_stack_increase"),
      (assign, reg0, 1),
    (else_try),
      (assign, reg0, 0),
    (try_end),
  ]),
########################################################   
## Easy regulars upgrading kit end
########################################################

The following into module_game_menus.py:
      ("camp_action_1",[(eq,"$cheat_mode",1)],"Cheat: Walk around.",
      [(set_jump_mission,"mt_ai_training"),
        (call_script, "script_setup_random_scene"),
        (change_screen_mission),
        ]
      ),
########################################################
## Easy regulars upgrading kit begin
########################################################
    ("camp_upgrade_troops",
      [
        (call_script, "script_has_enough_slot"),
        (eq, reg0, 1),
      ],
    "Upgrade your troops.", [(jump_to_menu, "mnu_ready_upgrade")]),
   
    ("camp_upgrade_troops_no",
      [
        (call_script, "script_has_enough_slot"),
        (eq, reg0, 0),
        (disable_menu_option),
      ],
    "No slot for upgrading.", []),
########################################################
## Easy regulars upgrading kit end
########################################################
########################################################
## Easy regulars upgrading kit begin
########################################################
  ("ready_upgrade", 0,
  "{s0}",
    "none",
    [
      ## use reg10 to record wheather can continue or not
      ## use reg11 to record the progress of upgrading
      (try_begin),
        (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
        (eq, ":num_stacks", 1),
        (str_store_string, s0, "@ No one can upgrade."),
        (assign, reg10, 0),
      (else_try),
        (call_script, "script_calculate_upgrade_troops"),
        (try_begin),
          (troop_slot_eq, "trp_temp_array_a", 0, 0),
          (str_store_string, s0, "@ No one can upgrade."),
          (assign, reg10, 0),
        (else_try),
          (assign, reg10, 1),
          (assign, ":kinds_of_upgrade_troop", 0),
          (try_for_range, ":slot_id", 0, 32),
            (store_mul, ":slot_troop", ":slot_id", 3),
            (store_add, ":slot_troop_upgrade_size", ":slot_troop", 1),
            (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_troop"),
            (gt, ":upgrade_troop", 0),
            (troop_get_slot, ":upgrade_size", "trp_temp_array_a", ":slot_troop_upgrade_size"),
           
            (try_begin),
              (eq, ":kinds_of_upgrade_troop", 0),
              (str_store_troop_name_by_count, s1, ":upgrade_troop", ":upgrade_size"),
              (assign, reg1, ":upgrade_size"),
              (str_store_string, s0, "@{reg1} {s1} can upgrade."),
            (else_try),
              (eq, ":kinds_of_upgrade_troop", 1),
              (str_store_troop_name_by_count, s1, ":upgrade_troop", ":upgrade_size"),
              (assign, reg1, ":upgrade_size"),
              (str_store_string, s0, "@{reg1} {s1} and {s0}"),
            (else_try),
              (str_store_troop_name_by_count, s1, ":upgrade_troop", ":upgrade_size"),
              (assign, reg1, ":upgrade_size"),
              (str_store_string, s0, "@{reg1} {s1}, {s0}"),
            (try_end),
            (val_add, ":kinds_of_upgrade_troop", 1),
          (try_end),
         
        (try_end),
      (try_end),

    ],
    [
      ("upgrade_back", [(eq, reg10, 0)],
        "Go back.",
        [(jump_to_menu, "mnu_camp")]
      ),
     
      ("upgrade_continue", [(eq, reg10, 1)],
        "Continue...",
        [
          (jump_to_menu, "mnu_camp"),
          (assign, reg11, 0),
          (start_presentation, "prsnt_upgrade_troops"),
        ]
      ),
    ]
  ),
########################################################
## Easy regulars upgrading kit end
########################################################

The following into module_presentations.py:
########################################################   
## Easy regulars upgrading kit begin
########################################################

  ("upgrade_troops", 0, mesh_load_window, [
  (ti_on_presentation_load,
    [
      (presentation_set_duration, 999999),
      (set_fixed_point_multiplier, 1000),
     
      ## upgrade troop and total size
      (store_mul, ":slot_troop", reg11, 3),
      (store_add, ":slot_troop_upgrade_size", ":slot_troop", 1),
      (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_troop"),
      (gt, ":upgrade_troop", 0),
      # upgrade size will not change
      (troop_get_slot, ":upgrade_size", "trp_temp_array_a", ":slot_troop_upgrade_size"),
      (str_store_troop_name_by_count, s0, ":upgrade_troop", ":upgrade_size"),
      (assign, reg3, ":upgrade_size"),
     
      ## upgrade 2nd path: troop and size
      (store_add, ":slot_troop_upgrade_2_size", ":slot_troop", 2),
      # first get upgrade 2 size
      (troop_get_slot, ":upgrade_2_size", "trp_temp_array_a", ":slot_troop_upgrade_2_size"),
      (troop_get_upgrade_troop, ":upgrade_2_troop", ":upgrade_troop", 1),
      (try_begin),
        (gt, ":upgrade_2_troop", 0),
        (str_store_troop_name, s2, ":upgrade_2_troop"),
        (assign, reg2, ":upgrade_2_size"),
      (try_end),
     
      ## upgrade 1st path: troop and size
      (troop_get_upgrade_troop, ":upgrade_1_troop", ":upgrade_troop", 0),
      (gt, ":upgrade_1_troop", 0),
      # upgrade 1 size = upgrade size - upgrade 2 size
      (store_sub, ":upgrade_1_size", ":upgrade_size", ":upgrade_2_size"),
      (str_store_troop_name, s1, ":upgrade_1_troop"),
      (assign, reg1, ":upgrade_1_size"),

      (create_text_overlay, reg0, "@{reg3} {s0} can upgrade.", tf_center_justify|tf_vertical_align_center),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 450),
      (overlay_set_position, reg0, pos1),

      (try_begin),
        (gt, ":upgrade_2_troop", 0),
       
        (create_text_overlay, "$g_presentation_obj_1", "@{reg1}^^Upgrade to {s1}", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 680),
        (position_set_y, pos1, 350),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
       
        (create_text_overlay, "$g_presentation_obj_2", "@{reg2}^^Upgrade to {s2}", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 320),
        (position_set_y, pos1, 350),
        (overlay_set_position, "$g_presentation_obj_2", pos1),
       
        (create_slider_overlay, "$g_presentation_obj_3", 0, ":upgrade_size"),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 350),
        (overlay_set_val, "$g_presentation_obj_3", ":upgrade_1_size"),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
      (else_try),
        (create_text_overlay, reg0, "@Upgrade to {s1}({reg3})", tf_center_justify|tf_vertical_align_center),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 350),
        (overlay_set_position, reg0, pos1),
      (try_end),

      (try_begin),
        (gt, reg11, 0),
        (create_button_overlay, "$g_presentation_obj_4", "@Previous"),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 200),
        (overlay_set_position, "$g_presentation_obj_4", pos1),
      (try_end),

      (store_add, reg12, reg11, 1),
      (store_mul, ":slot_troop", reg12, 3),
      (try_begin),
        (neg|troop_slot_eq, "trp_temp_array_a", ":slot_troop", 0),
        (str_store_string, s0, "@Next"),
      (else_try),
        (str_store_string, s0, "@Done"),
      (try_end),
      (create_button_overlay, "$g_presentation_obj_5", "@{s0}"),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 200),
      (overlay_set_position, "$g_presentation_obj_5", pos1),
    ]),

  (ti_on_presentation_run,
    [
      (set_fixed_point_multiplier, 1000),

      (try_begin),
        (store_mul, ":slot_troop", reg11, 3),
        (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_troop"),
        (troop_get_upgrade_troop, ":upgrade_2_troop", ":upgrade_troop", 1),
        (gt, ":upgrade_2_troop", 0),
       
        (store_add, ":slot_troop_upgrade_size", ":slot_troop", 1),
        (troop_get_slot, ":upgrade_size", "trp_temp_array_a", ":slot_troop_upgrade_size"),
        (store_add, ":slot_troop_upgrade_2_size", ":slot_troop", 2),
        (troop_get_slot, ":upgrade_2_size", "trp_temp_array_a", ":slot_troop_upgrade_2_size"),
        (assign, reg2, ":upgrade_2_size"),
        (store_sub, ":upgrade_1_size", ":upgrade_size", ":upgrade_2_size"),
        (assign, reg1, ":upgrade_1_size"),
       
        (overlay_set_text, "$g_presentation_obj_1", "@{reg1}^^Upgrade to {s1}"),
        (overlay_set_text, "$g_presentation_obj_2", "@{reg2}^^Upgrade to {s2}"),
      (try_end),
    ]),

  (ti_on_presentation_event_state_change,
    [
      (store_trigger_param_1, ":eek:bject"),
      (store_trigger_param_2, ":value"),

      (try_begin),
        (eq, ":eek:bject", "$g_presentation_obj_5"),
        (val_add, reg11, 1),
        (try_begin),
          (store_mul, ":slot_troop", reg11, 3),
          (neg|troop_slot_eq, "trp_temp_array_a", ":slot_troop", 0), ## not the end, continue it
          (start_presentation, "prsnt_upgrade_troops"),
        (else_try),
          ## is the end, switch troops from 1st path to 2nd path
          (try_for_range, ":slot_id", 0, 32),
            (store_mul, ":slot_troop", ":slot_id", 3),
            (store_add, ":slot_troop_upgrade_2_size", ":slot_troop", 2),
            (troop_get_slot, ":upgrade_troop", "trp_temp_array_a", ":slot_troop"),
            (gt, ":upgrade_troop", 0),
            (troop_get_slot, ":upgrade_2_size", "trp_temp_array_a", ":slot_troop_upgrade_2_size"),
            (gt, ":upgrade_2_size", 0),
            (troop_get_upgrade_troop, ":upgrade_1_troop", ":upgrade_troop", 0),
            (troop_get_upgrade_troop, ":upgrade_2_troop", ":upgrade_troop", 1),
            (party_remove_members, "p_main_party", ":upgrade_1_troop", ":upgrade_2_size"),
            (party_add_members, "p_main_party", ":upgrade_2_troop", ":upgrade_2_size"),
          (try_end),
          ## all finished back to camp menu
          (presentation_set_duration, 0),
        (try_end),
      (else_try),
        (eq, ":eek:bject", "$g_presentation_obj_4"),
        (val_sub, reg11, 1),
        (start_presentation, "prsnt_upgrade_troops"),
      (else_try),
        (eq, ":eek:bject", "$g_presentation_obj_3"),
        (try_begin),
          (store_mul, ":slot_troop", reg11, 3),
          (store_add, ":slot_troop_upgrade_size", ":slot_troop", 1),
          (troop_get_slot, ":upgrade_size", "trp_temp_array_a", ":slot_troop_upgrade_size"),
          (store_add, ":slot_troop_upgrade_2_size", ":slot_troop", 2),
          (troop_get_slot, ":upgrade_2_size", "trp_temp_array_a", ":slot_troop_upgrade_2_size"),
          (store_sub, ":upgrade_1_size", ":upgrade_size", ":upgrade_2_size"),
          (neq, ":upgrade_1_size", ":value"),
          (assign, ":upgrade_1_size", ":value"),
          (store_sub, ":upgrade_2_size", ":upgrade_size", ":upgrade_1_size"),
          (troop_set_slot, "trp_temp_array_a", ":slot_troop_upgrade_2_size", ":upgrade_2_size"),
        (try_end),
      (try_end),
    ]),
  ]),
########################################################
## Easy regulars upgrading kit end
########################################################

screenshots:


Sounds very nice, but what does "define slot_troop"  mean? :???:

bjorne. said:
Code:
["grenade","Hand_Grenade", [("throwing_stone",0)], itp_type_thrown |itp_merchandise|itp_primary ,itcf_throw_stone, 1 , weight(4)|difficulty(0)|spd_rtng(97) | shoot_speed(30) | thrust_damage(10 ,  blunt)|max_ammo(18)|weapon_length(8),imodbit_large_bag ],
 [(ti_on_weapon_attack, [(assign,":distance",99999),(try_for_agents,":agent"),
                            (particle_system_burst, ""night_smoke_1"", pos1, 15),
                            (position_move_y,pos1,10),
                            (copy_position,pos2,pos1),
                            (position_set_z_to_ground_level, pos2),
                            (get_distance_between_positions,":dist",pos1,pos2),
                            (lt,":dist",10),
                            (particle_system_burst, "fireplace_fire_big", pos1, 15),
                            (particle_system_burst, "grenade_smoke", pos1, 15),
                            (play_sound,"snd_pistol_shot"),
                            (try_for_agents,":agent"),
                               (agent_get_position,pos2,":agent"),
                               (get_distance_between_positions,":dist",pos1,pos2),
                               (lt,":dist",300),
                               (agent_set_hit_points,":agent",0,0),
                               (agent_deliver_damage_to_agent,":agent",":agent"),
                            (end_try),
                            (scene_prop_get_instance,":instance", "spr_explosion", 0),
                            (position_copy_origin,pos2,pos1),
                            (prop_instance_set_position,":instance",pos2),
                            (position_move_z,pos2,1000),
                            (prop_instance_animate_to_position,":instance",pos2,175),
                            (assign,reg5,1000),
                          (end_try),],)]],

Well I got this code from the Curtain of Fire. To test with. So I get the hang of it when trying to make grenades for my mod. And I don't really know if this will work or not. And if it doesn't what's the problem..
If you wonder why I cannot check if it works or not. It's because currently I have some virus that makes my computer to crash when I run the .bat files.
If you're thinking one should just put that in module_items, you'd get errors while building.
 
Best answers
0
If you had opened module_constants.py, i am pretty sure you would realize it instantly.
Anyway, it means that you simply enter slot_root_troop in the same fashion the other slots are defined in the file:

slot_root_troop = whatever
 

FrisianDude

Archduke
M&BWB
Best answers
0
Ah, yes. Sorry, I hardly ever visited the module_constants, and it seems I wasn't reading all too well then either. :oops: