bloodScripts = [
("monitor_health",
[
(try_for_agents,":agent_id"),
(agent_is_alive,":agent_id"),
(store_agent_hit_points,":current_hp",":agent_id",absolute),
(agent_get_slot,":old_hp",":agent_id",slot_agent_hp),
(try_begin),
(gt,":old_hp",":current_hp"), # Damage taken
(agent_set_slot,":agent_id",slot_agent_hp,":current_hp"),
(store_sub,":new_rate",":old_hp",":current_hp"),
(gt,":new_rate",dmg_threshold),
#debug start
(str_store_agent_name,s1,":agent_id"),
(assign,reg1,":new_rate"),
(try_begin),
(agent_is_human,":agent_id"),
(display_message,"@{s1} recived {reg1} damage"),
(else_try),
(display_message,"@{s1}s horse recived {reg1} damage"),
(try_end),
#debug end
(val_sub,":new_rate",dmg_threshold),
(store_random_in_range,":mul",dmg_low_range,dmg_hi_range),
(val_mul,":new_rate",":mul"),
(val_div,":new_rate",10),
#debug start
(assign,reg1,":new_rate"),
(display_message,"@damage reduced to {reg1}"),
#debug end
(agent_get_slot,":old_rate",":agent_id",slot_agent_rate),
(val_add,":new_rate",":old_rate"),
(agent_set_slot,":agent_id",slot_agent_rate,":new_rate"),
(else_try),
(eq,":old_hp",0), # Init agent
(agent_set_slot,":agent_id",slot_agent_hp,":current_hp"),
(try_end),
(try_end),
]),
("bleed",
[
(try_for_agents,":agent_id"),
(agent_is_alive,":agent_id"),
(agent_get_slot,":rate",":agent_id",slot_agent_rate),
(gt,":rate",0),
(agent_get_slot,":blood",":agent_id",slot_agent_bleed),
(val_add,":blood",":rate"),
(store_div,":hp_loss",":blood",blood_per_hp),
(try_begin),
(gt,":hp_loss",0), # the agent has lost enough blood to lose hitpoints
(store_agent_hit_points,":hp",":agent_id",absolute),
(val_sub,":hp",":hp_loss"),
#debug start
(str_store_agent_name,s1,":agent_id"),
(assign,reg1,":rate"),
(assign,reg2,":hp"),
(try_begin),
(agent_is_human,":agent_id"),
(display_message,"@{s1} is bleeding: rate = {reg1}, HP = {reg2}"),
(else_try),
(display_message,"@{s1}s horse is bleeding: rate = {reg1}, HP = {reg2}"),
(try_end),
#debug end
(try_begin),
(gt,":hp",0),
(agent_set_hit_points,":agent_id",":hp",absolute),
(agent_set_slot,":agent_id",slot_agent_hp,":hp"),
(store_mul,":tmp",":hp_loss",blood_per_hp),
(val_sub,":blood",":tmp"),
(agent_set_slot,":agent_id",slot_agent_bleed,":blood"),
(else_try),
(call_script,"script_get_enemy_agent",":agent_id"),
(agent_deliver_damage_to_agent,reg0,":agent_id"),
(try_end),
(else_try),
(agent_set_slot,":agent_id",slot_agent_bleed,":blood"),
(try_end),
(try_end),
]),
("get_enemy_agent",
[
(store_script_param,":target_agent_id",1),
(try_begin),
(agent_is_ally,":target_agent_id"),
(agent_is_human,":target_agent_id"), # a horse agent can not cause damage
(assign,reg0,":target_agent_id"),
(else_try),
(get_player_agent_no,reg0),
(try_end),
]),
]
scripts.extend(bloodScripts)
Сам код я не менял, подправил лишь питоновские функции. Если проблема заключалась в том, что он скрипт вообще не работал, то может поможет. Сам не тестировал, если кто-то протестит, то, пожалуйста, отпишитесь здесь.