Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
achievementsxbox.c
Go to the documentation of this file.
9
15
22
29
35
50
52{
53 private void Achievements();
54 private void ~Achievements();
55
57 static proto EAchievementError SendEventKill(EAchievementTargetId target_id, EAchievementRankId rank_id, EAchievementRangeId range_id, EAchievementHitId hit_id, float distance);
58
59 //===================================
60 // OnActionEat
61 //===================================
62 static void OnActionEat()
63 {
65 }
66
67 //===================================
68 // OnActionDrink
69 //===================================
70 static void OnActionDrink()
71 {
73 }
74
75 //===================================
76 // OnEquipdFullGear
77 //===================================
78 static void OnEquippedFullGear()
79 {
80 CheckError( SendEventAction( EAchievementActionId.ACTION_EQUIP_GEAR ) );
81 }
82
83 //===================================
84 // OnCookedSteak
85 //===================================
86 static void OnCookedSteak()
87 {
88 CheckError( SendEventAction( EAchievementActionId.ACTION_COOK_STEAK ) );
89 }
90
91 //===================================
92 // OnActionIgniteMatchbox
93 //===================================
95 {
96 CheckError( SendEventAction( EAchievementActionId.ACTION_IGNITE_FIRE_MATCHBOX ) );
97 }
98
99 //===================================
100 // OnActionIgniteRoadflare
101 //===================================
103 {
104 CheckError( SendEventAction( EAchievementActionId.ACTION_IGNITE_FIRE_ROAD_FLARE ) );
105 }
106
107 //===================================
108 // OnActionIgniteDrill
109 //===================================
111 {
112 CheckError( SendEventAction( EAchievementActionId.ACTION_IGNITE_FIRE_HAND_DRILL ) );
113 }
114
115 //===================================
116 // OnActionShave
117 //===================================
118 static void OnActionShave()
119 {
121 }
122
123 //===================================
124 // OnActionGutDeer
125 //===================================
126 static void OnActionGutDeer()
127 {
128 CheckError( SendEventAction( EAchievementActionId.ACTION_GUT_DEER ) );
129 }
130
131 //===================================
132 // OnActionMedsSurvivor
133 //===================================
135 {
136 CheckError( SendEventAction( EAchievementActionId.ACTION_APPLY_MEDS_ON_SURVIVOR ) );
137 }
138
139 //===================================
140 // OnActionHandcuff
141 //===================================
142 static void OnActionHandcuff()
143 {
144 CheckError( SendEventAction( EAchievementActionId.ACTION_HANDCUFF_SURVIVOR ) );
145 }
146
147 //===================================
148 // OnPlayerKilled
149 //===================================
150 static void OnPlayerKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
151 {
152 EAchievementTargetId target_id = EAchievementTargetId.TARGET_SURVIVOR;
153 EAchievementRankId target_rank_id = EAchievementRankId.RANK_SURVIVOR;
154 EAchievementRangeId range_id = EAchievementRangeId.RANGE_OTHER;
155 EAchievementHitId hit_id = EAchievementHitId.HIT_OTHER;
156 float distance = 0;
157
158 if ( victim.IsZombie() )
159 {
160 target_id = EAchievementTargetId.TARGET_INFECTED;
161 target_rank_id = EAchievementRankId.RANK_INFECTED;
162
163 if ( victim.IsZombieMilitary() )
164 {
165 target_rank_id = EAchievementRankId.RANK_INFECTED_SOLDIER;
166 }
167 }
168
169 if ( source )
170 {
171 if ( source.IsMeleeWeapon() )
172 {
173 range_id = EAchievementRangeId.RANGE_MELEE;
174 }
175 else if ( source.IsWeapon() && killer )
176 {
177 range_id = EAchievementRangeId.RANGE_RANGED;
178 distance = vector.Distance( killer.GetPosition(), victim.GetPosition() );
179
180 if ( is_headshot )
181 {
182 hit_id = EAchievementHitId.HIT_HEADSHOT;
183 }
184 }
185 }
186
187 CheckError( SendEventKill(target_id, target_rank_id, range_id, hit_id, distance) );
188 }
189
190 //-----------------------------------
191 // CheckError
192 //-----------------------------------
193 private static void CheckError(EAchievementError error)
194 {
195 if ( error != EAchievementError.ERR_OK )
196 {
197 Print("Achievements: Cannot send achievement event. Error ID: " + error);
198 }
199 }
200};
201
EAchievementError
@ ERR_NOT_FOUND
@ ERR_NOT_IMPLEMENTED
@ ERR_UNKNOWN
@ ERR_BAD_DATA
@ ERR_OK
EAchievementRangeId
@ RANGE_MELEE
@ RANGE_RANGED
@ RANGE_OTHER
EAchievementActionId
@ ACTION_EAT
@ ACTION_IGNITE_FIRE_HAND_DRILL
@ ACTION_IGNITE_FIRE_MATCHBOX
@ ACTION_GUT_DEER
@ ACTION_DRINK
@ ACTION_SHAVE
@ ACTION_HANDCUFF_SURVIVOR
@ ACTION_COOK_STEAK
@ ACTION_EQUIP_GEAR
@ ACTION_IGNITE_FIRE_ROAD_FLARE
@ ACTION_APPLY_MEDS_ON_SURVIVOR
EAchievementHitId
@ HIT_OTHER
@ HIT_HEADSHOT
EAchievementTargetId
@ TARGET_INFECTED
@ TARGET_SURVIVOR
Achievements AchievementsXbox
EAchievementRankId
@ RANK_SURVIVOR
must be TARGET_SURVIVOR
@ RANK_INFECTED
must be TARGET_INFECTED
@ RANK_INFECTED_SOLDIER
must be TARGET_INFECTED
void ~Achievements()
static void OnEquippedFullGear()
static void OnActionHandcuff()
static proto EAchievementError SendEventKill(EAchievementTargetId target_id, EAchievementRankId rank_id, EAchievementRangeId range_id, EAchievementHitId hit_id, float distance)
void Achievements()
static void OnPlayerKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
static void CheckError(EAchievementError error)
static void OnActionIgniteDrill()
static void OnActionMedsSurvivor()
static void OnActionGutDeer()
static void OnActionIgniteMatchbox()
static proto EAchievementError SendEventAction(EAchievementActionId action_id)
static void OnActionDrink()
static void OnActionShave()
static void OnActionEat()
static void OnActionIgniteRoadflare()
static void OnCookedSteak()
override bool IsMeleeWeapon()
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto void Print(void var)
Prints content of variable to console/log.