B Tutorial Module System Add penalty by heavy equipment (Warband)

Currently viewing this thread:

Idibil

Grandmaster Knight
Best answers
0
Brytenwalda players will hate me  :mrgreen:, but I had add penalty when player is equipped with heavy armor and heavy helmets.

Why?

It is difficult to shoot a bow, or attack with the same strength when you are carrying over 20 kg.
In the case of the helmets, mainly because they impedes the vision, in addition to annoy on the head.

If you want to make your mod more realistic, and bring the balance between the player choice of using heavy armor and light armor (Currently the player is always trying to get the heavy armor, hard and resistant. But that should depend of player game style. If you want to be an archer on horseback, it havent sense that you seen as a French knight on fourteenth century), if you want more fun in your mod, keep reading.

In the forum there is already a code to give benefits (and even make magical weapons) to objects. You can meet it HERE
Too, you can meet inventory slots HERE , if you wish add others/more items in furute.

My job is to make this work in a script for armor.

Final idea is that if you wear a heavy armor, you'll have penalties in skills such as: Horse archery, riding, athletics, power_draw, power_throw and power_strike, because of the weight you carry over.
And if you wear a helmet, you have problems of visibility and comfort, that penalize your horse_archery,  power_throw  and power_draw.


Begin

module_constants.py

You need create slots for items patch.
In Brytenwalda we have different heavy weapons distributed in the code. I divided this in heavy (18 kg or more) and medium (14 kg or more)
Helmets: they are heavy helmets only.

You need change it to your items mod.

#######para negativos equipamiento brytenwalda habilidades skills######
armadura_pesada_begin = "itm_mail_coat_1"
armadura_pesada_end = "itm_mail_shirt_1"
armadura_pesada2_begin = "itm_mail_vest_b"
armadura_pesada2_end = "itm_vikinglamellar1"
armadura_pesada3_begin = "itm_wolf_coat1"
armadura_pesada3_end = "itm_arena_tunicj_brown"
armadura_pesada4_begin = "itm_byrnie"
armadura_pesada4_end = "itm_pelt_coat"
armadura_media_begin = "itm_mail_shirt_1"
armadura_media_end = "itm_mail_vest_b"
armadura_media2_begin = "itm_mail_shirt_1_trig"
armadura_media2_end = "itm_wolf_coat1"
yelmos_pesados_begin = "itm_frisian_helmet_mesh"
yelmos_pesados_end = "itm_peasant_man_c"
yelmos_pesados2_begin = "itm_boar_helmet"
yelmos_pesados2_end = "itm_skullcap_b"
####brytenwalda end########


module_scripts.py

We need change/add two scripts here:
1- information to player about penalties
2- Code for apply penalties

Information:

Find: game_get_item_extra_text

And add:

      (else_try),

#anadido brytenwalda para armaduras y yelmos#################
        (this_or_next|is_between, ":item_no", armadura_pesada_begin, armadura_pesada_end),
        (this_or_next|is_between, ":item_no", armadura_pesada2_begin, armadura_pesada2_end),
        (this_or_next|is_between, ":item_no", armadura_pesada3_begin, armadura_pesada3_end),
        (this_or_next|is_between, ":item_no", armadura_pesada4_begin, armadura_pesada4_end),
        (this_or_next|is_between, ":item_no", armadura_media_begin, armadura_media_end),
        (this_or_next|is_between, ":item_no", armadura_media2_begin, armadura_media2_end),
        (this_or_next|is_between, ":item_no", yelmos_pesados_begin, yelmos_pesados_end),
        (is_between, ":item_no", yelmos_pesados2_begin, yelmos_pesados2_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (set_result_string, "@Heavy Equipment: penalties in some skills"),
          (set_trigger_result, 0xFFEEDD),
        (try_end),
      (else_try),
#brytenwalda end#####################

        (is_between, ":item_no", readable_books_begin, readable_books_end),


Finally, find: game_get_skill_modifier_for_troop

And add:

      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),

####brytenwalda begin #########
    (else_try), #armadura pesada, heavy armor
  (this_or_next|eq, ":skill_no", "skl_power_draw"),
  (this_or_next|eq, ":skill_no", "skl_horse_archery"),
  (this_or_next|eq, ":skill_no", "skl_riding"),
  (this_or_next|eq, ":skill_no", "skl_athletics"),
  (this_or_next|eq, ":skill_no", "skl_power_throw"),
  (eq, ":skill_no", "skl_power_strike"),
  (troop_get_inventory_slot,":cur_item1",":troop_no",ek_body),#Here we are getting items from slots, body here.
  (troop_get_inventory_slot,":cur_item2",":troop_no",ek_body),#Those slots are where items are placed.
  (troop_get_inventory_slot,":cur_item3",":troop_no",ek_body),
  (troop_get_inventory_slot,":cur_item4",":troop_no",ek_body),
  (this_or_next|is_between, ":cur_item1", armadura_pesada_begin, armadura_pesada_end),
  (this_or_next|is_between, ":cur_item2", armadura_pesada2_begin, armadura_pesada2_end),
  (this_or_next|is_between, ":cur_item3", armadura_pesada3_begin, armadura_pesada4_end),
  (is_between, ":cur_item4", armadura_pesada4_begin, armadura_pesada4_end),
  (val_sub, ":modifier_value", 4),#And resta 2
    (else_try), #armadura media, medium armor
  (this_or_next|eq, ":skill_no", "skl_power_draw"),
  (this_or_next|eq, ":skill_no", "skl_horse_archery"),
  (this_or_next|eq, ":skill_no", "skl_riding"),
  (this_or_next|eq, ":skill_no", "skl_athletics"),
  (this_or_next|eq, ":skill_no", "skl_power_throw"),
  (eq, ":skill_no", "skl_power_strike"),
  (troop_get_inventory_slot,":cur_item1",":troop_no",ek_body),#Here we are getting items from slots
  (troop_get_inventory_slot,":cur_item2",":troop_no",ek_body),
  (this_or_next|is_between, ":cur_item1", armadura_media_begin, armadura_media_end),
  (is_between, ":cur_item2", armadura_media2_begin, armadura_media2_end),
  (val_sub, ":modifier_value", 2),#And resta 2
    (else_try), #yelmos, helmets
  (this_or_next|eq, ":skill_no", "skl_power_draw"),
  (this_or_next|eq, ":skill_no", "skl_horse_archery"),
  (eq, ":skill_no", "skl_power_throw"),
  (troop_get_inventory_slot,":cur_item1",":troop_no",ek_head),#Here we are getting items from slots, head here
  (troop_get_inventory_slot,":cur_item2",":troop_no",ek_head),#Those slots are where items are placed.
  (this_or_next|is_between, ":cur_item1", yelmos_pesados_begin, yelmos_pesados_end),
  (is_between, ":cur_item2", yelmos_pesados2_begin, yelmos_pesados2_end),
  (val_sub, ":modifier_value", 2),#And resta 2
#brytenwalda end############################

    (try_end),
    (set_trigger_result, ":modifier_value"),
    ]),



It is easy, and you have it ready yet!  :wink:






 

gdwitt

Knight at Arms
Best answers
0
I found the code in the module scripts.
I have some new armor that I want to classify as medium penalty.
What designates an armor as heavy vs medium?
Where in the module file is it?

Can I cut and paste certain armors (rawhide) from no penalty into medium penalty?

Thank you in advance.
 

k61824

Veteran
Best answers
0
Idibil said:
Final idea is that if you wear a heavy armor, you'll have penalties in skills such as: Horse archery, riding, athletics, power_draw, power_throw and power_strike, because of the weight you carry over.
And if you wear a helmet, you have problems of visibility and comfort, that penalize your horse_archery,  power_throw  and power_draw.
From a realism point of view, visually-impairing helmet would penalize weapon proficiency rather than power throw/draw.  There is nothing stopping you from wearing a big helmet without affect arm movement (fight like a gladiator without chest armor for example).  As such the penalty would be rather from accuracy than from loss of damage.  Also armored horses are designed to take heavily armored troop (there is no point of having heavily armored horses to carry a flimsy individual;  he'll just get killed and the horse taken.)  So penalizing the horse's speed rather than the net riding skill needed to ride a horse would be more appropriate.

If that was the case is ther any way I can modify the proficiencies or horse speed instead?
 

kraggrim

Marquis
WBM&BWF&SNWVC
Best answers
0
gdwitt said:
I found the code in the module scripts.
I have some new armor that I want to classify as medium penalty.
What designates an armor as heavy vs medium?
Where in the module file is it?

Can I cut and paste certain armors (rawhide) from no penalty into medium penalty?

Thank you in advance.
Tried just cutting and pasting this dress in item_kinds1.txt to below mail_shirt_1:
Seemed to work.