Дедушка Тапок 61 Опубликовано 16 Августа 2015 (изменено) Помогите! Не работает в скрипте функция запотевания динамического худа. Если не трудно, объясните на пальцах что да как! ----------------------------------------------------------------------------------Dinamic HUD from ABC Inferno and AMK--by Rulix aka Bak---------------------------------------------------------------------------------- чтобы отключить эффект, поставьте вместо единицы ноль:local suithud_enable = 1 -- худ шлемаlocal blurs_enable = 0 -- эффект запотевани¤ - не работаетlocal blood_enable = 1 -- эффект ранени¤local bleed_enable = 1 -- эффект плохого самочувстви¤local hit_enable = 1 -- эффект попадани¤ по игроку--------------------------------------------------------------------------------local helmets = {helm_respirator = {hud = "hud_gas",breakable = true},helm_hardhat = {hud = "hud_mil",breakable = true},helm_protective = {hud = "hud_sci",breakable = true},helm_tactic = {hud = "hud_kill",breakable = true},helm_battle = {hud = "hud_kill",breakable = true},scientific_outfit = {hud = "hud_sci",breakable = true},exo_outfit = {hud = "hud_exo",breakable = true}}local no_drop_items = {bolt = true,wpn_knife = true}local seldom_upd_time,often_upd_timefunction update()if db.actor thenlocal tg = time_global()if tg > (seldom_upd_time or 100) thenseldom_upd_time = tg+300helmet_hud()bleedcondition()endif tg > (often_upd_time or 30) thenoften_upd_time = tg+50init_blurs()blood()set_blood()hit_effect()endendendlocal prev_health = 0function hit_effect()if hit_enable == 0 thenreturnendif prev_health > db.actor.health+0.05 thenlevel.add_pp_effector("amk_shoot.ppe",2011,false)level.set_pp_effector_factor(2011,(prev_health-db.actor.health)*100)if prev_health > db.actor.health+0.2 thenlocal cameffs,soundsif prev_health > db.actor.health+0.5 thencameffs = {"head_shot","fusker"}sounds = {"pain_4","pain_1","hit_5","hit_6"}elsecameffs ={"shell_shock","hit_front","hit_right","hit_back","hit_left","hit_front_left","hit_back_left","hit_front_right","hit_back_right"}sounds = {"pain_2","pain_3","pain_5","pain_6","pain_7","pain_8"}endlevel.add_cam_effector("camera_effects\\"..cameffs[math.random(#cameffs)]..".anm",999,false,"")local snd_obj = sound_object("actor\\"..sounds[math.random(#sounds)])snd_obj:play(db.actor,0,sound_object.s2d)if math.random() < (prev_health-db.actor.health)/2.5 thenlocal active_item = db.actor:active_item()if active_item and not no_drop_items[active_item:section()] thendb.actor:drop_item(active_item)endendendendprev_health = db.actor.healthendlocal current_suithudlocal helmet_conditionlocal pre_hud_type = ""function helmet_hud()if suithud_enable == 0 thenreturnendlocal hud_typelocal helmet = db.actor:alive() and (db.actor:item_in_slot(12) or db.actor:get_current_outfit())if helmet thenlocal sect = helmet:section()if helmets[sect] thenhelmet_condition = "blue"if helmets[sect].breakable == true thenlocal cond = helmet:condition()if cond > 0.87 then helmet_condition = "blue"elseif cond > 0.69 then helmet_condition = "green"elseif cond > 0.60 then helmet_condition = "yellow"elseif cond > 0.40 then helmet_condition = "red"elseif cond > 0.25 then helmet_condition = "red2"else helmet_condition = "red3" endendhud_type = helmets[sect].hud.."_"..helmet_conditionpre_hud_type = helmets[sect].hudendendsetmysuithud(hud_type)endlocal suitfirstrun = truefunction setmysuithud(hudtype)local hud = get_hud()if not hudtype thenlocal wchud = hud:GetCustomStatic(current_suithud)if wchud thenhud:RemoveCustomStatic(current_suithud)endcurrent_suithud = nilsuitfirstrun = trueelseif hudtype ~= current_suithud thenif current_suithud thenhud:RemoveCustomStatic(current_suithud)endhud:AddCustomStatic(hudtype)if string.find(hudtype,pre_hud_type) thenif suitfirstrun == false and helmet_condition ~= "green" and helmet_condition ~= "blue" thenlocal snd_obj = sound_object("material\\glass\\glass_fall03hl")snd_obj:play(db.actor,0,sound_object.s2d)endif suitfirstrun == true thensuitfirstrun = falseendendcurrent_suithud = hudtypeendendlocal actor_last_health = 0local bloodtime = 0local bloodtimeb = 0local isbleeding = "no"local countblood = 0function blood()if blood_enable == 0 then return endlocal radwidth = db.actor.radiationif radwidth == 0 thenif db.actor:alive() thenlocal current_health = math.floor(db.actor.health*100)local cbloodtime = time_global()if cbloodtime > bloodtime and isbleeding == "stopit" thenfor i=1,4 doif get_hud():GetCustomStatic("hud_blood"..i) thenget_hud():RemoveCustomStatic("hud_blood"..i)isbleeding = "no"endendendif cbloodtime > bloodtime thenbloodtime = time_global() + 1500if actor_last_health > current_health and actor_last_health ~= 0 thenisbleeding = "yes"endactor_last_health = math.floor(db.actor.health * 100)endendendendlocal m_blood = nilfunction set_blood()if blood_enable == 0 then return endlocal radwidth = db.actor.radiationlocal cbloodtimed = time_global()if cbloodtimed > bloodtimeb and isbleeding == "yes" and radwidth == 0 thenbloodtimeb = time_global() + 170m_blood = {}countblood = countblood + 1get_hud():AddCustomStatic("hud_blood"..countblood)m_blood[countblood] = get_hud():GetCustomStatic("hud_blood"..countblood):wnd()local chudblood = "hud_blood"..countbloodif countblood == 4 thenisbleeding = "stopit"countblood = 0endendendlocal isactcondset = falselocal radeffect = falsefunction bleedcondition()if bleed_enable == 0 then return endif db.actor.health < 0.31 and isactcondset ~= true thenlevel.add_pp_effector("alcohol.ppe",2012,true)isactcondset = trueendif db.actor.health > 0.30 and isactcondset ~= false thenlevel.remove_pp_effector(2012)isactcondset = falseendif db.actor.radiation > 0.3 and radeffect ~= true thenlevel.add_pp_effector("alcohol.ppe", 2013,true)radeffect = trueendif db.actor.radiation == 0 and radeffect ~= false thenlevel.remove_pp_effector(2013)radeffect = falseendendfunction init_blurs()if blurs_enable == 0 then return endif current_suithud and not string.find(current_suithud,"_red3") thenlocal zoom=67.5/device().fovzoom = (zoom-1)*1.5+1if zoom < 1.001 thenzoom = 1.001endlocal stretchy = 0.75/(math.floor(device().aspect_ratio*1000)/1000)if stretchy < 1 thenstretchy = 1endlocal rect = {x = -768*zoom+768,y = (-512*zoom+512)*stretchy-(stretchy-1)*300,w = 1024*zoom,h = 768*zoom*stretchy}set_blurs(true,rect)elseset_blurs(false)endendlocal blurslocal blurval = 0 -- уровень запотевани¤ от 0 до 1local blurlt = 0 -- врем¤ последнего обновлени¤local blurcyctime = 0 -- врем¤ начала последнего цикла дыхани¤ (выдох)local blurlastphase = 0function set_blurs(enabled,rect)local hud = get_hud()if not enabled thenfor i=1,4 dolocal bh = hud:GetCustomStatic("hud_blur"..i)if bh thenhud:RemoveCustomStatic("hud_blur"..i)endendreturnendif not (blurs and hud:GetCustomStatic("hud_blur1")) thenblurs = {}for i=1,4 dohud:AddCustomStatic("hud_blur"..i)blurs = hud:GetCustomStatic("hud_blur"..i):wnd()-- blurs:SetWidth(0)endend-- ÷иклы в зависимости от силы дыхани¤: 0->1->0 0->1->2->4->5->0 0->1->2->3->4->5->0 5->4->3->4->5 4->3->4local power = db.actor.powerlocal period = 1.0+power*power*1.0 -- текуща¤ частота дыхани¤ от 30 до 120 циклов в минутуlocal expirt = 0.3local breathpower = 3local delta = (time_global()-blurlt)/1000 -- дельта в секундахlocal phase = (time_global()-blurcyctime)/1000 -- фаза дыхательного цикла в сек.blurlt = time_global()if phase > period thenphase = phase%periodblurcyctime = blurlt-phase*1000endif blurlastphase > phase thenblurlastphase = 0endlocal blurdelta = delta*-0.7 -- работа вентилл¤цииif blurlastphase < expirt and phase < expirt thenblurdelta = blurdelta+(phase-blurlastphase)*breathpowerelseif blurlastphase < expirt thenblurdelta = blurdelta+(expirt-blurlastphase)*breathpowerendblurlastphase = phaseblurval = blurval+blurdeltaif blurval > 0.999 thenblurval = 0.999elseif blurval < 0 thenblurval = 0endlocal tm = math.floor(blurval*3)local tmn = (tm+1)local v = blurval*3-math.floor(blurval*3)v = 1-vlocal v1 = 1-vif tm ~= 0 thenblurs[tm]:SetColor(GetARGB(v*255,255,255,255))endif tmn ~= 0 thenblurs[tmn]:SetColor(GetARGB(v1*255,255,255,255))endfor i=1,4 doif i == tm or i == tmn thenblurs:SetWndRect(Frect():set(rect.x,rect.y,rect.w,rect.h))elseblurs:SetWndRect(Frect():set(rect.x,rect.y,0,0))endendend Изменено 16 Августа 2015 пользователем Дедушка Тапок Поделиться этим сообщением Ссылка на сообщение