DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
DayZInfected.c
Go to the documentation of this file.
2{
11
18};
19
21{
27
28enum DayZInfectedDeathAnims
29{
33 ANIM_DEATH_NECKSTAB = 3
34}
35
37{
38 proto native void SetStanceVariation(int pStanceVariation);
39 proto native void SetIdleState(int pIdleState);
40 proto native void StartTurn(float pDirection, int pSpeedType);
41 proto native bool IsTurning();
42}
43
44class DayZInfectedCommandDeath extends AnimCommandBase
45{
46
47}
48
49class DayZInfectedCommandHit extends AnimCommandBase
50{
51
52}
53
54class DayZInfectedCommandAttack extends AnimCommandBase
55{
56 proto native bool WasHit();
57}
58class DayZInfectedCommandVault extends AnimCommandBase
59{
60 proto native bool WasLand();
61}
62
63class DayZInfectedCommandCrawl extends AnimCommandBase
64{
65
66}
67
75class DayZInfectedCommandScript extends AnimCommandBase
76{
78 void DayZInfectedCommandScript(DayZInfected pInfected) {}
79 void ~DayZInfectedCommandScript() {}
80
81 //---------------------------------------------------------------
82 // usable everywhere
83
85 proto native void SetFlagFinished(bool pFinished);
86
87 //---------------------------------------------------------------
88 // PrePhys Update
89
91 proto native bool PrePhys_GetTranslation(out vector pOutTransl); // vec3 in local space !
92 proto native bool PrePhys_GetRotation(out float pOutRot[4]); // quaternion in local space !
93 proto native void PrePhys_SetTranslation(vector pInTransl); // vec3 in local space !
94 proto native void PrePhys_SetRotation(float pInRot[4]); // quaternion in local space !
95
96 //---------------------------------------------------------------
97 // PostPhys Update
98
102 bool PostPhysUpdate(float pDt);
103
105 proto native void PostPhys_GetPosition(out vector pOutTransl);
106 proto native void PostPhys_GetRotation(out float pOutRot[4]);
107 proto native void PostPhys_SetPosition(vector pInTransl);
108 proto native void PostPhys_SetRotation(float pInRot[4]);
109 proto native void PostPhys_LockRotation();
110}
111
112
113class DayZInfected extends DayZCreatureAI
114{
115 proto native DayZInfectedType GetDayZInfectedType();
118 proto native DayZInfectedCommandVault StartCommand_Vault(int pType);
119 proto native void StartCommand_Death(int pType, float pDirection);
120 proto native void StartCommand_Hit(bool pHeavy, int pType, float pDirection);
121 proto native DayZInfectedCommandAttack StartCommand_Attack(EntityAI pTarget, int pType, float pSubtype);
122 proto native void StartCommand_Crawl(int pType);
123
124 proto native bool CanAttackToPosition(vector pTargetPosition);
125
127 proto native DayZInfectedCommandVault GetCommand_Vault();
128 proto native DayZInfectedCommandAttack GetCommand_Attack();
129
131 proto native DayZInfectedCommandScript StartCommand_Script(DayZInfectedCommandScript pInfectedCommand);
132 proto native DayZInfectedCommandScript StartCommand_ScriptInst(typename pCallbackClass);
133 proto native DayZInfectedCommandScript GetCommand_Script();
134
136 proto native void GetTransformWS(out vector pTm[4]);
137
138 const float LEG_CRIPPLE_THRESHOLD = 74.0;
139 bool m_HeavyHitOverride;
140 //-------------------------------------------------------------
141 void DayZInfected()
142 {
143 }
144
145 //-------------------------------------------------------------
146 void ~DayZInfected()
147 {
148 }
149
150 //-------------------------------------------------------------
151
152 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
153 {
154 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
155
156 /*Print("damageResult: " + damageResult.GetDamage(dmgZone,"Health"));
157 Print("dmgZone: " + dmgZone);
158 Print("component: " + component);
159 Print("----------------");*/
160
161 if ( ammo.ToType().IsInherited(Nonlethal_Base) )
162 {
163 //Print("DayZInfected | EEHitBy | nonlethal hit");
164 float dam = damageResult.GetDamage(dmgZone,"Shock");
165 //Print("shock damage: " + damageResult.GetDamage(dmgZone,"Shock"));
166 //Print("GetHealth - before: " + GetHealth());
167 HandleSpecialZoneDamage(dmgZone,dam);
168 AddHealth("","Health",-ConvertNonlethalDamage(dam));
169 //Print("GetHealth - after: " + GetHealth());
170 }
171
172 if ( !IsAlive() )
173 {
174 if ( !m_DeathSyncSent ) //to be sent only once on hit/death
175 {
176 Man killer = source.GetHierarchyRootPlayer();
177
178 if ( !m_KillerData ) //only one player is considered killer in the event of crossfire
179 {
180 m_KillerData = new KillerData;
181 m_KillerData.m_Killer = killer;
182 m_KillerData.m_MurderWeapon = source;
183 }
184
185 if ( killer && killer.IsPlayer() )
186 {
187 // was infected killed by headshot?
188 if ( dmgZone == "Head" ) //no "Brain" damage zone defined (nor can it be caught like on player, due to missing command handler), "Head" is sufficient
189 {
190 m_KilledByHeadshot = true;
191 if (m_KillerData.m_Killer == killer)
192 m_KillerData.m_KillerHiTheBrain = true;
193 }
194 }
195 SyncEvents.SendEntityKilled(this, m_KillerData.m_Killer, m_KillerData.m_MurderWeapon, m_KillerData.m_KillerHiTheBrain);
196 m_DeathSyncSent = true;
197 }
198 }
199 }
200
201 float ConvertNonlethalDamage(float damage)
202 {
203 float converted_dmg = damage * GameConstants.PROJECTILE_CONVERSION_INFECTED;
204 //Print("ConvertNonlethalDamage | " + converted_dmg);
205 return converted_dmg;
206 }
207
208 void HandleSpecialZoneDamage(string dmgZone, float damage)
209 {
210 if ( damage < LEG_CRIPPLE_THRESHOLD )
211 return;
212
213 if (dmgZone == "LeftLeg" || dmgZone == "RightLeg")
214 {
215 SetHealth(dmgZone,"Health",0.0);
216 }
217 if (dmgZone == "Torso" || dmgZone == "Head") //TODO separate behaviour for head hits, anim/AI
218 {
219 m_HeavyHitOverride = true;
220 }
221 }
222
223 override int GetHideIconMask()
224 {
225 return EInventoryIconVisibility.HIDE_VICINITY;
226 }
227
228 //void SetCrawlTransition(string zone) {}
229}
override int GetHideIconMask()
proto native void PrePhys_SetRotation(float pInRot[4])
bool PostPhysUpdate(float pDt)
proto native void PostPhys_SetPosition(vector pInTransl)
quaternion in world space
class DayZAnimalCommandMove extends AnimCommandBase SetFlagFinished(bool pFinished)
DayZAnimalCommandScript fully scriptable command.
proto native bool PrePhys_GetRotation(out float pOutRot[4])
proto native void PostPhys_GetRotation(out float pOutRot[4])
vec3 in world space
proto native bool PrePhys_GetTranslation(out vector pOutTransl)
script function usable in PrePhysUpdate
proto native void PostPhys_SetRotation(float pInRot[4])
vec3 in world space
proto native void PrePhys_SetTranslation(vector pInTransl)
proto native void PostPhys_LockRotation()
quaternion in world space
proto native void PostPhys_GetPosition(out vector pOutTransl)
script function usable in PostPhysUpdate
DayZInfectedConstants
Definition DayZInfected.c:2
@ COMMANDID_MOVE
anim commands
Definition DayZInfected.c:4
@ MINDSTATE_CHASE
@ MINDSTATE_CALM
mind states
@ MINDSTATE_DISTURBED
@ COMMANDID_VAULT
Definition DayZInfected.c:5
@ COMMANDID_HIT
Definition DayZInfected.c:7
@ COMMANDID_CRAWL
Definition DayZInfected.c:9
@ COMMANDID_ATTACK
Definition DayZInfected.c:8
@ COMMANDID_SCRIPT
@ COMMANDID_DEATH
Definition DayZInfected.c:6
@ MINDSTATE_ALERTED
@ MINDSTATE_FIGHT
enum DayZInfectedConstantsMovement ANIM_DEATH_BACKSTAB
enum DayZInfectedConstantsMovement ANIM_DEATH_IMPULSE
DayZInfectedConstantsMovement
@ MOVEMENTSTATE_WALK
@ MOVEMENTSTATE_IDLE
@ MOVEMENTSTATE_RUN
@ MOVEMENTSTATE_SPRINT
enum DayZInfectedConstantsMovement ANIM_DEATH_DEFAULT
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
base class of all commands exposed to script to provide common functionality over animations
Definition AnimCommand.c:3
do not process rotations !
Definition DayZAnimal.c:437
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition ZombieBase.c:972
EntityAI m_Killer
Definition KillerData.c:3
base "helper" class for nonlethal ammo handling
Definition BulletTypes.c:3
static void SendEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
Definition SyncEvents.c:55
proto native float GetDamage(string zoneName, string healthType)
const float PROJECTILE_CONVERSION_INFECTED
Definition constants.c:841
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...
proto native HumanCommandScript StartCommand_ScriptInst(typename pCallbackClass)
proto native bool WasHit()
is true only once after hit event
proto native HumanCommandMove GetCommand_Move()
proto native HumanCommandMove StartCommand_Move()
returns current command ID
proto native HumanCommandDeathCallback StartCommand_Death(int pType, float pDirection, typename pCallbackClass)
--โ€” Death --โ€”
enum HumanMoveCommandID GetTransformWS(out vector pTm[4])
gets human transform in World Space
proto native HumanInputController GetInputController()
returns human input controller
proto native HumanCommandScript GetCommand_Script()
is human is in command action - returns its callback, if current command is action
proto native HumanCommandScript StartCommand_Script(HumanCommandScript pHumanCommand)
โ€” SCRIPTED COMMANDS