DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
BulletHitReaction.c
Go to the documentation of this file.
2{
3 const float ALPHA_MIN = 0;
4 const float ALPHA_MAX = 1;
8 PPERequester_HealthHitReaction m_Requester;
9
11 {
12 m_HitDuration = 0.10;
13 m_BreakPoint = 0.05;
14 Class.CastTo(m_Requester, PPERequesterBank.GetRequester(PPERequester_HealthHitReaction));
15 //Print("=====================================================");
16 //Print("=====================================================");
17 }
18
20 {
21 PPERequesterBank.GetRequester(PPERequester_HealthHitReaction).Stop();
22 }
23
24 void Update(float deltatime)
25 {
26 float value;
27
29 {
31 }
32 else
33 {
35 value = 1 - tmp_value;
36 }
37 m_TimeActive += deltatime;
38 value = Math.Clamp(value,0,1);
39 float val = Math.Lerp(ALPHA_MIN, ALPHA_MAX, value);
40 //Print(val);
41 m_Requester.SetHitIntensity(val);
42
44 {
45 delete this;
46 }
47 }
48
49}
50
51class EffectRadial
52{
53
55 float m_Divisor = 16;
56 float m_Duration = 0.6;
57 PPERequester_PainBlur m_PPERequester;
58
59 void EffectRadial(Param param1, Param param2)
60 {
61 if (param1)
62 {
64 if (p1)
65 {
66 m_Divisor = p1.param1;
67 m_Duration = p1.param2;
68 }
69 }
70
71 if ( Class.CastTo( m_PPERequester, PPERequesterBank.GetRequester( PPERequesterBank.REQ_PAINBLUR ) ) )
72 m_PPERequester.Start();
73 }
74
76 {
78 m_PPERequester.SetRadialBlur(0,0,0,0);
79 }
80
81 void Update(float deltatime)
82 {
83
84 float time = Math.InverseLerp(0, m_Duration, m_TimeActive);
85 float value = 1 - Easing.EaseInQuart(time);
86 float strenght = value / m_Divisor; //The divisor matches the ease curve used
87
89 m_PPERequester.SetRadialBlur(strenght, strenght, 1 - value, 1 - value);
90
91
92
93 m_TimeActive += deltatime;
95 {
96 delete this;
97 }
98 }
99}
void ~EffectRadial()
void EffectRadial(Param param1, Param param2)
float m_Divisor
PPERequester_PainBlur m_PPERequester
float m_Duration
class DamageDealtEffect m_TimeActive
Super root of all classes in Enforce script.
Definition EnScript.c:11
void Update(float deltatime)
PPERequester_HealthHitReaction m_Requester
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition Easing.c:3
static float EaseInQuart(float t)
Definition Easing.c:56
Definition EnMath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
proto native volatile void Update()