Перейти к контенту

10koneek

Рекомендуемые сообщения

(изменено)

Слушайте люди, недавно нашёл на stalker inside функцию о показе критич. уровня здоровья, она мне понравилась, но решил немного изменить))

нормальный скрипт

if self.object.health <= 0.3 then
local hud = get_hud()
local custom_static = hud:GetCustomStatic("cs_health_danger")
if custom_static == nil then
hud:AddCustomStatic("cs_health_danger", true)
hud:GetCustomStatic("cs_health_danger"):wnd():SetTextST("Уровень здоровья очень мал. Немедленно примите аптечку!")
end
else
local hud = get_hud()
local custom_static = hud:GetCustomStatic("cs_health_danger")
if custom_static ~= nil then
hud:RemoveCustomStatic("cs_health_danger")
end
end

и мой переделанный

if self.object.health <= 0.3 then
local hud = get_hud()
local custom_static = hud:GetCustomStatic("cs_health_danger")
if custom_static == nil then
news_manager.send_tip(db.actor, "%c[255,255,128,128]Уровень здоровья:\n%c[default]Хреново. Прими аптечку!", nil, nil, 10000)
end
else
local hud = get_hud()
local custom_static = hud:GetCustomStatic("cs_health_danger")
if custom_static ~= nil then
hud:RemoveCustomStatic("cs_health_danger")
end
end

Если кто не понял, то я заменил тип сообщения с того что выводилось при большом уровне радиации, на вот этот тип сообщения
он работает, и при уровне здоровья менее 1\3 начинает выводиться сообщения))

в ошибке разобрался с помощью Паши XMK, В начале нужно дополнительно ввести переменную и прировнять к числовому значению, лучше к нулю!

должно получиться так))
файл bind_stalker.script
begin
my_timer = 0
...
if my_timer <= time_global() then '-сама функция))
        my_timer = time_global()+10000 '-дйствует каждые 10 секунд
if self.object.health <= 0.5 then
local hud = get_hud()
local custom_static = hud:GetCustomStatic("cs_health_danger")
if custom_static == nil then
news_manager.send_tip(db.actor, "%c[255,255,128,128]Уровень здоровья:\n%c[default]Мало хп. Прими аптечку!", nil, nil, 3000)
'- длительность сообщения 3 секунды
end
end
else
local hud = get_hud()
local custom_static = hud:GetCustomStatic("cs_health_danger")
if custom_static ~= nil then
hud:RemoveCustomStatic("cs_health_danger")
end
end

'-и всё заново, по аналогии и с радиацией!))

if my_timer <= time_global() then '-сама функция))
        my_timer = time_global()+10000 '-дйствует каждые 10 секунд
if self.object.radiation >= 0.7 then
    local hud = get_hud()
    local custom_static = hud:GetCustomStatic("cs_radiation_danger")
    if custom_static == nil then
      news_manager.send_tip(db.actor, "%c[255,255,128,128]Уровень радиации:\n%c[default]Большое облучение. Прими антирад!", nil, nil, 3000)
'- длительность сообщения 3 секунды
    end
  else
    local hud = get_hud()
    local custom_static = hud:GetCustomStatic("cs_radiation_danger")
    if custom_static ~= nil then
      hud:RemoveCustomStatic("cs_radiation_danger")
    end
  end

всем спасибо, пишите если пригодилось!

 

Изменено пользователем amik
  • Полезно 2

Поделиться этим сообщением


Ссылка на сообщение
  • Недавно просматривали   0 пользователей

    Ни один зарегистрированный пользователь не просматривает эту страницу.

AMK-Team.ru

×
×
  • Создать...