DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
CommonCold.c
Go to the documentation of this file.
2{
3 const int AGENT_THRESHOLD_ACTIVATE = 200;
5 override void Init()
6 {
8 m_ID = eModifiers.MDF_COMMON_COLD;
11 }
12
13 override string GetDebugText()
14 {
15 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
16 }
17
18 override bool ActivateCondition(PlayerBase player)
19 {
20 if(player.GetSingleAgentCount(eAgents.INFLUENZA) >= AGENT_THRESHOLD_ACTIVATE)
21 {
22 return true;
23 }
24 else
25 {
26 return false;
27 }
28 }
29
30 override protected void OnActivate(PlayerBase player)
31 {
32 //if( player.m_NotifiersManager ) player.m_NotifiersManager.ActivateByType(eNotifiers.NTF_SICK);
33 player.IncreaseDiseaseCount();
34 }
35
36 override protected void OnDeactivate(PlayerBase player)
37 {
38
39 player.DecreaseDiseaseCount();
40 }
41
42
43 override protected bool DeactivateCondition(PlayerBase player)
44 {
45 return (player.GetSingleAgentCount(eAgents.INFLUENZA) <= AGENT_THRESHOLD_DEACTIVATE);
46 }
47
48 override protected void OnTick(PlayerBase player, float deltaT)
49 {
50 float chance_of_sneeze = player.GetSingleAgentCountNormalized(eAgents.INFLUENZA);
51
52 if( Math.RandomFloat01() < chance_of_sneeze / Math.RandomInt(15,20) )
53 {
54 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_SNEEZE);
55 }
56 }
57};
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 CommonCold.c:3
override string GetDebugText()
Definition CommonCold.c:13
override protected void OnDeactivate(PlayerBase player)
Definition CommonCold.c:36
override protected bool DeactivateCondition(PlayerBase player)
Definition CommonCold.c:43
override void Init()
Definition CommonCold.c:5
const int AGENT_THRESHOLD_DEACTIVATE
Definition CommonCold.c:4
override bool ActivateCondition(PlayerBase player)
Definition CommonCold.c:18
override protected void OnActivate(PlayerBase player)
Definition CommonCold.c:30
override protected void OnTick(PlayerBase player, float deltaT)
Definition CommonCold.c:48
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