Recent content by Crysix

  1. Crysix

    OSP Code Campaign Perfect Trade. Best buy/sell Report

    This is great, thank you Arris, (i will use it as one of the perks the player can unluock, that let you view that list and there is a trigger that update the list slots each week, making the list less accurate over time, presenting the list with the best buy/sell slots(slot_item_best_buy)
  2. Crysix

    OSP Code Combat AI deploy pavise shields

    Making the AI able to deploy pavise shields(friend and foe), they will deploy when shooting and recover when moving away from it. Inspierd by Cartread Deployable Pavise Shield. *One issuse is that the banner mesh that apply on the heraldic shields is the one of the enemy, if some1 can help...
  3. Crysix

    OSP Code SP Intense Weather(more rain/snow and fog)

    thanks for sharing. what Antonis and i do, we set the importantest weather parameter with a simple trigger, with that you always have the same weather in the scene. i mean it makes no sense that after tab out/scene reload you haven't the same weather like before
    True true, i think a fix to that problem will be to store the values of the current scene weather that was set randomly and if its in the same terrain and a few hours didnt passed the weather will get the same first random values that stored and will be reseted to random each few hours(that enough time passed for weather to change) or if you go from snow to grassland so also depand on the terrain to set snow or rain, just a quick idea about that but it really dosent bother me personally, i even re-enter a scene(battle) few times just to get a weather im liking
  4. Crysix

    OSP Code SP Intense Weather(more rain/snow and fog)

    Required module.py files to edit: module_scripts module_constants (optional to use instead of the module_scripts) mission_templates (and for the toggle option, anywhere you want, i use it in the module_game_menus) Intense weather make the battlefield more fogy and rainy. You can also add...
  5. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    Sorting main party members in various ways

    The main code is from rubik sorting parties by level script.
    Instead of sorting with many clicks the party members with this it can be made with fewer clicks.
    Include: sort by stack level. sort by stack amount. sort by infantry, archers, cavalry and companions to the top or bottom
    Screenshot:


    new script in module_scripts.py
    Python:
    ("sort_party_members_stack_level",
       [
        (try_for_parties, ":party_no"),
            (assign, ":continue", 0),
            (try_begin),
                (eq, ":party_no", "p_main_party"),
                (party_is_active, ":party_no"),
                (assign, ":continue", 1),
                (try_begin),
                    (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                    (this_or_next | troop_is_hero, ":cur_troop"),
                    (eq, ":cur_troop", "trp_caravan_master"),
                    (assign, ":first_stack", 1),
                (else_try),
                    (assign, ":first_stack", 0),
                (try_end),
            (try_end),
            (eq, ":continue", 1),
            (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
            (gt, ":num_stacks", ":first_stack"),
            (assign, ":last_stack", ":num_stacks"),
            # start to sort
            (store_sub, ":num_times", ":num_stacks", ":first_stack"),
            (try_for_range, ":unused", 0, ":num_times"),
                # find highest-level troop
                (assign, ":best_stack", -1),
                (assign, ":best_level", -1),
                (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                    (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                    (store_character_level, ":troop_level", ":cur_troop"),
                    (gt, ":troop_level", ":best_level"),
                    (assign, ":best_level", ":troop_level"),
                    (assign, ":best_stack", ":cur_stack"),
                (try_end),
                # move to the end
                (try_begin),
                    (gt, ":best_level", -1),
                    (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                    (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                    (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                    (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                    (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                    (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                    (val_sub, ":last_stack", 1),
                (try_end),
            (try_end),
        (try_end),
       ]),

    in module_game_menus.py
    Below "camp_recruit_prisoners" option add below this new option-
    Python:
    ("action_sort_party_members", [], "Sort party members.",
    [(jump_to_menu, "mnu_camp_action_sort_party"),
      ]
    ),
    The new menu-
    Python:
    ("camp_action_sort_party", 0,
         "Choose what to sort by:^^(can be mixed sorting, for example, sorting stack level and then sorting party infantry to the top will make the infantry stacks to sort by level, same goes to stack amount)",
         "none",
         [
    
         ],
         [
             ("sort_party_1",
              [], "Sort party members by stack level.",
              [
                  (call_script, "script_sort_party_members_stack_level"),
                  (display_message, "@Your party members is now sorted by stack level."),
              ],
              ),
    
             ("sort_party_2",
              [], "Sort party members by stack amount.",
              [
                  (call_script, "script_sort_party_members_stack_level"),
                  (try_for_parties, ":party_no"),
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              #(party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (party_stack_get_size, ":troop_level", "p_main_party", ":cur_stack"),
                              (gt, ":troop_level", ":best_level"),
                              (assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              (gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
    
                  (display_message, "@Your party members is now sorted by stack amount."),
              ]
              ),
             ("blank", [
             ],
              "------------------------------",
              []),
             ("sort_party_3",
              [], "Sort party infantry to the top.",
              [
                  (try_for_parties, ":party_no"),
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                             (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                             (this_or_next | troop_is_hero, ":cur_troop"),
                             (eq, ":cur_troop", "trp_caravan_master"),
                             (assign, ":first_stack", 1),
                         (else_try),
                             (assign, ":first_stack", 0),
                         (try_end),
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                         # find highest-level troop
                         (assign, ":best_stack", -1),
                         (assign, ":best_level", -1),
                         (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                             (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                             (troop_get_class, ":troop_class", ":cur_troop"),
                             (neq, ":troop_class", 0),
                             #(store_character_level, ":troop_level", ":cur_troop"),
                             #(gt, ":troop_level", ":best_level"),
                             #(assign, ":best_level", ":troop_level"),
                             (assign, ":best_stack", ":cur_stack"),
                         (try_end),
                         # move to the end
                         (try_begin),
                             #(gt, ":best_level", -1),
                             (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                             (troop_get_class, ":troop_class", ":stack_troop"),
                             (neq, ":troop_class", 0),
                             (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                             (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                             (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                             (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                             (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                             (val_sub, ":last_stack", 1),
                         (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party infantry is now sorted to the top."),
              ],
              ),
             ("sort_party_4",
              [], "Sort party infantry to the buttom.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (troop_get_class, ":troop_class", ":cur_troop"),
                              (eq, ":troop_class", 0),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                          #(gt, ":best_level", -1),
                             (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                             (troop_get_class, ":troop_class", ":stack_troop"),
                             (eq, ":troop_class", 0),
                             (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                             (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                             (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                             (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                             (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                             (val_sub, ":last_stack", 1),
                         (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party infantry is now sorted to the buttom."),
              ],
              ),
             ("blank_1", [
             ],
              "------------------------------",
              []),
             ("sort_party_5",
              [], "Sort party archers to the top.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (troop_get_class, ":troop_class", ":cur_troop"),
                              (neq, ":troop_class", 1),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              #(gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (troop_get_class, ":troop_class", ":stack_troop"),
                              (neq, ":troop_class", 1),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party archers is now sorted to the top."),
              ],
              ),
             ("sort_party_6",
              [], "Sort party archers to the buttom.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                      (try_begin),
                          (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                          (this_or_next | troop_is_hero, ":cur_troop"),
                          (eq, ":cur_troop", "trp_caravan_master"),
                          (assign, ":first_stack", 1),
                      (else_try),
                          (assign, ":first_stack", 0),
                      (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (troop_get_class, ":troop_class", ":cur_troop"),
                              (eq, ":troop_class", 1),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              #(gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (troop_get_class, ":troop_class", ":stack_troop"),
                              (eq, ":troop_class", 1),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party archers is now sorted to the buttom."),
              ],
              ),
             ("blank_2", [
             ],
              "------------------------------",
              []),
             ("sort_party_7",
              [], "Sort party cavalry to the top.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                           # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (troop_get_class, ":troop_class", ":cur_troop"),
                              (neq, ":troop_class", 2),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              #(gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (troop_get_class, ":troop_class", ":stack_troop"),
                              (neq, ":troop_class", 2),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party cavalry is now sorted to the top."),
              ],
              ),
             ("sort_party_8",
              [], "Sort party cavalry to the buttom.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (troop_get_class, ":troop_class", ":cur_troop"),
                              (eq, ":troop_class", 2),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              #(gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (troop_get_class, ":troop_class", ":stack_troop"),
                              (eq, ":troop_class", 2),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party cavalry is now sorted to the buttom."),
              ],
              ),
             ("blank_3", [
             ],
              "------------------------------",
              []),
             ("sort_party_9",
              [], "Sort party companions to the top.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (neg | troop_is_hero, ":cur_troop"),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              #(gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (neg | troop_is_hero, ":stack_troop"),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party companions is now sorted to the top."),
              ],
              ),
             ("sort_party_10",
              [], "Sort party companions to the buttom.",
              [
                  (try_for_parties, ":party_no"),
    
                      (assign, ":continue", 0),
                      (try_begin),
                          (eq, ":party_no", "p_main_party"),
                          (party_is_active, ":party_no"),
                          (assign, ":continue", 1),
                          (try_begin),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", 0),
                              (this_or_next | troop_is_hero, ":cur_troop"),
                              (eq, ":cur_troop", "trp_caravan_master"),
                              (assign, ":first_stack", 1),
                          (else_try),
                              (assign, ":first_stack", 0),
                          (try_end),
    
                      (try_end),
                      (eq, ":continue", 1),
                      (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
                      (gt, ":num_stacks", ":first_stack"),
                      (assign, ":last_stack", ":num_stacks"),
    
                      # start to sort
                      (store_sub, ":num_times", ":num_stacks", ":first_stack"),
                      (try_for_range, ":unused", 0, ":num_times"),
                          # find highest-level troop
                          (assign, ":best_stack", -1),
                          (assign, ":best_level", -1),
                          (try_for_range, ":cur_stack", ":first_stack", ":last_stack"),
                              (party_stack_get_troop_id, ":cur_troop", ":party_no", ":cur_stack"),
                              (troop_is_hero, ":cur_troop"),
                              #(store_character_level, ":troop_level", ":cur_troop"),
                              #(gt, ":troop_level", ":best_level"),
                              #(assign, ":best_level", ":troop_level"),
                              (assign, ":best_stack", ":cur_stack"),
                          (try_end),
                          # move to the end
                          (try_begin),
                              #(gt, ":best_level", -1),
                              (party_stack_get_troop_id, ":stack_troop", ":party_no", ":best_stack"),
                              (troop_is_hero, ":stack_troop"),
                              (party_stack_get_size, ":stack_size", ":party_no", ":best_stack"),
                              (party_stack_get_num_wounded, ":num_wounded", ":party_no", ":best_stack"),
                              (party_remove_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_add_members, ":party_no", ":stack_troop", ":stack_size"),
                              (party_wound_members, ":party_no", ":stack_troop", ":num_wounded"),
                              (val_sub, ":last_stack", 1),
                          (try_end),
                      (try_end),
                  (try_end),
                  (display_message, "@Your party companions is now sorted to the buttom."),
              ],
              ),
    
    
             ("camp_sort_leave_to_menu", [], "Back to camp menu.",
              [(jump_to_menu, "mnu_camp_action"),
               ]
              ),
         ]
         ),
  6. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    Character name generator/randomizer

    Small presentation page in the start to choose the character name with randomize button for female or male, 200 names for each.



    In module_game_menus in the "mnu_start_game_1" menu replace (jump_to_menu,"mnu_start_character_1"), in both male and female options to "(start_presentation, "prsnt_set_player_name")

    ("male_name_001", "Marcus"),
    ("male_name_002", "John"),
    ("name_1", "Albard"),
    ("name_2", "Euscarl"),
    ("name_3", "Sigmar"),
    ("name_4", "Talesqe"),
    ("name_5", "Ritmand"),
    ("name_6", "Aels"),
    ("name_7", "Raurqe"),
    ("name_8", "Bragamus"),
    ("name_9", "Taarl"),
    ("name_10", "Ramin"),
    ("name_11", "Shulk"),
    ("name_12", "Putar"),
    ("name_13", "Tamus"),
    ("name_14", "Reichad"),
    ("name_15", "Walcheas"),
    ("name_16", "Rulkh"),
    ("name_17", "Marlund"),
    ("name_18", "Auguryn"),
    ("name_19", "Daynad"),
    ("name_20", "Joayah"),
    ("name_21", "Ramar"),
    ("name_22", "Caldaran"),
    ("name_23", "Brabas"),
    ("name_24", "Kundrin"),
    ("name_25", "Pechnak"),
    ("male_name_003", "Hernigam"),
    ("male_name_004", "Petter"),
    ("male_name_005", "Cristian"),
    ("male_name_006", "Arthur"),
    ("male_name_007", "Cesar"),
    ("male_name_008", "Lucas"),
    ("male_name_009", "Avladikus"),
    ("male_name_010", "Senit"),
    ("male_name_011", "Milain"),
    ("male_name_012", "Bombaide"),
    ("male_name_013", "Malipe"),
    ("male_name_014", "Singai"),
    ("male_name_015", "Amunegan"),
    ("male_name_016", "Jungas"),
    ("male_name_017", "Artheus"),
    ("male_name_018", "Fergus"),
    ("male_name_019", "Lugaid"),
    ("male_name_020", "Fedelmid"),
    ("male_name_021", "Donngal"),
    ("male_name_022", "Lóegaire"),
    ("male_name_023", "Carthach"),
    ("male_name_024", "Eochaid"),
    ("male_name_025", "Cormac"),
    ("male_name_026", "Muiredach"),
    ("male_name_027", "Éogan"),
    ("male_name_028", "Colmán"),
    ("male_name_029", "Alanus"),
    ("male_name_030", "Arthurus"),
    ("male_name_031", "Balian"),
    ("male_name_032", "Bryan"),
    ("male_name_033", "Conon"),
    ("male_name_034", "Gawyne"),
    ("male_name_035", "Joceus"),
    ("male_name_036", "Malcolinus"),
    ("male_name_037", "Marmaduc"),
    ("male_name_038", "Nigelle"),
    ("male_name_039", "Ywain"),
    ("male_name_040", "Trustram"),
    ("male_name_041", "Urien"),
    ("male_name_042", "Aylard"),
    ("male_name_043", "Athelardus"),
    ("male_name_044", "Amaurri"),
    ("male_name_045", "Ancelin"),
    ("male_name_046", "Alphonsins"),
    ("male_name_047", "Auguinare"),
    ("male_name_048", "Ernaldus"),
    ("male_name_049", "Arnoldus"),
    ("male_name_050", "Bardol"),
    ("male_name_051", "Audouin"),
    ("male_name_052", "Berengarius"),
    ("male_name_053", "Berengerus"),
    ("male_name_054", "Barnard"),
    ("male_name_055", "Beroldus"),
    ("male_name_056", "Beroldus"),
    ("male_name_057", "Betin"),
    ("male_name_058", "Beavis"),
    ("male_name_059", "Blayves"),
    ("male_name_060", "Botolfe"),
    ("male_name_061", "Carle"),
    ("male_name_062", "Karolus"),
    ("male_name_063", "Clarembaut"),
    ("male_name_064", "Courtois"),
    ("male_name_065", "Degarre"),
    ("male_name_066", "Droet"),
    ("male_name_067", "Dreues"),
    ("male_name_068", "Erneis"),
    ("male_name_069", "Udona"),
    ("male_name_070", "Aberardus"),
    ("male_name_071", "Heinricus"),
    ("male_name_072", "Hermannus"),
    ("male_name_073", "Cunradus"),
    ("male_name_074", "Wilhelmus"),
    ("male_name_075", "Hartmannus"),
    ("male_name_076", "Wikerus"),
    ("male_name_077", "Didericus"),
    ("male_name_078", "Wigandus"),
    ("male_name_079", "Ditmarus"),
    ("male_name_080", "Hartmudus"),
    ("male_name_081", "Meingotus"),
    ("male_name_082", "Fridebertus"),
    ("male_name_083", "Rudegerus"),
    ("male_name_084", "Wecelo"),
    ("male_name_085", "Everwinus"),
    ("male_name_086", "Fridericus"),
    ("male_name_087", "Gerhardus"),
    ("male_name_088", "Guntramus"),
    ("male_name_089", "Harpernus"),
    ("male_name_090", "Meffridus"),
    ("male_name_091", "Sifridus"),
    ("male_name_092", "Theodericus"),
    ("male_name_093", "Eberhardus"),
    ("male_name_094", "Gernandus"),
    ("male_name_095", "Johannes"),
    ("male_name_096", "Ludewicus"),
    ("male_name_097", "Ortwinus"),
    ("male_name_098", "Eginolf"),
    ("male_name_099", "Ripertus"),
    ("male_name_100", "Fretsol"),
    ("male_name_101", "Derflok"),
    ("male_name_102", "Resvero"),
    ("male_name_103", "Tupl"),
    ("male_name_104", "Carven"),
    ("male_name_105", "Stakso"),
    ("male_name_106", "Jordan"),
    ("male_name_107", "Ian"),
    ("male_name_108", "Bedvelier"),
    ("male_name_109", "Craset"),
    ("male_name_110", "Rasklip"),
    ("male_name_111", "Highol"),
    ("male_name_112", "Trevsto"),
    ("male_name_113", "Gresfolk"),
    ("male_name_114", "Ceter"),
    ("male_name_115", "Despinl"),
    ("male_name_116", "Retrosperian Loksver"),
    ("male_name_117", "Reftovlom"),
    ("male_name_118", "Ikargo"),
    ("male_name_119", "Fretonsk"),
    ("male_name_120", "Poveri"),
    ("male_name_121", "Zexir"),
    ("male_name_122", "Frequo"),
    ("male_name_123", "Quervoltai"),
    ("male_name_124", "Puntop"),
    ("male_name_125", "Losver"),
    ("male_name_126", "Erap"),
    ("male_name_127", "Rsto"),
    ("male_name_128", "Xevrien"),
    ("male_name_129", "Polvisk"),
    ("male_name_130", "Xec"),
    ("male_name_131", "Father Blood"),
    ("male_name_132", "Brevshu"),
    ("male_name_133", "Bulbois"),
    ("male_name_134", "Larkstop"),
    ("male_name_135", "Lovten"),
    ("male_name_136", "Lship"),
    ("male_name_137", "Le Rewn"),
    ("male_name_138", "El Matdor"),
    ("male_name_139", "Guarierien"),
    ("male_name_140", "Chance"),
    ("male_name_141", "Andrew"),
    ("male_name_142", "Rickey"),
    ("male_name_143", "Elijah"),
    ("male_name_144", "Dustoph"),
    ("male_name_145", "Kevin"),
    ("male_name_146", "Barbari"),
    ("male_name_147", "Axzel"),
    ("male_name_148", "Axel"),
    ("male_name_149", "Aphelto"),
    ("male_name_150", "Apheltono"),
    ("male_name_151", "Afreckso"),
    ("male_name_152", "Atshi"),
    ("male_name_153", "Pulmonisl"),
    ("male_name_154", "Murphy"),
    ("male_name_155", "Lawfonteri"),
    ("male_name_156", "Clackrentrackoneck"),
    ("male_name_157", "Khryill"),
    ("male_name_158", "Black Fren"),
    ("male_name_159", "Resvol"),
    ("male_name_160", "Coraveriosk"),
    ("male_name_161", "Carter"),
    ("male_name_162", "Strange Man"),
    ("male_name_163", "Soper"),
    ("male_name_164", "Lofiskl"),
    ("male_name_165", "Sixlop"),
    ("male_name_166", "Kester"),
    ("male_name_167", "Velominus"),
    ("male_name_168", "Polvernisko"),
    ("male_name_169", "Lofsh"),
    ("male_name_170", "Nosh"),
    ("male_name_171", "Kilzmop"),
    ("male_name_172", "Treveri"),
    ("male_name_173", "Nafshi"),
    ("male_name_174", "Zer"),
    ("male_name_175", "Nofashil"),
    ("male_name_176", "Trepo"),
    ("male_name_177", "Likstox"),
    ("male_name_178", "Uvumipila"),
    ("male_name_179", "Oren"),
    ("male_name_180", "Odinsk"),
    ("male_name_181", "Axer"),
    ("male_name_182", "Tevriskop"),
    ("male_name_183", "Lolzeriom"),
    ("male_name_184", "Taragoth"),
    ("male_name_185", "Osper"),
    ("male_name_186", "Pellagus"),
    ("male_name_187", "Reps"),
    ("male_name_188", "Nativer Sefanson"),
    ("male_name_189", "Eightynine"),
    ("male_name_190", "Dashpolmu"),
    ("male_name_191", "Pitireful"),
    ("male_name_192", "Achoful"),
    ("male_name_193", "Brian"),
    ("male_name_194", "Timmerna"),
    ("male_name_195", "Malo"),
    ("male_name_196", "Wrevil"),
    ("male_name_197", "Wrepil"),
    ("male_name_198", "Wreskil"),
    ("male_name_199", "Wretil"),
    ("male_name_200", "Lofilsk"),
    ("male_name_end", "End"),
    ("female_name_001", "Anachorita"),
    ("female_name_002", "Braya"),
    ("female_name_003", "Branwyne"),
    ("female_name_004", "Bragwayn"),
    ("female_name_005", "Brigida"),
    ("female_name_006", "Guener"),
    ("female_name_007", "Wannore"),
    ("female_name_008", "Emayn"),
    ("female_name_009", "Ismena"),
    ("female_name_010", "Imaigne"),
    ("female_name_011", "Jessimond"),
    ("female_name_012", "Essylt"),
    ("female_name_013", "Isard"),
    ("female_name_014", "Iseldis"),
    ("female_name_015", "Iseult"),
    ("female_name_016", "Isolde"),
    ("female_name_017", "Isota"),
    ("female_name_018", "Isouda"),
    ("female_name_019", "Izett"),
    ("female_name_020", "Yseulte"),
    ("female_name_021", "Ysout"),
    ("female_name_022", "Hysode"),
    ("female_name_023", "Isata"),
    ("female_name_024", "Iselota"),
    ("female_name_025", "Iseut"),
    ("female_name_026", "Isolt"),
    ("female_name_027", "Isott"),
    ("female_name_028", "Issat"),
    ("female_name_029", "Izot"),
    ("female_name_030", "Ysolt"),
    ("female_name_031", "Isaut"),
    ("female_name_032", "Iseuda"),
    ("female_name_033", "Isold"),
    ("female_name_034", "Isot"),
    ("female_name_035", "Isotta"),
    ("female_name_036", "Isylte"),
    ("female_name_037", "Yseult"),
    ("female_name_038", "Ysoude"),
    ("female_name_039", "Jocea"),
    ("female_name_040", "Jocosa"),
    ("female_name_041", "Jossy"),
    ("female_name_042", "Jocey"),
    ("female_name_043", "Jodoca"),
    ("female_name_044", "Joyse"),
    ("female_name_045", "Josse"),
    ("female_name_046", "Juicea"),
    ("female_name_047", "Eluned"),
    ("female_name_048", "Linette"),
    ("female_name_049", "Linota"),
    ("female_name_050", "Luned"),
    ("female_name_051", "Lynette"),
    ("female_name_052", "Lina"),
    ("female_name_053", "Linnet"),
    ("female_name_054", "Linyeve"),
    ("female_name_055", "Lunet"),
    ("female_name_056", "Lyneue"),
    ("female_name_057", "Linniue"),
    ("female_name_058", "Linyive"),
    ("female_name_059", "Lunete"),
    ("female_name_060", "Lyonnete"),
    ("female_name_061", "Merewen"),
    ("female_name_062", "Merwenna"),
    ("female_name_063", "Merewina"),
    ("female_name_064", "Wantelien"),
    ("female_name_065", "Wentiliana"),
    ("female_name_066", "Wenthelen"),
    ("female_name_067", "Wenefreda"),
    ("female_name_068", "Wynifreed"),
    ("female_name_069", "Winefred"),
    ("female_name_070", "Winnifred"),
    ("female_name_071", "Maryell"),
    ("female_name_072", "Meriall"),
    ("female_name_073", "Meryall"),
    ("female_name_074", "Meriel"),
    ("female_name_075", "Miriel"),
    ("female_name_076", "Miriild"),
    ("female_name_077", "Muriele"),
    ("female_name_078", "Merhild"),
    ("female_name_079", "Meriel"),
    ("female_name_080", "Meryld"),
    ("female_name_081", "Miriela"),
    ("female_name_082", "Mirielis"),
    ("female_name_083", "Mirils"),
    ("female_name_084", "Muriella"),
    ("female_name_085", "Merilda"),
    ("female_name_086", "Miriald"),
    ("female_name_087", "Mirield"),
    ("female_name_088", "Miriella"),
    ("female_name_089", "Murie"),
    ("female_name_090", "Murienne"),
    ("female_name_091", "Gismon"),
    ("female_name_092", "Isamaya"),
    ("female_name_093", "Imme"),
    ("female_name_094", "Hyssmaye"),
    ("female_name_095", "Ysmene"),
    ("female_name_096", "Gwenhevare"),
    ("female_name_097", "Jenefer"),
    ("female_name_098", "Bragwayn"),
    ("female_name_099", "Bryde"),
    ("female_name_101", "Aldonza"),
    ("female_name_102", "Beatriz"),
    ("female_name_103", "Adela"),
    ("female_name_104", "Allison"),
    ("female_name_105", "Amela"),
    ("female_name_106", "Ava"),
    ("female_name_107", "Bliss"),
    ("female_name_108", "Cass"),
    ("female_name_109", "Cecily"),
    ("female_name_110", "Christabel"),
    ("female_name_111", "Christian"),
    ("female_name_112", "Christina"),
    ("female_name_113", "Clare"),
    ("female_name_114", "Clarice"),
    ("female_name_115", "Clarimond"),
    ("female_name_116", "Clarissa"),
    ("female_name_117", "Clemence"),
    ("female_name_118", "Colette"),
    ("female_name_119", "Constance"),
    ("female_name_120", "Courtney"),
    ("female_name_121", "Emma"),
    ("female_name_122", "Gaynor"),
    ("female_name_123", "Lisabelle"),
    ("female_name_124", "Jay"),
    ("female_name_125", "Joan"),
    ("female_name_126", "Katelyn"),
    ("female_name_127", "Katherine"),
    ("female_name_128", "Latisha"),
    ("female_name_129", "Letita"),
    ("female_name_130", "Morgan"),
    ("female_name_131", "Moragine"),
    ("female_name_132", "Morgayne"),
    ("female_name_133", "Lauda"),
    ("female_name_134", "Pagan"),
    ("female_name_135", "Paige"),
    ("female_name_136", "Ysabel"),
    ("female_name_137", "Isable"),
    ("female_name_138", "Able"),
    ("female_name_139", "Eleanor"),
    ("female_name_140", "Matilda"),
    ("female_name_141", "Maude"),
    ("female_name_142", "Matildae"),
    ("female_name_143", "Matilday"),
    ("female_name_144", "Bareguieria"),
    ("female_name_145", "Isabelle"),
    ("female_name_146", "Isabella"),
    ("female_name_147", "Elanoria"),
    ("female_name_148", "Phillipa"),
    ("female_name_149", "Mary"),
    ("female_name_150", "Catherine"),
    ("female_name_151", "Mary"),
    ("female_name_152", "Bohun"),
    ("female_name_153", "Margaret"),
    ("female_name_154", "Margeret"),
    ("female_name_155", "Magarit"),
    ("female_name_156", "Elizabeth"),
    ("female_name_157", "Anne"),
    ("female_name_158", "Annie"),
    ("female_name_159", "Provinciea"),
    ("female_name_160", "Anna"),
    ("female_name_161", "Heloise"),
    ("female_name_162", "Hildegard"),
    ("female_name_163", "Julian"),
    ("female_name_164", "Christine"),
    ("female_name_165", "Jane"),
    ("female_name_166", "Shoria"),
    ("female_name_167", "Alice"),
    ("female_name_168", "Katherin"),
    ("female_name_169", "Margarey"),
    ("female_name_170", "Joaness"),
    ("female_name_171", "Godiva"),
    ("female_name_172", "Marigold"),
    ("female_name_173", "Lulu"),
    ("female_name_174", "Marden"),
    ("female_name_175", "Magge"),
    ("female_name_176", "Madi"),
    ("female_name_177", "Luei"),
    ("female_name_178", "Lufu"),
    ("female_name_179", "Luella"),
    ("female_name_180", "Lovedie"),
    ("female_name_181", "Lovedeya"),
    ("female_name_182", "LoveDaya"),
    ("female_name_183", "Lovedaia"),
    ("female_name_184", "Lorcia"),
    ("female_name_185", "Lorelle"),
    ("female_name_186", "Lorellen"),
    ("female_name_187", "Loricar"),
    ("female_name_188", "Long"),
    ("female_name_189", "Linsey"),
    ("female_name_190", "Lindsey"),
    ("female_name_191", "Linden"),
    ("female_name_192", "Lily"),
    ("female_name_193", "Lili"),
    ("female_name_194", "Lilli"),
    ("female_name_195", "Lilian"),
    ("female_name_196", "Leuedai"),
    ("female_name_197", "Liliana"),
    ("female_name_198", "Letha"),
    ("female_name_199", "Lee"),
    ("female_name_200", "Lark"),
    ("female_name_end", "End"),

    Code:
      ("set_player_name", 0, mesh_load_window, [
            (ti_on_presentation_load,
             [(set_fixed_point_multiplier, 1000),
    
              (str_store_string, s1, "@What will be the name of your character?"),
              (create_text_overlay, reg1, s1, tf_center_justify),
              (position_set_x, pos1, 500),
              (position_set_y, pos1, 400),
              (overlay_set_position, reg1, pos1),
              (overlay_set_text, reg1, s1),
              (create_simple_text_box_overlay, "$g_presentation_obj_set_player_name_1"),
              (position_set_x, pos1, 400),
              (position_set_y, pos1, 350),
              (overlay_set_position, "$g_presentation_obj_set_player_name_1", pos1),
    
              (create_button_overlay, "$g_presentation_obj_set_player_name_2", "@Randomize male name", tf_center_justify),
              (position_set_x, pos1, 585),
              (position_set_y, pos1, 325),
              (overlay_set_position, "$g_presentation_obj_set_player_name_2", pos1),
    
              (create_button_overlay, "$g_presentation_obj_set_player_name_3", "@Randomize female name",
               tf_center_justify),
              (position_set_x, pos1, 585),
              (position_set_y, pos1, 285),
              (overlay_set_position, "$g_presentation_obj_set_player_name_3", pos1),
    
              (create_button_overlay, "$g_presentation_obj_set_player_name_4", "@Continue...", tf_center_justify),
              (position_set_x, pos1, 500),
              (position_set_y, pos1, 200),
              (overlay_set_position, "$g_presentation_obj_set_player_name_4", pos1),
    
              (presentation_set_duration, 999999),
              ]),
            (ti_on_presentation_event_state_change,
             [(store_trigger_param_1, ":object"),
              (try_begin),
              (eq, ":object", "$g_presentation_obj_set_player_name_2"),
    (store_random_in_range, reg3, "str_male_name_001", "str_male_name_200"),
              (str_store_string, s11, reg3),
              (troop_set_name, "trp_player", s11),
              (troop_set_plural_name, "trp_player", s11),
              (overlay_set_text, "$g_presentation_obj_set_player_name_1", s11),
              (str_store_string, s0, s11),
              (else_try),
              (eq, ":object", "$g_presentation_obj_set_player_name_3"),
    (store_random_in_range, reg3, "str_female_name_001", "str_female_name_200"),
              (str_store_string, s11, reg3),
              (troop_set_name, "trp_player", s11),
              (troop_set_plural_name, "trp_player", s11),
              (overlay_set_text, "$g_presentation_obj_set_player_name_1", s11),
              (str_store_string, s0, s11),
              (else_try),
              (eq, ":object", "$g_presentation_obj_set_player_name_4"),
              (str_store_string, s7, s0),
             (troop_set_name, "trp_player", s7),
              (troop_set_plural_name, "trp_player", s7),
    
              (jump_to_menu, "mnu_start_character_1"),
              (try_end),
              ]),
              ]),
  7. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    TheSwan Reforged Blacksmith

    This blacksmith menu is improved version of the original made by Jinnai,
    the original menu let you repair items, i added an option also to upgrade their modifier and increased the denar cost of those actions.


    The code is too long to be posted here so there is a viewing/download link that contain the code and instructions below.



  8. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    TheSwan bodyguard troops

    Small code that cause lords that stay/rest in a fief to replenish bodyguard troops each day(or how often you want).


    (in module_constants.py):
    Code:
    ######TheSwan bodyguard troops
    slot_faction_bodyguard_troop = 480
    ######TheSwan bodyguard troops

    (in module_troops.py)(can define the bodyguard as any other troop you wish):
    Code:
    ######TheSwan bodyguard troops
    ["swadian_bodyguard","Swadian Retainer","Swadian Retainers",tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_gloves|tf_guarantee_helmet|tf_guarantee_horse|tf_guarantee_shield,0,0,fac_kingdom_1,
    [itm_heavy_lance,itm_sword_two_handed_b,itm_sword_medieval_d_long,itm_morningstar,itm_morningstar,itm_sword_medieval_d_long,itm_tab_shield_heater_cav_b,
      itm_coat_of_plates_red,itm_cuir_bouilli,itm_plate_boots,itm_guard_helmet,itm_great_helmet,itm_bascinet,itm_charger,itm_warhorse,itm_gauntlets,itm_mail_mittens],
    def_attrib|level(28),wp_one_handed (150) | wp_two_handed (130) | wp_polearm (130) | wp_archery (75) | wp_crossbow (75) | wp_throwing (75),knows_common|knows_riding_5|knows_shield_5|knows_ironflesh_5|knows_power_strike_5,swadian_face_middle_1, swadian_face_older_2],
    
    ["vaegir_bodyguard","Vaegir Retainer","Vaegir Retainer",tf_mounted|tf_guarantee_shield|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet,0,0,fac_kingdom_2,
    [itm_ashwood_pike,itm_fighting_axe,itm_bardiche,itm_battle_axe,itm_fighting_axe,itm_tab_shield_kite_d,
      itm_banded_armor,itm_lamellar_vest,itm_lamellar_armor,itm_mail_chausses,itm_iron_greaves,itm_vaegir_war_helmet,itm_vaegir_war_helmet,itm_vaegir_lamellar_helmet,itm_leather_gloves],
    def_attrib|level(24),wp_melee(130),knows_riding_2|knows_athletics_4|knows_shield_2|knows_ironflesh_3|knows_power_strike_4,vaegir_face_middle_1, vaegir_face_older_2],
    
    
    ["khergit_bodyguard","Khergit Retainer","Khergit Retainers",tf_mounted|tf_guarantee_all_wo_ranged,0,0,fac_kingdom_3,
    [itm_sword_khergit_4,itm_spiked_mace,itm_one_handed_war_axe_b,itm_hafted_blade_a,itm_hafted_blade_b,itm_heavy_lance,itm_lance,
      itm_khergit_guard_helmet,itm_khergit_cavalry_helmet,itm_khergit_war_helmet,itm_lamellar_vest_khergit,itm_lamellar_armor,itm_khergit_leather_boots,itm_splinted_leather_greaves,itm_leather_gloves,itm_scale_gauntlets,itm_tab_shield_small_round_b,itm_tab_shield_small_round_c,itm_courser,itm_warhorse_steppe,itm_warhorse_steppe,itm_warhorse_steppe],
    def_attrib|level(23),wp_one_handed (110) | wp_two_handed (110) | wp_polearm (150) | wp_archery (110) | wp_crossbow (110) | wp_throwing (110),knows_riding_7|knows_power_strike_4|knows_power_draw_4|knows_power_throw_2|knows_ironflesh_4|knows_horse_archery_1|knows_shield_2,khergit_face_middle_1, khergit_face_older_2],
    
    
    ["nord_bodyguard","Nord Retainer","Nord Retainers",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_shield|tf_guarantee_helmet,0,0,fac_kingdom_4,
    [itm_sword_viking_3,itm_sword_viking_3_small,itm_great_axe,itm_one_handed_battle_axe_c,itm_tab_shield_round_e,itm_throwing_spears,itm_heavy_throwing_axes,itm_heavy_throwing_axes,
      itm_nordic_huscarl_helmet,itm_nordic_warlord_helmet,itm_banded_armor,itm_mail_boots,itm_mail_chausses,itm_mail_mittens],
    def_attrib|level(28),wp(170),knows_ironflesh_7|knows_power_strike_7|knows_power_throw_5|knows_riding_2|knows_athletics_7|knows_shield_6,nord_face_middle_1, nord_face_older_2],
    
    ["rhodok_bodyguard","Rhodok Retainer","Rhodok Retainers",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_shield|tf_guarantee_gloves,0,0,fac_kingdom_5,
    [itm_glaive,itm_military_hammer,itm_military_cleaver_c,itm_tab_shield_pavise_d,
      itm_full_helm, itm_bascinet_3,itm_bascinet_2,itm_surcoat_over_mail,itm_surcoat_over_mail,itm_heraldic_mail_with_surcoat,itm_mail_chausses,itm_leather_gloves,itm_mail_mittens],
    def_attrib|level(25),wp_one_handed (130) | wp_two_handed (115) | wp_polearm (155) | wp_archery (115) | wp_crossbow (115) | wp_throwing (115),knows_common|knows_ironflesh_6|knows_shield_5|knows_power_strike_5|knows_athletics_5,rhodok_face_middle_1, rhodok_face_older_2],
    
    
    ["sarranid_bodyguard","Sarranid Retainer","Sarranid Retainers",tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_gloves|tf_guarantee_helmet|tf_guarantee_horse|tf_guarantee_shield,0,0,fac_kingdom_6,
      [itm_heavy_lance,itm_scimitar_b,itm_sarranid_two_handed_mace_1,itm_sarranid_cavalry_sword,itm_tab_shield_small_round_c,
       itm_mamluke_mail,itm_sarranid_boots_d,itm_sarranid_boots_c,itm_sarranid_veiled_helmet,itm_arabian_horse_b,itm_warhorse_sarranid,itm_scale_gauntlets,itm_mail_mittens],
      def_attrib|level(27),wp_one_handed (150) | wp_two_handed (130) | wp_polearm (130) | wp_archery (75) | wp_crossbow (75) | wp_throwing (110),knows_common|knows_riding_6|knows_shield_5|knows_ironflesh_5|knows_power_strike_5,swadian_face_middle_1, swadian_face_older_2],
    
    ["player_faction_bodyguard","Retainer","Retainers",tf_mounted|tf_guarantee_helmet|tf_guarantee_armor|tf_guarantee_boots|tf_guarantee_shield|tf_guarantee_gloves|tf_guarantee_horse,0,0,fac_player_supporters_faction,[itm_heavy_lance, itm_bastard_sword_b, itm_sword_medieval_d_long, itm_tab_shield_heater_cav_b, itm_tab_shield_kite_cav_b, itm_tab_shield_small_round_c, itm_winged_great_helmet, itm_great_helmet, itm_heraldic_mail_with_tunic, itm_heraldic_mail_with_tunic_b, itm_plate_boots, itm_gauntlets, itm_charger, itm_warhorse],def_attrib|level(28),wp(150),knows_ironflesh_5|knows_power_strike_5|knows_shield_5|knows_riding_5|knows_athletics_2,mercenary_face_1, mercenary_face_2],
    ######TheSwan bodyguard troops

    (the following Spoiler put in module_scripts.py in the "game_start" script in the top of the file ):
    Code:
    ######TheSwan bodyguard troops
          (faction_set_slot, "fac_kingdom_1", slot_faction_bodyguard_troop, "trp_swadian_bodyguard"),
          (faction_set_slot, "fac_kingdom_2", slot_faction_bodyguard_troop, "trp_vaegir_bodyguard"),
          (faction_set_slot, "fac_kingdom_3", slot_faction_bodyguard_troop, "trp_khergit_bodyguard"),
          (faction_set_slot, "fac_kingdom_4", slot_faction_bodyguard_troop, "trp_nord_bodyguard"),
          (faction_set_slot, "fac_kingdom_5", slot_faction_bodyguard_troop, "trp_rhodok_bodyguard"),
          (faction_set_slot, "fac_kingdom_6", slot_faction_bodyguard_troop, "trp_sarranid_bodyguard"),
          (faction_set_slot, "fac_player_supporters_faction", slot_faction_bodyguard_troop, "trp_player_faction_bodyguard"),
    ######TheSwan bodyguard troops

    In the following script the limit per party is 20 bodyguards(can be changed) and the thing that effect it is the policy of that faction(aristocracy)
    that provided by the Diplomacy mod, if you dont use/dont have it, comment out(#) the lines from
    "(faction_get_slot, ":aristocraty", ":cur_faction", dplmc_slot_faction_aristocracy)," include and instead put
    "(try_begin),
    (assign, ":limit", 20,),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (try_end),"
    And if you want put any other limitations.

    (in module_script.py)(new script put at the end of the file):
    Code:
    ######TheSwan bodyguard troops
    ("theswan_bodyguard_troops",
    [
    (try_for_range, ":lord_no", active_npcs_begin, active_npcs_end),
    (troop_slot_eq, ":lord_no", slot_troop_occupation, slto_kingdom_hero),
    (neg|troop_slot_ge, ":lord_no", slot_troop_prisoner_of_party, 0),
    (troop_get_slot, ":party", ":lord_no", slot_troop_leaded_party),
    (party_is_active, ":party"),
    (gt, ":party", 0),
    (store_faction_of_party, ":cur_faction", ":party"),
    (party_get_attached_to, ":lord_attachment", ":party"),
    (is_between, ":lord_attachment", centers_begin, centers_end),
    (faction_get_slot, ":troop_bodyguard", ":cur_faction", slot_faction_bodyguard_troop),
    (party_count_members_of_type, ":count", ":party", ":troop_bodyguard"),
    (faction_get_slot, ":aristocraty", ":cur_faction", dplmc_slot_faction_aristocracy),
    (try_begin),
    (assign, ":limit", 20,),
    (eq, ":aristocraty", 3),
    (val_add, ":limit", 12),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (else_try),
    (eq, ":aristocraty", 2),
    (val_add, ":limit", 8),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (else_try),
    (eq, ":aristocraty", 1),
    (val_add, ":limit", 4),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (else_try),
    (eq, ":aristocraty", 0),
    (val_add, ":limit", 0),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (else_try),
    (eq, ":aristocraty", -1),
    (val_sub, ":limit", 4),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (else_try),
    (eq, ":aristocraty", -2),
    (val_sub, ":limit", 8),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (else_try),
    (eq, ":aristocraty", -3),
    (val_sub, ":limit", 12),
    (lt, ":count", ":limit"),
    (party_add_members, ":party", ":troop_bodyguard", 1),
    (try_end),
      (try_end),
            ]
        ),
    ######TheSwan bodyguard troops

    (in module_simple_triggers.py):
    Code:
    ######TheSwan bodyguard troops
    (24,
    [
         (call_script, "script_theswan_bodyguard_troops"),
    ]),
    ######TheSwan bodyguard troops
  9. Crysix

    OSP Medieval 3D Art Regnum Britannia

    Regnum Britannia is a collection of items that heavily re-textured based of the game "Medieval II: Total War" , This is free to use OSP as it was just sitting unused gathering dust, now can be used by the community, my goal of the pack when i first made those items was to recreate "Medieval II...
  10. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    TheSwanFlamingArrows-
    Updated.

    This will let the agents to swap from normal arrows to flaming arrows or vice versa in the battlefield\any other mission with a key click,
    The flaming arrows have more damage but slow reload and less accuracy than normal arrows,
    The flaming arrows fire and smoke that will hit the target wont be sticky, so if it hit a horse it may be smoke in the air for a very short time,

    Link to the custom sounds, textures and mesh will be at the end.

    *This will swap the normal arrows(itm_arrow) to the flaming arrows, so make sure the archers have itm_arrow for this to effect them, or change it to any other arrow item(adjust according to your mod, this use native arrows).
    *Only work for the ally agents, can be done small tweaks to make it also effect the agents from the enemy team, or any other operation that effect the enemy team use.
    *Adding the grenade script.

    First sounds, add those in module_sounds.py:
    Code:
        ("order_arrow_fire", sf_2d | sf_priority_10 | sf_vol_10, ["Group_State_Flaming_On_2.wav"]),
        ("order_arrow_normal", sf_2d | sf_priority_10 | sf_vol_10, ["Group_State_Flaming_Off_1.wav"]),

    Add the "script_create_explosion" in the module_scripts.py:
    Code:
    #script_create_explosion
      #Input: grenadier, damage min, damage max, explosion radius,
      #Output: none
      #NOTE: If creating an explosion outside of weapon triggers, store the location in pos1
      ("create_explosion", [
    
         (store_script_param, ":grenadier", 1),
         (store_script_param, ":damageMin", 2),
         (store_script_param, ":damageMax", 3),
         (store_script_param, ":radius", 4),
           (particle_system_burst,"psys_pistol_smoke",pos1,5),
            (particle_system_burst,"psys_fireplace_fire_small",pos1,60),
              (try_for_agents,":target"),
    
                (agent_is_alive, ":target"),
                (agent_is_active, ":target"),
                (agent_get_team, ":grenadiers_team", ":grenadier"),
                (agent_get_team, ":targets_team", ":target"),
                (teams_are_enemies, ":grenadiers_team", ":targets_team"),
    
                (agent_get_position,pos2,":target"),
                (get_distance_between_positions,":dist",pos1,pos2),
           (try_begin),
                   (lt,":dist", ":radius"),
                   (store_agent_hit_points,":hp",":target",10),
          (store_random_in_range,":dmg", ":damageMin", ":damageMax"),
          (val_sub,":hp",":dmg"),
          (try_begin),
           (lt, ":hp", 0),
            #if you want to play a custom animation for explosive deaths, put it here.
            #(agent_set_animation, ":target", "anim_explosion_death"),
           (try_end),
          (agent_deliver_damage_to_agent,":grenadier",":target", ":dmg"),
           (try_end),
            (try_end)
      ]),

    Add the flaming arrows items in the module_items.py:
    Code:
    #(if you dont want them in the market just remove the "itp_merchandise")
    #normal arrows.
    ["flaming_arrows", "Flaming Arrows", [("arrow", 0), ("huojian_fly", ixmesh_flying_ammo),("quiver", ixmesh_carry)],
    itp_type_arrows | itp_merchandise | itp_default_ammo, itcf_carry_quiver_back, 72,
    weight(4) | difficulty(0) | spd_rtng(85) | shoot_speed(30) | thrust_damage(1, blunt) | max_ammo(30) | weapon_length(
         95), imodbits_missile, [(ti_on_missile_hit, [
        (store_trigger_param_1, ":grenadier"),
        # GRENADE STATS
        (assign, ":damageMin", 60),
        (assign, ":damageMax", 100),
        (assign, ":radius", 125),
        (call_script, "script_create_explosion", ":grenadier", ":damageMin", ":damageMax", ":radius"),])]],
    
    #khergit arrows.
    ["flaming_khergit_arrows", "Flaming Khergit Arrows",
    [("arrow_b", 0), ("huojian_fly", ixmesh_flying_ammo), ("quiver_b", ixmesh_carry)],itp_type_arrows | itp_merchandise | itp_default_ammo, itcf_carry_quiver_back_right, 410,weight(4) | difficulty(0) | spd_rtng(85) | shoot_speed(30) | thrust_damage(6, blunt) | max_ammo(34) | weapon_length(95), imodbits_missile, [(ti_on_missile_hit, [
        (store_trigger_param_1, ":grenadier"),
        # GRENADE STATS
        (assign, ":damageMin", 60),
        (assign, ":damageMax", 100),
        (assign, ":radius", 125),
        (call_script, "script_create_explosion", ":grenadier", ":damageMin", ":damageMax", ":radius"),
    ])]],
    
    #barbed arrows.
    ["flaming_barbed_arrows", "Flaming Barbed Arrows",
    [("barbed_arrow", 0), ("huojian_fly", ixmesh_flying_ammo), ("quiver_d", ixmesh_carry)],
    itp_type_arrows | itp_merchandise | itp_default_ammo, itcf_carry_quiver_back_right, 72,
    weight(4) | difficulty(0) | spd_rtng(85) | shoot_speed(30) | thrust_damage(1, blunt) | max_ammo(
         30) | weapon_length(
         95), imodbits_missile, [(ti_on_missile_hit, [
        (store_trigger_param_1, ":grenadier"),
        # GRENADE STATS
        (assign, ":damageMin", 60),
        (assign, ":damageMax", 100),
        (assign, ":radius", 125),
        (call_script, "script_create_explosion", ":grenadier", ":damageMin", ":damageMax", ":radius"),
    ])]],
    
    #bodkin arrows.
    ["flaming_bodkin_arrows", "Flaming Bodkin Arrows", [("piercing_arrow", 0), ("huojian_fly", ixmesh_flying_ammo), ("quiver_c", ixmesh_carry)],
    itp_type_arrows | itp_merchandise | itp_default_ammo, itcf_carry_quiver_back_right, 72,
    weight(4) | difficulty(0) | spd_rtng(85) | shoot_speed(30) | thrust_damage(1, blunt) | max_ammo(
         30) | weapon_length(
         95), imodbits_missile, [(ti_on_missile_hit, [
        (store_trigger_param_1, ":grenadier"),
        # GRENADE STATS
        (assign, ":damageMin", 60),
        (assign, ":damageMax", 100),
        (assign, ":radius", 125),
        (call_script, "script_create_explosion", ":grenadier", ":damageMin", ":damageMax", ":radius"),
    ])]],


    Add at the top of module_mission_templates.py:
    Code:
    the_swan_flaming_arrows_use_fire = (
       0.0, 0, 0, [], [
    
           (try_begin),
           (key_clicked, key_t), #change to any key you want
           (try_for_agents, ":cur_agent"),
           (get_player_agent_no, ":player"),
           (agent_get_team, ":player_team", ":player"),
           (agent_is_alive, ":cur_agent"),
           (agent_is_human, ":cur_agent"),
           (agent_is_non_player, ":cur_agent"),
           (agent_get_team, ":cur_team", ":cur_agent"),
           (eq, ":cur_team", ":player_team"),
    (agent_get_ammo, ":destination", ":cur_agent", 1),
           (try_begin),
           (agent_has_item_equipped, ":cur_agent", "itm_arrows"),
      (agent_unequip_item, ":cur_agent", "itm_arrows"),
           (agent_equip_item, ":cur_agent", "itm_flaming_arrows"),
      (agent_set_wielded_item, ":cur_agent", "itm_flaming_arrows"),
    (agent_set_ammo, ":cur_agent", "itm_flaming_arrows",":destination"),
           (else_try),
           (agent_has_item_equipped, ":cur_agent", "itm_barbed_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_barbed_arrows"),
           (agent_equip_item, ":cur_agent", "itm_flaming_barbed_arrows"),
      (agent_set_wielded_item, ":cur_agent", "itm_flaming_barbed_arrows"),
    (agent_set_ammo, ":cur_agent", "itm_flaming_barbed_arrows",":destination"),
           (else_try),
           (agent_has_item_equipped, ":cur_agent", "itm_bodkin_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_bodkin_arrows"),
           (agent_equip_item, ":cur_agent", "itm_flaming_bodkin_arrows"),
      (agent_set_wielded_item, ":cur_agent", "itm_flaming_bodkin_arrows"),
    (agent_set_ammo, ":cur_agent", "itm_flaming_bodkin_arrows",":destination"),
           (else_try),
           (agent_has_item_equipped, ":cur_agent", "itm_khergit_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_khergit_arrows"),
           (agent_equip_item, ":cur_agent", "itm_flaming_khergit_arrows"),
      (agent_set_wielded_item, ":cur_agent", "itm_flaming_khergit_arrows"),
    (agent_set_ammo, ":cur_agent", "itm_flaming_khergit_arrows",":destination"),
           (end_try),
           (agent_set_ranged_damage_modifier, ":cur_agent", 165), #adjust fire arrow wielding agent stats according to your liking
           (agent_set_accuracy_modifier, ":cur_agent", 85), #adjust fire arrow wielding agent stats according to your liking
           (agent_set_reload_speed_modifier, ":cur_agent", 70), #adjust fire arrow wielding agent stats according to your liking
           (end_try),
           (display_message, "@Units, use fire!"),
           (agent_play_sound, ":player", "snd_order_arrow_fire"),
       ])
    the_swan_flaming_arrows_extinguish_flames = (
       0.0, 0, 0, [], [
      (try_begin),
           (key_clicked, key_u), #get clicked key to active
           (try_for_agents, ":cur_agent"),
           (get_player_agent_no, ":player"),
           (agent_get_team, ":player_team", ":player"),
           (agent_is_alive, ":cur_agent"),
           (agent_is_human, ":cur_agent"),
           (agent_is_non_player, ":cur_agent"),
           (agent_get_class, ":agent_class", ":cur_agent"),
    (neq, ":agent_class", grc_infantry), #not infnatry
           (agent_get_team, ":cur_team", ":cur_agent"),
           (eq, ":cur_team", ":player_team"),
           #  (agent_get_class, ":agent_class", ":cur_agent"),
           (agent_get_ammo, ":destination", ":cur_agent", 1),
           (try_begin),
           (agent_has_item_equipped, ":cur_agent", "itm_flaming_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_flaming_arrows"),
           (agent_equip_item, ":cur_agent", "itm_arrows"),
           (agent_set_wielded_item, ":cur_agent", "itm_arrows"),
           (agent_set_ammo, ":cur_agent", "itm_arrows", ":destination"),
           (else_try),
           (agent_has_item_equipped, ":cur_agent", "itm_flaming_barbed_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_flaming_barbed_arrows"),
           (agent_equip_item, ":cur_agent", "itm_barbed_arrows"),
           (agent_set_wielded_item, ":cur_agent", "itm_barbed_arrows"),
           (agent_set_ammo, ":cur_agent", "itm_barbed_arrows", ":destination"),
           (else_try),
           (agent_has_item_equipped, ":cur_agent", "itm_flaming_bodkin_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_flaming_bodkin_arrows"),
           (agent_equip_item, ":cur_agent", "itm_bodkin_arrows"),
           (agent_set_wielded_item, ":cur_agent", "itm_bodkin_arrows"),
           (agent_set_ammo, ":cur_agent", "itm_bodkin_arrows", ":destination"),
           (else_try),
           (agent_has_item_equipped, ":cur_agent", "itm_flaming_khergit_arrows"),
           (agent_unequip_item, ":cur_agent", "itm_flaming_khergit_arrows"),
           (agent_equip_item, ":cur_agent", "itm_khergit_arrows"),
           (agent_set_wielded_item, ":cur_agent", "itm_khergit_arrows"),
           (agent_set_ammo, ":cur_agent", "itm_khergit_arrows", ":destination"),
           (end_try),
    
           (agent_set_ranged_damage_modifier, ":cur_agent", 100),
           (agent_set_accuracy_modifier, ":cur_agent", 100),
           (agent_set_reload_speed_modifier, ":cur_agent", 100),
           (end_try),
           (display_message, "@Units, extinguish flames."),
           (agent_play_sound, ":player", "snd_order_arrow_normal"),
       ])

    Final thing is to add those to any mission you want this to be available:
    Code:
    the_swan_flaming_arrows_use_fire,
    the_swan_flaming_arrows_extinguish_flames,
    (technically anywhere with "common_battle_tab_press,")

    Link to the custom sounds, textures and mesh: https://www.dropbox.com/s/nutv3r6r5ebsij1/TheSwanFlamingArrows.rar?dl=0
  11. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    To be a lord in Calradia is not easy, although the high rank and privileges there are many dangerous and risks the lords put in order to serve their kingdom and ruler.

    So to respect their efforts here is a code to pay them weekly, this code can be improved and values can be changed to meet your needs and will.

    Start with the module_game_menus.py:
    Add the small block(action_lords_weekly_payment) below the "action_walk_around"  from camp action,
    Code:
     ("camp_action",0,
       "Choose an action:",
       "none",
       [
         ],
        [
          ("camp_recruit_prisoners",
           [(troops_can_join, 1),
            (store_current_hours, ":cur_time"),
            (val_sub, ":cur_time", 24),
            (gt, ":cur_time", "$g_prisoner_recruit_last_time"),
            (try_begin),
              (gt, "$g_prisoner_recruit_last_time", 0),
              (assign, "$g_prisoner_recruit_troop_id", 0),
              (assign, "$g_prisoner_recruit_size", 0),
              (assign, "$g_prisoner_recruit_last_time", 0),
            (try_end),
            ], "Recruit some of your prisoners to your party.",
           [(jump_to_menu, "mnu_camp_recruit_prisoners"),
            ],
           ),
          ("action_walk_around",[],"Walk around.",
           [(set_jump_mission,"mt_ai_training"),
            (call_script, "script_setup_random_scene"),
         (change_screen_mission)
            ]
           ),
    
    ("action_lords_weekly_payment",[(faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active)],"Set lords weekly payment.",
           [(jump_to_menu, "mnu_lords_weekly_payment"),
    	    ]),

    Now add this menu anywhere in module_game_menus.py:
    Code:
      ("lords_weekly_payment",0,
       "Choose the weekly paymet of your lords.^{s24}^Current payment for each lord is {s2}",
       "none",
       [
           (assign, ":num_lords", 0),
           (try_for_parties, ":cur_party"),
           (store_faction_of_party, ":cur_faction", ":cur_party"),
           (eq, ":cur_faction", "fac_player_supporters_faction"),
    
           (try_begin),
           (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_hero_party),
           (val_add, ":num_lords", 1),
           (try_end),
           (try_end),
    
           (assign, reg60, ":num_lords"),
           (str_store_string, s24, "@Our kingdom currently have ({reg60}) lords."),
    
           (try_begin),
           (eq, "$lord_payment", 1),
           (str_store_string, s2, "@Very low(125 denars), -3 renown, -2 right to rule, -1 honor."),
           (else_try),
           (eq, "$lord_payment", 2),
           (str_store_string, s2, "@Low(200 denars), -2 renown, -1 right to rule."),
           (else_try),
           (eq, "$lord_payment", 3),
           (str_store_string, s2, "@Average(325 denars)."),
           (else_try),
           (eq, "$lord_payment", 4),
           (str_store_string, s2, "@High(450 denars), +2 renown, +2 right to rule."),
           (else_try),
           (eq, "$lord_payment", 5),
           (str_store_string, s2, "@Very high(600 denars), +2 renown, +2 right to rule, +1 honor."),
           (try_end),
           (try_end),
       ],
        [
          ("lords_weekly_payment1",[],"Very low weekly payment.",
           [
               (assign, "$lord_payment", 1),
            ]),
           ("lords_weekly_payment2", [], "Low weekly payment.",
            [
                (assign, "$lord_payment", 2),
            ]),
           ("lords_weekly_payment3", [], "Average weekly payment.",
            [
                (assign, "$lord_payment", 3),
            ]),
           ("lords_weekly_payment4", [], "High weekly payment.",
            [
                (assign, "$lord_payment", 4),
            ]),
           ("lords_weekly_payment5", [], "Very high weekly payment.",
            [
                (assign, "$lord_payment", 5),
            ]),
    
          ("camp_action_4",[],"Back to camp menu.",
           [(jump_to_menu, "mnu_camp"),
            ]
           ),
          ]
      ),

    Last thing with the menus just assign the lord payment to 3(average), add to the first menu in the game "start_game_0",
    Code:
     (assign, "$lord_payment", 3),

    In the module_scripts.py just assign the the "$lord_payment" as global variable"(assign, "$lord_payment", 0),":
    Code:
      ("lco_initialize_presentation",
            [
    
                (presentation_set_duration, 999999),
                (try_begin),
                    (eq, "$g_lco_initialized", 0),
                    (assign, "$g_lco_activate_troop", 0), # By default, we do not make a particular troop active
                    (assign, "$g_lco_active_hero", 0),    # We show the first hero by default
                    (assign, "$g_lco_page", 0),           # We show the first page by default
                    (assign, "$g_lco_operation", 0),      # No special action by default
                    (assign, "$g_lco_target", 0),         # No action target by default
                    (assign, "$g_lco_auto_horses", 1),    # Horses are auto-equipped by default
                    (assign, "$g_lco_auto_armors", 1),    # Same
                    (assign, "$g_lco_auto_shields", 1),   # Same
                    (assign, "$g_lco_include_companions", 1),
                    (assign, "$g_lco_include_lords", 0),
                    (assign, "$g_lco_include_regulars", 0),
                    # BugFix V1.1. Do not overwrite $g_lco_garbage_troop on first run if it's already initialized.
                    (try_begin),
                        (lt, "$g_lco_garbage_troop", 3),
                        (assign, "$g_lco_garbage_troop", lco_garbage), # This troop will be used for discarding items or looting, and it's inventory will be purged on exit
                    (try_end),
                    (assign, "$g_lco_initialized", 1),
                    # BugFix V1.2. Hardcoded xp-to-level conversion table has been removed
                (try_end),
    
                # GLOBAL VARIABLES INITIALIZATION
                (assign, "$lord_payment", 0),              ###########>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>add this
                (assign, "$g_lco_heroes", 0),             # Total number of heroes in the party, excluding player
                (assign, "$g_lco_inv_slots", 0),          # Total number of slots in the player's inventory
                (assign, "$g_lco_dragging", 0),           # Currently not dragging anything
                (assign, "$g_lco_dragging_from", 0),      # Troop ID of dragged item current owner
                (assign, "$g_lco_dragging_from_slot", 0), # Slot ID of dragged item current owner
                (assign, "$g_lco_drag_item", -1),         # Item type currently being dragged
                (assign, "$g_lco_drag_modifier", 0),      # Modifier of item currently being dragged
    lco_initialize_presentation(g_lco)' are global corresponding to an Lav's modification- https://forums.taleworlds.com/index.php/topic,189930.msg4545726.html#msg4545726

    Last thing to add is the trigger in module_simple_triggers.py add this:
    Code:
        (24 * 7,  #lords_weekly_payment
         [
             #check if the player kingdom is active and get the total number of lords in the player kingdom.
             (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
             (assign, ":num_lords", 0),
             (try_for_parties, ":cur_party"),
             (store_faction_of_party, ":cur_faction", ":cur_party"),
             (try_begin),
             (eq, ":cur_faction", "fac_player_supporters_faction"),
             (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_hero_party),
             (val_add, ":num_lords", 1),
             (assign, reg60, ":num_lords"),
             (try_end),
    
             #check payment ranks that called from the camp action menu(default is 3, Average).
             (try_begin), # Very low.
             (eq, "$lord_payment", 1),
             (assign, ":payment_very_low", 125),
             (assign, reg61, ":payment_very_low"),
             (else_try), # Low.
             (eq, "$lord_payment", 2),
             (assign, ":payment_low", 200),
             (assign, reg61, ":payment_low"),
             (else_try), # Average.
             (eq, "$lord_payment", 3),
             (assign, ":payment_average", 325),
             (assign, reg61, ":payment_average"),
             (else_try), # High.
             (eq, "$lord_payment", 4),
             (assign, ":payment_high", 450),
             (assign, reg61, ":payment_high"),
             (else_try), # Very High.
             (eq, "$lord_payment", 5),
             (assign, ":payment_very_high", 600),
             (assign, reg61, ":payment_very_high"),
             (try_end),
             (try_end),
             #set the checked variables to their values.
             (try_begin),
             (eq, "$lord_payment", 1),
             (store_mul, ":payment_final", ":num_lords", ":payment_very_low"), # ":num_lords"= current faction lords, ":payment_very_low"(125), Current lords*125=":payment_final".
             (assign, ":renown", -3),
             (assign, ":right_to_rule", -2),
             (assign, ":honor", -1),
             (else_try),
             (eq, "$lord_payment", 2),
             (store_mul, ":payment_final", ":num_lords", ":payment_low"), # ":num_lords"= current faction lords, ":payment_low"(200), Current lords*200=":payment_final".
             (assign, ":renown", -2),
             (assign, ":right_to_rule", -1),
             (assign, ":honor", 0),
             (else_try),
             (eq, "$lord_payment", 3),
             (store_mul, ":payment_final", ":num_lords", ":payment_average"), # ":num_lords"= current faction lords, ":payment_average"(325), Current lords*325=":payment_final".
             (assign, ":renown", 0),
             (assign, ":right_to_rule", 0),
             (assign, ":honor", 0),
             (else_try),
             (eq, "$lord_payment", 4),
             (store_mul, ":payment_final", ":num_lords", ":payment_high"), # ":num_lords"= current faction lords, ":payment_high"(450), Current lords*450=":payment_final".
             (assign, ":renown", 2),
             (assign, ":right_to_rule", 2),
             (else_try),
             (eq, "$lord_payment", 5),
             (store_mul, ":payment_final", ":num_lords", ":payment_very_high"), # ":num_lords"= current faction lords, ":payment_very_high"(600), Current lords*600=":payment_final".
             (assign, ":renown", 3),
             (assign, ":right_to_rule", 2),
             (assign, ":honor", 1),
             (try_end),
             (try_end),
             (assign, reg62, ":payment_final"),
    
              #execute the values, first check the player treasury, if there is enough gold for the payment take from there(if not go to the next check) and the rank effects to the player(renown,right to rule,honor).
             (try_begin),
             (store_troop_gold, ":household_gold", "trp_household_possessions"),
             (lt, ":payment_final", ":household_gold"),
             (display_message,"@Our kingdom currently have ({reg60}) lords and each lord payment is ({reg61} denars) their weekly cost is ({reg62} denars).",0xFFD800),
             (troop_remove_gold, "trp_household_possessions", ":payment_final"),
             (call_script, "script_change_troop_renown", "trp_player", ":renown"),
             (call_script, "script_change_player_right_to_rule", ":right_to_rule"),
             (call_script, "script_change_player_honor", ":honor"),
            #execute the values, second check the player personal gold, if there is enough gold for the payment take from there and the rank effects to the player(renown,right to rule,honor).
             (else_try),
             (store_troop_gold, ":player_gold", "trp_player"),
             (lt, ":payment_final", ":player_gold"),
             (display_message,"@Our kingdom currently have ({reg60}) lords and each lord payment is ({reg61} denars) their weekly cost is ({reg62} denars).",0xFFD800),
             (troop_remove_gold, "trp_player", ":payment_final"),
             (call_script, "script_change_troop_renown", "trp_player", ":renown"),
             (call_script, "script_change_player_right_to_rule", ":right_to_rule"),
             (call_script, "script_change_player_honor", ":honor"),
             # execute the values, third check, in this point the treasury and the player dont have enough gold for the payment, not taking any gold from the player but decreasing the player relation with all his lords by 1.
             (else_try),
             (store_sub, ":difference", ":payment_final", ":player_gold"),
             (assign, reg63, ":difference"),
             (display_message,"@Our kingdom currently have ({reg60}) lords and each lord payment is ({reg61} denars) their weekly cost is ({reg62} denars), you needed more ({reg63} denars) to pay your lords.",0xFF0000),
             (display_message,"@The relation with all your lords decreased by 1.",0xFF0000),
             (try_for_range, ":lord", lords_begin, lords_end),
             (troop_slot_eq, ":lord", slot_troop_occupation, slto_kingdom_hero),
             (store_faction_of_troop, ":troop_faction", ":lord"),
             (eq, ":troop_faction", "$players_kingdom"),
             (set_show_messages, 0), # to avoid a lot of red lines in the left side of the screen.
             (call_script, "script_troop_change_relation_with_troop", ":lord", "trp_player", -1),
             (set_show_messages, 1),
             (try_end),
             (try_end),
         ]),
  12. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    Hey Dj_FRedy, the fire arrow item\model can be found in varied mods, for example there is in the-12th- mod, you can set the trigger where ever you want yes, but in simple triggers it work just fine, and yes i forgot its Lav global variables and addition.
  13. Crysix

    PYTHON SCRIPT/SCHEME EXCHANGE

    Change the item(itm_arquebus) and constants "is_between"(thunder_braves_begin, thunder_braves_end) to the troops range you wish, same as "trp_thunder_brave", change it to your troop.
    its basically a dialog to give a specific item to one of the troops you putted in the constants range, remove the talked troop and item, and add the new unit, you can expand it or modify to your needs(the "trp_thunder_brave"  is a custom troop, not connected to the troop trees in my case)-

    Code:
    # TheSwan Thunder braves begin
      [anyone|plyr,"regular_member_talk", [(player_has_item, "itm_arquebus"), (is_between,"$g_talk_troop",thunder_braves_begin, thunder_braves_end),], "I got some of those invaders fire thunders, take it, it will serve you well in battle.", "thunder_braves1",[]],
      [anyone|plyr, "thunder_braves2", [], "Here you can have it.", "close_window", [(party_remove_members,"p_main_party","$g_talk_troop", 1), (party_add_members, "p_main_party", "trp_thunder_brave", 1), (troop_remove_item, "trp_player", "itm_arquebus")]],
      [anyone|plyr, "thunder_braves2", [], "I change my mind.", "close_window", []],
      [anyone, "thunder_braves1", [], "Thank you, {sir/madam}.", "thunder_braves2", []],
    # TheSwan Thunder braves end


    In that code its basically giving that troop a gun(if you have it in your inventory), the custom troop there  (trp_thunder_brave) is similar troop to the talked troop you about to remove, only with a gun(can be any different gear you wish) so its kind of evolving you can say, this should be changed according to your desire
Back
Top Bottom