Есть интересный скрипт , наглядно работающий в моде Brytenwalda - BLOOD LOSS .
При серьезном ранении начитает отображаться потеря сил у ГГ , его коня . Противники валятся на поле боя от потерь крови.
Автор кода Amarillo разместил заготовку этих кодов, которая нуждается в более серьезный инструкциях и улучшении .
Вот отсюда http://mbx.streetofeyes.com/index.php/topic,1579.msg31557.html#msg31557
Скрипт : ### constants ###
# Agent slots, make sure these slots are not used for something else
slot_agent_bleed = 8
slot_agent_rate = 9 # rate of blood loss
slot_agent_hp = 12
# Various constants
absolute = 1
true = 1
false = 0
player = 0
# Bleeding
blood_per_hp = 300
dmg_threshold = 3
dmg_low_range = 6
dmg_hi_range = 12
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)
module_mission_templates.py:# blood loss
monitor_health = (
0.05, 0.0, 0.0,
[],
[
(call_script,"script_monitor_health"),
])
bleed = (
1.0, 0.0, 0.0,
[],
[
(call_script,"script_bleed"),
])
# add triggers to all mission templates
for template in mission_templates:
template[-1].append(monitor_health)
template[-1].append(bleed)
Быть может кто то поможет здесь разобраться и довести этот интересный и добавляющий реализма скрипт до вменяемого состояния. Подскажет как правильно его установить,что бы не отображались сообщения о всех войсках ,а только о Герое и коне. .. Короче,что бы скрипт был работоспособен.