DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Influenza.c
Go to the documentation of this file.
2{
3 const int AGENT_THRESHOLD_ACTIVATE = 300;
5
6 override void Init()
7 {
9 m_ID = eModifiers.MDF_INFLUENZA;
12 }
13
14 override string GetDebugText()
15 {
16 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
17 }
18
19 override protected bool ActivateCondition(PlayerBase player)
20 {
21 if(player.GetSingleAgentCount(eAgents.INFLUENZA) >= AGENT_THRESHOLD_ACTIVATE)
22 {
23 return true;
24 }
25 return false;
26 }
27
28 override protected void OnActivate(PlayerBase player)
29 {
30 player.IncreaseDiseaseCount();
31 }
32
33 override protected void OnDeactivate(PlayerBase player)
34 {
35 player.DecreaseDiseaseCount();
36 }
37
38 override protected bool DeactivateCondition(PlayerBase player)
39 {
40 return (player.GetSingleAgentCount(eAgents.INFLUENZA) <= AGENT_THRESHOLD_DEACTIVATE);
41 }
42
43 override protected void OnTick(PlayerBase player, float deltaT)
44 {
45 float chance_of_cough = player.GetSingleAgentCountNormalized(eAgents.INFLUENZA);
46
47 if( Math.RandomFloat01() < chance_of_cough / Math.RandomInt(5,20) )
48 {
49 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
50 }
51 }
52};
eAgents
Definition EAgents.c:3
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
const int AGENT_THRESHOLD_ACTIVATE
Definition Influenza.c:3
override string GetDebugText()
Definition Influenza.c:14
override protected void OnDeactivate(PlayerBase player)
Definition Influenza.c:33
override protected bool DeactivateCondition(PlayerBase player)
Definition Influenza.c:38
override void Init()
Definition Influenza.c:6
const int AGENT_THRESHOLD_DEACTIVATE
Definition Influenza.c:4
override protected void OnActivate(PlayerBase player)
Definition Influenza.c:28
override protected bool ActivateCondition(PlayerBase player)
Definition Influenza.c:19
override protected void OnTick(PlayerBase player, float deltaT)
Definition Influenza.c:43
Definition EnMath.c:7
eModifiers
Definition eModifiers.c:2
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106