--Description: Fades out corpses by smallg --Description: [StartFadeAfter#=5] --Description: [FadeTime#=5] in seconds g_fade_corpses = {} function fade_corpses_properties(e, startfadeafter, fadetime) local fc = g_fade_corpses[e] fc.startfadeafter = startfadeafter fc.fadetime = fadetime end function fade_corpses_init(e) g_fade_corpses[e] = {} end function fade_corpses_main(e) local fc = g_fade_corpses[e] local ft = GetElapsedTime() for a,b in pairs (g_Entity) do if GetEntityAllegiance(a) >= 0 then if b.health > 0 then elseif b.startfading == nil then b.startfading = fc.startfadeafter elseif b.startfading > 0 then b.startfading = b.startfading - ft elseif b.corpsetimer == nil then b.corpsetimer = fc.fadetime SetEntityTransparency(a,1) b.alpha = GetEntityBaseAlpha(a) or 1 elseif b.corpsetimer > 0 then b.corpsetimer = b.corpsetimer - ft local perc = b.corpsetimer / fc.fadetime perc = math.max(0,perc) SetEntityBaseAlpha(a, perc * b.alpha) else if b.isdestroyed == nil then Hide(a) Destroy(a) b.isdestroyed = true end end end end end