SoC. Критическое ранение — различия между версиями
Материал из S.T.A.L.K.E.R. Inside Wiki
(DnEtdkwNuuxbceJaF) |
RedPython (обсуждение | вклад) м (Правки 173.15.207.185 (обсуждение) откачены к версии RedPython) |
||
Строка 1: | Строка 1: | ||
− | + | ==Эффект критического ранения ГГ в "Тени Чернобыля"== | |
+ | |||
+ | |||
+ | '''1.''' Создать файл '''effect_blood.script''' и записать следущее: | ||
+ | |||
+ | <lua> | ||
+ | lite_treshold = 0.05 --'насколько должно уменьшиться здоровье с предыдущего обновления, чтобы экран окрасился в красный | ||
+ | crit_treshold = 0.30 --'насколько должно уменьшиться здоровье с предыдущего обновления, чтобы ГГ начало шатать | ||
+ | drop_item_on_crit_prob = 0.20 --'вероятность того, что ГГ выронит оружие | ||
+ | effector_power_coeff = 0.7 | ||
+ | prev_health = -1 | ||
+ | chk_h_t = 0 | ||
+ | |||
+ | function wounded_pp_update() | ||
+ | if (chk_h_t or 0) < time_global() then | ||
+ | chk_h_t = time_global()+1000 | ||
+ | if prev_health > (db.actor.health + lite_treshold) then | ||
+ | level.add_pp_effector("fire_hit.ppe", 2011, false) | ||
+ | local effector_power = (prev_health - db.actor.health)*100*effector_power_coeff | ||
+ | level.set_pp_effector_factor(2011, effector_power) | ||
+ | if prev_health > db.actor.health + crit_treshold then | ||
+ | level.add_cam_effector("camera_effects\\fusker.anm", 999, false, "") | ||
+ | local snd_obj = xr_sound.get_safe_sound_object([[actor\pain_3]]) | ||
+ | snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 1.0) | ||
+ | if math.random() < drop_item_on_crit_prob then | ||
+ | local active_item = db.actor:active_item() | ||
+ | if active_item and active_item:section() ~= "bolt" and active_item:section()~= "wpn_knife" then | ||
+ | db.actor:drop_item(active_item) | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | prev_health = db.actor.health | ||
+ | end | ||
+ | end | ||
+ | </lua> | ||
+ | |||
+ | '''2.''' Далее открываем '''bind_stalker.script''' и в функцию | ||
+ | <lua> | ||
+ | function actor_binder:update(delta) | ||
+ | object_binder.update(self, delta) | ||
+ | local time = time_global() | ||
+ | game_stats.update (delta, self.object) | ||
+ | </lua> | ||
+ | добавляем строку | ||
+ | <lua> | ||
+ | effect_blood.wounded_pp_update() | ||
+ | </lua> | ||
+ | |||
+ | |||
+ | [[Категория:Скрипты]] |
Версия 11:26, 8 марта 2011
Эффект критического ранения ГГ в "Тени Чернобыля"
1. Создать файл effect_blood.script и записать следущее:
lite_treshold = 0.05 --'насколько должно уменьшиться здоровье с предыдущего обновления, чтобы экран окрасился в красный crit_treshold = 0.30 --'насколько должно уменьшиться здоровье с предыдущего обновления, чтобы ГГ начало шатать drop_item_on_crit_prob = 0.20 --'вероятность того, что ГГ выронит оружие effector_power_coeff = 0.7 prev_health = -1 chk_h_t = 0 function wounded_pp_update() if (chk_h_t or 0) < time_global() then chk_h_t = time_global()+1000 if prev_health > (db.actor.health + lite_treshold) then level.add_pp_effector("fire_hit.ppe", 2011, false) local effector_power = (prev_health - db.actor.health)*100*effector_power_coeff level.set_pp_effector_factor(2011, effector_power) if prev_health > db.actor.health + crit_treshold then level.add_cam_effector("camera_effects\\fusker.anm", 999, false, "") local snd_obj = xr_sound.get_safe_sound_object([[actor\pain_3]]) snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 1.0) if math.random() < drop_item_on_crit_prob then local active_item = db.actor:active_item() if active_item and active_item:section() ~= "bolt" and active_item:section()~= "wpn_knife" then db.actor:drop_item(active_item) end end end end prev_health = db.actor.health end end
2. Далее открываем bind_stalker.script и в функцию
function actor_binder:update(delta) object_binder.update(self, delta) local time = time_global() game_stats.update (delta, self.object)
добавляем строку
effect_blood.wounded_pp_update()