DayZ 1.24
Loading...
Searching...
No Matches
DayZAIHitComponents.c
Go to the documentation of this file.
1
3{
4 string m_Name;
5 int m_Weight;
6};
7
9{
30
41 {
43 float rnd = Math.RandomInt(0, weights);
44
45 for (int i = 0; i < pHitComponents.Count(); ++i)
46 {
48 rnd -= hitComp.m_Weight;
49
50 if (rnd <= 0)
51 {
52 pHitComponent = hitComp.m_Name;
53 return true;
54 }
55 }
56
57 return false;
58 }
59
69 {
70 int sum = 0;
71
72 for (int i = 0; i < pHitComponents.Count(); ++i)
73 {
75 sum += hitComp.m_Weight;
76 }
77
78 return sum;
79 }
80};
static int SumOfWeights(array< ref DayZAIHitComponent > pHitComponents)
Calculates the sum of all entries in DayZAIHitComponent array.
static void RegisterHitComponent(array< ref DayZAIHitComponent > pHitComponents, string pName, float pWeight)
Register Hit Component for AI targeting.
static bool SelectMostProbableHitComponent(array< ref DayZAIHitComponent > pHitComponents, out string pHitComponent)
holds hit components and its weights for attack from AI (used on each type - DayZPlayerType,...
int m_Weight
"Head", "Torso", etc.
Definition EnMath.c:7
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].