DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
BrainDisease.c
Go to the documentation of this file.
2{
3 static const int AGENT_THRESHOLD_ACTIVATE = 2000;
4 static const int AGENT_THRESHOLD_DEACTIVATE = 0;
5 const int SHAKE_INTERVAL_MIN = 1;
6 const int SHAKE_INTERVAL_MAX = 4;
7 //const float SHAKE_INTERVAL_DEVIATION = 1;
8
9 float m_Time;
11
12 override void Init()
13 {
15 m_ID = eModifiers.MDF_BRAIN;
18 }
19
20 override string GetDebugText()
21 {
22 return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
23 }
24
25 override protected bool ActivateCondition(PlayerBase player)
26 {
27 if(player.GetSingleAgentCount(eAgents.BRAIN) >= AGENT_THRESHOLD_ACTIVATE)
28 {
29 return true;
30 }
31 else
32 {
33 return false;
34 }
35 }
36
37 override protected void OnActivate(PlayerBase player)
38 {
39 player.IncreaseDiseaseCount();
40 }
41
42 override protected void OnDeactivate(PlayerBase player)
43 {
44 player.DecreaseDiseaseCount();
45 }
46
47 override protected bool DeactivateCondition(PlayerBase player)
48 {
49 if(player.GetSingleAgentCount(eAgents.BRAIN) <= AGENT_THRESHOLD_DEACTIVATE)
50 {
51 return true;
52 }
53 else
54 {
55 return false;
56 }
57 }
58
59 override protected void OnTick(PlayerBase player, float deltaT)
60 {
61 m_Time += deltaT;
62 float brain_agents = player.GetSingleAgentCountNormalized(eAgents.BRAIN) / 8.0;
63 float chance_of_laughter = Math.RandomFloat01();
64
65 if( chance_of_laughter < brain_agents )
66 {
67 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_LAUGHTER);
68 }
69
70 if( m_Time >= m_ShakeTime )
71 {
72 DayZPlayerSyncJunctures.SendKuruRequest(player, brain_agents);
74 }
75
76 }
77};
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
static const int AGENT_THRESHOLD_ACTIVATE
Definition BrainDisease.c:3
const int SHAKE_INTERVAL_MIN
Definition BrainDisease.c:5
override string GetDebugText()
const int SHAKE_INTERVAL_MAX
Definition BrainDisease.c:6
override protected void OnDeactivate(PlayerBase player)
override protected bool DeactivateCondition(PlayerBase player)
override void Init()
static const int AGENT_THRESHOLD_DEACTIVATE
Definition BrainDisease.c:4
override protected void OnActivate(PlayerBase player)
override protected bool ActivateCondition(PlayerBase player)
override protected void OnTick(PlayerBase player, float deltaT)
static void SendKuruRequest(DayZPlayer pPlayer, float amount)
Definition EnMath.c:7
eModifiers
Definition eModifiers.c:2
static proto float RandomFloat(float min, float max)
Returns a random float 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