Knock rider off horse

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

Contents

[edit] Description

Allows the rider to be knocked off the horse if damage dealt is over a specific value.

[edit] Knowledge/Tools Required

[edit] Script

[edit] Addition to Module_mission_templates

Place the below trigger in the required mission_templates,

(ti_on_agent_hit, 0, 0, [],[ 
#### Knocked off horses script, base by Gaunt, editted by Davee
 
      (ge, ":orig_damage", 15), ### Minimum damage needed
      (store_agent_hit_points,":hp",":victim_agent"),
      (val_sub, ":hp", ":orig_damage"),
      (ge, ":hp", 1), ### So it dosn't run when it's not needed (agent dies anyway)
 
      (agent_is_human,":victim_agent"),
 
      (store_random_in_range,":chance",0,60), ### Decrease this number (60) for higher chances of knocking riders off (and vice-versa).
      (ge,":chance", ":orig_damage"), ### If damage dealt is over or equal to the ":chance" number, knock-off occurs.
 
      (agent_get_horse,":horse",":victim_agent"),
      (neq,":horse",-1),
      (agent_get_item_id,":horsetype", ":horse"),
      (neq,":horsetype",-1),
      (agent_get_position,pos1,":horse"),
      #(agent_get_speed, pos2, ":horse"),
      (store_agent_hit_points,":horsehp",":horse"),
      (entry_point_get_position, pos3, 0),
      (agent_set_position,":horse",pos3),
      (remove_agent, ":horse"),
 
      (set_spawn_position, pos1),
      (spawn_horse,":horsetype",0),
      (agent_start_running_away, reg0),
      #(agent_set_horse_speed_factor, reg0, 100), #I don't think this works but it isn't necessary. <- Only changes max speed of the horse
      (agent_set_hit_points,reg0,":horsehp"),
]),

[edit] Credits

First written by: Gaunt;
Improved by: Davee.

Forum topic:
Original - http://forums.taleworlds.com/index.php/topic,1324.msg3937979.html#msg3937979
Improved - http://forums.taleworlds.com/index.php/topic,1324.msg3948286.html#msg3948286

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox