trigger on mission_templates for VC (wounds system)
(ti_on_agent_hit, 0.000, 0.000, # Agent has been damaged with a weapon attack
[
],
[
(store_trigger_param, ":was_hit_agent_id", 1), # who got hit
(get_player_agent_no, ":plyr_agent_id"), # player
(eq, ":was_hit_agent_id", ":plyr_agent_id"), # player was hit
(store_trigger_param, ":dmg", 3), # how much dmg
(store_trigger_param, ":bone", 4), # which bone
(store_agent_hit_points, ":plyr_HP", ":was_hit_agent_id", 1), # player HP
(ge, ":dmg", ":plyr_HP"), # kills player (dmg > HP)
(try_begin),
(store_random_in_range, ":rnd1", 1, 101),
(lt, ":rnd1", 20), # 20% chance of wounded
(assign, "$wounded_today", 1),
(val_add, "$total_wounds_ever", 1),
(try_begin), # head hit
(eq, ":bone", 9), #hb_head = 9
(lt, ":rnd1", 10), # 10% chance
(assign, ":attrib_for_penalty_id", 2),
(assign, ":slot_qst_vc_wounds", 31),
(str_store_string, s1, "@You_suffer_a_serious_injury_to_your_head._(-1_intelligence)"),
(else_try), # head again, if failed the 10%
(eq, ":bone", 9),
(assign, ":attrib_for_penalty_id", 3), # dmg to charisma
(assign, ":slot_qst_vc_wounds", 32),
(str_store_string, s1, "@You_suffer_a_serious_injury_to_your_face._(-1_charisma)"),
(else_try),
(this_or_next|is_between, ":bone", 10, 19), # not head, not 8, 9, 0 means not hb_head, hb_abdomen, hb_thorax
(is_between, ":bone", 1, 7),
(assign, ":attrib_for_penalty_id", 1), # agility
(assign, ":slot_qst_vc_wounds", 34),
(str_store_string, s1, "@You_suffer_a_serious_injury_to_one_of_your_limbs._(-1_agility)"),
(else_try),
(assign, ":attrib_for_penalty_id", 0), # hitted on abdomen or thorax
(assign, ":slot_qst_vc_wounds", 33),
(str_store_string, s1, "@You_suffer_a_serious_injury_to_your_body._(-1_strength)"), #strenght
(try_end),
(store_attribute_level, ":attrib_for_penalty", "trp_player", ":attrib_for_penalty_id"),
(gt, ":attrib_for_penalty", 3), # checks if player attributes > 3
(display_message, s1, 16764108), # message
(troop_raise_attribute, "trp_player", ":attrib_for_penalty_id", -1), # penalty applied
(try_begin),
(quest_get_slot, ":qtd_wounds", "qst_vc_wounds", ":slot_qst_vc_wounds"),
(lt, ":qtd_wounds", 0),
(quest_set_slot, "qst_vc_wounds", ":slot_qst_vc_wounds", 5),
(try_end),
(store_add, ":slot_wounds_2", ":slot_qst_vc_wounds", 10),
(quest_get_slot, ":qtd_wounds_2", "qst_vc_wounds", ":slot_wounds_2"),
(val_add, ":qtd_wounds_2", 1), # 1 more wounded to the counter
(quest_set_slot, "qst_vc_wounds", ":slot_wounds_2", ":qtd_wounds_2"),
(mission_cam_set_screen_color, 0X99660000),
(store_mul, ":local_13", ":dmg", 20),
(mission_cam_animate_to_screen_color, 0, ":local_13"),
(try_end),
]