Party strength

From Mount&Blade Modding Wiki
Jump to: navigation, search

The party strength is one of the main factors that determines whether an enemy AI party feels capable of defeating another party.

Contents

[edit] Mount&Blade

partystrengthformulamb1.png

partystrengthformulagen.png

In the default Mount&Blade as of version 1.010/1.011, each stack of troops in the party contributes a strength score according to their level plus 12, squared, and divided by 100 (dropping fractions), and then multiplied by the number of non-wounded troops in that stack. The total score of the party is simply equal to the sum total of the stacks in the party.

[edit] Example

For instance, 5 Swadian Knights correspond to a stack strength of 37² (1 369), divided by 100 truncating all fractions (13), and multiplied by the number of non-wounded troops in the stack to yield a score of 65. 32 Swadian Recruits correspond to a stack strength of 16² (256), divided by 100 truncating all fractions (2), and multiplied by the number of non-wounded troops in the stack to yield a score of 64. The game considers the recruits and knights to be a fairly even match, although the field of battle will quickly prove otherwise as the recruits fall like wheat before a scythe.

[edit] Script

  #script_party_calculate_strength:
  # INPUT: arg1 = party_id, arg2 = exclude leader
  # OUTPUT: reg0 = strength
  
  ("party_calculate_strength",
    [
      (store_script_param_1, ":party"), #Party_id
      (store_script_param_2, ":exclude_leader"), #Party_id
      
      (assign, reg(0),0),
      (party_get_num_companion_stacks, ":num_stacks",":party"),
      (assign, ":first_stack", 0),
      (try_begin),
        (neq, ":exclude_leader", 0),
        (assign, ":first_stack", 1),
      (try_end),
      (try_for_range, ":i_stack", ":first_stack", ":num_stacks"),
        (party_stack_get_troop_id,     ":stack_troop",":party",":i_stack"),
        (store_character_level, ":stack_strength", ":stack_troop"),
        (val_add, ":stack_strength", 12),
        (val_mul, ":stack_strength", ":stack_strength"),
        (val_div, ":stack_strength", 100),
        (try_begin),
          (neg|troop_is_hero, ":stack_troop"),
          (party_stack_get_size, ":stack_size",":party",":i_stack"),
          (party_stack_get_num_wounded, ":num_wounded",":party",":i_stack"),
          (val_sub, ":stack_size", ":num_wounded"),
          (val_mul, ":stack_strength", ":stack_size"),
        (else_try),
          (troop_is_wounded, ":stack_troop"), #hero...
          (assign,":stack_strength",0),
        (try_end),
        (val_add,reg(0), ":stack_strength"),
      (try_end),
      (party_set_slot, ":party", slot_party_cached_strength, reg(0)),
  ]),

[edit] Warband

partystrengthformulawb1.png

partystrengthformulagen.png

In Mount&Blade: Warband as of version 1.125 and later, each stack of troops in the party contributes a strength score according to their level plus 4, squared, doubled, and divided by 100. For an extremely low-level character whose level is 3 or below and the result would be zero, the score is assigned to a minimum of 1. The total score of the party is simply equal to the sum total of the stacks in the party.

On the whole, the later versions of Warband provide a more skewed party strength rating when compared to the formula of the latest version of the original Mount&Blade; a small stack of high level troops is considered far more dominant than a much larger force of weaker troops, as is often the case.

[edit] Example

For instance, 5 Swadian Knights correspond to a stack strength of 32² (1 024), doubled (2 048), divided by 100 truncating fractions (20), and multiplied by the number of non-wounded troops in the stack to produce a rating of 100. 32 Swadian Recruits correspond to a stack strength of 8² (64), doubled (128), divided by 100 truncating fractions (1), and multiplied by the number of non-wounded troops in the stack to produce a rating of 32. The game considers the recruits to be outclassed 3-to-1 by the knights, and indeed each Knight is considered the equal of twenty men.

[edit] Script

  #script_party_calculate_strength:
  # INPUT: arg1 = party_id, arg2 = exclude leader
  # OUTPUT: reg0 = strength
  
  ("party_calculate_strength",
    [
      (store_script_param_1, ":party"), #Party_id
      (store_script_param_2, ":exclude_leader"), #Party_id
      
      (assign, reg0,0),
      (party_get_num_companion_stacks, ":num_stacks", ":party"),
      (assign, ":first_stack", 0),
      (try_begin),
        (neq, ":exclude_leader", 0),
        (assign, ":first_stack", 1),
      (try_end),
      (try_for_range, ":i_stack", ":first_stack", ":num_stacks"),
        (party_stack_get_troop_id, ":stack_troop",":party", ":i_stack"),
        (store_character_level, ":stack_strength", ":stack_troop"),
        (val_add, ":stack_strength", 4), #new was 12 (patch 1.125)
        (val_mul, ":stack_strength", ":stack_strength"),
        (val_mul, ":stack_strength", 2), #new (patch 1.125)
        (val_div, ":stack_strength", 100),
        (val_max, ":stack_strength", 1), #new (patch 1.125)
        (try_begin),
          (neg|troop_is_hero, ":stack_troop"),
          (party_stack_get_size, ":stack_size",":party",":i_stack"),
          (party_stack_get_num_wounded, ":num_wounded",":party",":i_stack"),                    
          (val_sub, ":stack_size", ":num_wounded"),
          (val_mul, ":stack_strength", ":stack_size"),
        (else_try),
          (troop_is_wounded, ":stack_troop"), #hero & wounded
          (assign, ":stack_strength", 0),
        (try_end),
        (val_add, reg0, ":stack_strength"),
      (try_end),
      (party_set_slot, ":party", slot_party_cached_strength, reg0),
  ]),
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox