Для этого нам понадобятся стандартные файлы:
config/ui/ui_custom_msgs.xml
scripts/bind_stalker.script
Инструкция:
Сложность: Легко
1. Создаём файл ваше_название_скрипта.script в папке gamedata/scripts и пишем в него:
Код
function show_time()
local hud = get_hud()
local cs = hud:GetCustomStatic("hud_show_time")
if cs == nil then
hud:AddCustomStatic("hud_time_static", true)
hud:AddCustomStatic("hud_show_time", true)
cs = hud:GetCustomStatic("hud_show_time")
end
local time_h = level.get_time_hours()
local time_m = level.get_time_minutes()
local msg
if time_m >= 10 then
msg = string.format(" %02d:%02d\n", time_h, time_m)
else
msg = string.format(" %02d:%02d\n", time_h, time_m)
end
if cs ~= nil then cs:wnd():SetText(msg) end
end
2. Далее открываем файл ui_custom_msgs.xml в config/ui/ и пишем туда:
Код
<hud_time_static x="852" y="17" width="156" height="52">
<text complex_mode="0" x="65" y="0" font="letterica16" r="255" g="255" b="255" a="130">Time</text>
<texture>ui_hud_frame_clock</texture>
</hud_time_static>
<hud_show_time x="862" y="38" width="156" height="52">
<text x="0" y="0" font="graffiti19" r="255" g="255" b="255" a="140" align="c"/>
</hud_show_time>
3. Открываем файл bind_stalker.script и пишем после:
Код
function actor_binder:update(delta)
object_binder.update(self, delta)
local time = time_global()
game_stats.update (delta, self.object)
следущее:
ваше_название_скрипта.show_time()[spoiler/]
Эффект критического раненния:
[spoiler]1. Создаем файл effect_blood.script и записываем туда следущее:
Код
Code
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:
после строчек:
Код
Code
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()