Skip to content

Engine API Quick Reference

Home | Engine API Quick Reference


Condensed single-page reference for the most commonly used DayZ engine methods. For detailed explanations and examples, see the full chapters linked in each section header.


Table of Contents


Entity Methods

Full reference: Chapter 6.1: Entity System

Position & Orientation (Object)

MethodSignatureDescription
GetPositionvector GetPosition()World position
SetPositionvoid SetPosition(vector pos)Set world position
GetOrientationvector GetOrientation()Yaw, pitch, roll in degrees
SetOrientationvoid SetOrientation(vector ori)Set yaw, pitch, roll
GetDirectionvector GetDirection()Forward direction vector
SetDirectionvoid SetDirection(vector dir)Set forward direction
GetScalefloat GetScale()Current scale
SetScalevoid SetScale(float scale)Set scale

Transform (IEntity)

MethodSignatureDescription
GetOriginvector GetOrigin()World position (engine level)
SetOriginvoid SetOrigin(vector orig)Set world position (engine level)
GetYawPitchRollvector GetYawPitchRoll()Rotation as yaw/pitch/roll
GetTransformvoid GetTransform(out vector mat[4])Full 4x3 transform matrix
SetTransformvoid SetTransform(vector mat[4])Set full transform
VectorToParentvector VectorToParent(vector vec)Local direction to world
CoordToParentvector CoordToParent(vector coord)Local point to world
VectorToLocalvector VectorToLocal(vector vec)World direction to local
CoordToLocalvector CoordToLocal(vector coord)World point to local

Hierarchy (IEntity)

MethodSignatureDescription
AddChildvoid AddChild(IEntity child, int pivot, bool posOnly = false)Attach child to bone
RemoveChildvoid RemoveChild(IEntity child, bool keepTransform = false)Detach child
GetParentIEntity GetParent()Parent entity or null
GetChildrenIEntity GetChildren()First child entity
GetSiblingIEntity GetSibling()Next sibling entity

Display Info (Object)

MethodSignatureDescription
GetTypestring GetType()Config class name (e.g., "AKM")
GetDisplayNamestring GetDisplayName()Localized display name
IsKindOfbool IsKindOf(string type)Check config inheritance

Bone Positions (Object)

MethodSignatureDescription
GetBonePositionLSvector GetBonePositionLS(int pivot)Bone position in local space
GetBonePositionMSvector GetBonePositionMS(int pivot)Bone position in model space
GetBonePositionWSvector GetBonePositionWS(int pivot)Bone position in world space

Config Access (Object)

MethodSignatureDescription
ConfigGetBoolbool ConfigGetBool(string entry)Read bool from config
ConfigGetIntint ConfigGetInt(string entry)Read int from config
ConfigGetFloatfloat ConfigGetFloat(string entry)Read float from config
ConfigGetStringstring ConfigGetString(string entry)Read string from config
ConfigGetTextArrayvoid ConfigGetTextArray(string entry, out TStringArray values)Read string array
ConfigIsExistingbool ConfigIsExisting(string entry)Check if config entry exists

Health & Damage

Full reference: Chapter 6.1: Entity System

MethodSignatureDescription
GetHealthfloat GetHealth(string zone, string type)Get health value
GetMaxHealthfloat GetMaxHealth(string zone, string type)Get max health
SetHealthvoid SetHealth(string zone, string type, float value)Set health
SetHealthMaxvoid SetHealthMax(string zone, string type)Set to max
AddHealthvoid AddHealth(string zone, string type, float value)Add health
DecreaseHealthvoid DecreaseHealth(string zone, string type, float value, bool auto_delete = false)Reduce health
SetAllowDamagevoid SetAllowDamage(bool val)Enable/disable damage
GetAllowDamagebool GetAllowDamage()Check if damage allowed
IsAlivebool IsAlive()Alive check (defined on Object, works on any Object subclass)
ProcessDirectDamagevoid ProcessDirectDamage(int dmgType, EntityAI source, string component, string ammoType, vector modelPos, float coef = 1.0, int flags = 0)Apply damage (EntityAI)

Common zone/type pairs: ("", "Health") global, ("", "Blood") player blood, ("", "Shock") player shock, ("Engine", "Health") vehicle engine.


Type Checking

MethodClassDescription
IsMan()ObjectIs this a player?
IsBuilding()ObjectIs this a building?
IsTransport()ObjectIs this a vehicle?
IsDayZCreature()ObjectIs this a creature (zombie/animal)?
IsKindOf(string)ObjectConfig inheritance check
IsItemBase()EntityAIIs this an inventory item?
IsWeapon()EntityAIIs this a weapon?
IsMagazine()EntityAIIs this a magazine?
IsClothing()EntityAIIs this clothing?
IsFood()EntityAIIs this food?
Class.CastTo(out, obj)ClassSafe downcast (returns bool)
ClassName.Cast(obj)ClassInline cast (returns null on failure)

Inventory

Full reference: Chapter 6.1: Entity System

MethodSignatureDescription
GetInventoryGameInventory GetInventory()Get inventory component (EntityAI)
CreateInInventoryEntityAI CreateInInventory(string type)Create item in cargo
CreateEntityInCargoEntityAI CreateEntityInCargo(string type)Create item in cargo
CreateAttachmentEntityAI CreateAttachment(string type)Create item as attachment
EnumerateInventoryvoid EnumerateInventory(int traversal, out array<EntityAI> items)List all items
CountInventoryint CountInventory()Count items
HasEntityInInventorybool HasEntityInInventory(EntityAI item)Check for item
AttachmentCountint AttachmentCount()Number of attachments
GetAttachmentFromIndexEntityAI GetAttachmentFromIndex(int idx)Get attachment by index
FindAttachmentByNameEntityAI FindAttachmentByName(string slot)Get attachment by slot

Entity Creation & Deletion

Full reference: Chapter 6.1: Entity System

MethodSignatureDescription
CreateObjectObject GetGame().CreateObject(string type, vector pos, bool local = false, bool ai = false, bool physics = true)Create entity
CreateObjectExObject GetGame().CreateObjectEx(string type, vector pos, int flags, int rotation = RF_DEFAULT)Create with ECE flags
ObjectDeletevoid GetGame().ObjectDelete(Object obj)Immediate server deletion
ObjectDeleteOnClientvoid GetGame().ObjectDeleteOnClient(Object obj)Client-only deletion
Deletevoid obj.Delete()Deferred deletion (next frame)

Common ECE Flags

FlagValueDescription
ECE_NONE0No special behavior
ECE_CREATEPHYSICS1024Create collision
ECE_INITAI2048Initialize AI
ECE_EQUIP24576Spawn with attachments + cargo
ECE_PLACE_ON_SURFACEcombinedPhysics + path + trace
ECE_LOCAL1073741824Client-only (not replicated)
ECE_NOLIFETIME4194304Will not despawn
ECE_KEEPHEIGHT524288Keep Y position

Player Methods

Full reference: Chapter 6.1: Entity System

MethodSignatureDescription
GetIdentityPlayerIdentity GetIdentity()Player identity object
GetIdentity().GetName()string GetName()Steam/platform display name
GetIdentity().GetId()string GetId()BI unique ID
GetIdentity().GetPlainId()string GetPlainId()Steam64 ID
GetIdentity().GetPlayerId()int GetPlayerId()Session player ID
GetHumanInventory().GetEntityInHands()EntityAI GetEntityInHands()Item in hands
GetDrivingVehicleEntityAI GetDrivingVehicle()Vehicle being driven
IsAlivebool IsAlive()Alive check
IsUnconsciousbool IsUnconscious()Unconscious check
IsRestrainedbool IsRestrained()Restrained check
IsInVehiclebool IsInVehicle()In vehicle check
SpawnEntityOnGroundOnCursorDirEntityAI SpawnEntityOnGroundOnCursorDir(string type, float dist)Spawn in front of player

Vehicle Methods

Full reference: Chapter 6.2: Vehicle System

Crew (Transport)

MethodSignatureDescription
CrewSizeint CrewSize()Total seat count
CrewMemberHuman CrewMember(int idx)Get human at seat
CrewMemberIndexint CrewMemberIndex(Human member)Get seat of human
CrewGetOutvoid CrewGetOut(int idx)Force eject from seat
CrewDeathvoid CrewDeath(int idx)Kill crew member

Engine (Car)

MethodSignatureDescription
EngineIsOnbool EngineIsOn()Engine running?
EngineStartvoid EngineStart()Start engine
EngineStopvoid EngineStop()Stop engine
EngineGetRPMfloat EngineGetRPM()Current RPM
EngineGetRPMRedlinefloat EngineGetRPMRedline()Redline RPM
GetGearint GetGear()Current gear
GetSpeedometerfloat GetSpeedometer()Speed in km/h

Fluids (Car)

MethodSignatureDescription
GetFluidCapacityfloat GetFluidCapacity(CarFluid fluid)Max capacity
GetFluidFractionfloat GetFluidFraction(CarFluid fluid)Fill level 0.0-1.0
Fillvoid Fill(CarFluid fluid, float amount)Add fluid
Leakvoid Leak(CarFluid fluid, float amount)Remove fluid
LeakAllvoid LeakAll(CarFluid fluid)Drain all fluid

CarFluid enum: FUEL, OIL, BRAKE, COOLANT

Controls (Car)

MethodSignatureDescription
SetBrakevoid SetBrake(float value, int wheel = -1)0.0-1.0, -1 = all
SetHandbrakevoid SetHandbrake(float value)0.0-1.0
SetSteeringvoid SetSteering(float value, bool analog = true)Steering input
SetThrustvoid SetThrust(float value, int wheel = -1)0.0-1.0 throttle

Weather Methods

Full reference: Chapter 6.3: Weather System

Access

MethodSignatureDescription
GetGame().GetWeather()Weather GetWeather()Get weather singleton

Phenomena (Weather)

MethodSignatureDescription
GetOvercastWeatherPhenomenon GetOvercast()Cloud cover
GetRainWeatherPhenomenon GetRain()Rain
GetFogWeatherPhenomenon GetFog()Fog
GetSnowfallWeatherPhenomenon GetSnowfall()Snow
GetWindMagnitudeWeatherPhenomenon GetWindMagnitude()Wind speed
GetWindDirectionWeatherPhenomenon GetWindDirection()Wind direction
GetWindvector GetWind()Wind direction vector
GetWindSpeedfloat GetWindSpeed()Wind speed m/s
SetStormvoid SetStorm(float density, float threshold, float timeout)Lightning config

WeatherPhenomenon

MethodSignatureDescription
GetActualfloat GetActual()Current interpolated value
GetForecastfloat GetForecast()Target value
GetDurationfloat GetDuration()Remaining duration (seconds)
Setvoid Set(float forecast, float time = 0, float minDuration = 0)Set target (server only)
SetLimitsvoid SetLimits(float min, float max)Value range limits
SetTimeLimitsvoid SetTimeLimits(float min, float max)Change speed limits
SetChangeLimitsvoid SetChangeLimits(float min, float max)Magnitude change limits

File I/O Methods

Full reference: Chapter 6.8: File I/O & JSON

Path Prefixes

PrefixLocationWritable
$profile:Server/client profile directoryYes
$saves:Save directoryYes
$mission:Current mission folderRead typically
$CurrentDir:Working directoryDepends

File Operations

MethodSignatureDescription
FileExistbool FileExist(string path)Check if file exists
MakeDirectorybool MakeDirectory(string path)Create directory
OpenFileFileHandle OpenFile(string path, FileMode mode)Open file (0 = fail)
CloseFilevoid CloseFile(FileHandle fh)Close file
FPrintvoid FPrint(FileHandle fh, string text)Write text (no newline)
FPrintlnvoid FPrintln(FileHandle fh, string text)Write text + newline
FGetsint FGets(FileHandle fh, string line)Read one line
ReadFilestring ReadFile(FileHandle fh)Read entire file
DeleteFilebool DeleteFile(string path)Delete file
CopyFilebool CopyFile(string src, string dst)Copy file

JSON (JsonFileLoader)

MethodSignatureDescription
JsonLoadFilevoid JsonFileLoader<T>.JsonLoadFile(string path, T obj)Load JSON into object (returns void)
JsonSaveFilevoid JsonFileLoader<T>.JsonSaveFile(string path, T obj)Save object as JSON

FileMode Enum

ValueDescription
FileMode.READOpen for reading
FileMode.WRITEOpen for writing (creates/overwrites)
FileMode.APPENDOpen for appending

Timer & CallQueue Methods

Full reference: Chapter 6.7: Timers & CallQueue

Access

ExpressionReturnsDescription
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY)ScriptCallQueueGameplay call queue
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM)ScriptCallQueueSystem call queue
GetGame().GetCallQueue(CALL_CATEGORY_GUI)ScriptCallQueueGUI call queue
GetGame().GetUpdateQueue(CALL_CATEGORY_GAMEPLAY)ScriptInvokerPer-frame update queue

ScriptCallQueue

MethodSignatureDescription
CallLatervoid CallLater(func fn, int delay = 0, bool repeat = false, param1..4)Schedule delayed/repeating call
Callvoid Call(func fn, param1..4)Execute next frame
CallByNamevoid CallByName(Class obj, string fnName, int delay = 0, bool repeat = false, Param par = null)Call method by string name
Removevoid Remove(func fn)Cancel scheduled call
RemoveByNamevoid RemoveByName(Class obj, string fnName)Cancel by string name
GetRemainingTimefloat GetRemainingTime(Class obj, string fnName)Get remaining time on CallLater

Timer Class

MethodSignatureDescription
Timer()void Timer(int category = CALL_CATEGORY_SYSTEM)Constructor
Runvoid Run(float duration, Class obj, string fnName, Param params = null, bool loop = false)Start timer
Stopvoid Stop()Stop timer
Pausevoid Pause()Pause timer
Continuevoid Continue()Resume timer
IsPausedbool IsPaused()Timer paused?
IsRunningbool IsRunning()Timer active?
GetRemainingfloat GetRemaining()Seconds remaining

ScriptInvoker

MethodSignatureDescription
Insertvoid Insert(func fn)Register callback
Removevoid Remove(func fn)Unregister callback
Invokevoid Invoke(params...)Fire all callbacks
Countint Count()Number of registered callbacks
Clearvoid Clear()Remove all callbacks

Widget Creation Methods

Full reference: Chapter 3.5: Programmatic Creation

MethodSignatureDescription
GetGame().GetWorkspace()WorkspaceWidget GetWorkspace()Get UI workspace
CreateWidgetsWidget CreateWidgets(string layout, Widget parent = null)Load .layout file
FindAnyWidgetWidget FindAnyWidget(string name)Find child by name (recursive)
Showvoid Show(bool show)Show/hide widget
SetTextvoid TextWidget.SetText(string text)Set text content
SetImagevoid ImageWidget.SetImage(int index)Set image index
SetColorvoid SetColor(int color)Set widget color (ARGB)
SetAlphavoid SetAlpha(float alpha)Set transparency 0.0-1.0
SetSizevoid SetSize(float x, float y, bool relative = false)Set widget size
SetPosvoid SetPos(float x, float y, bool relative = false)Set widget position
GetScreenSizevoid GetScreenSize(out float x, out float y)Screen resolution
Destroyvoid Widget.Destroy()Remove and destroy widget

ARGB Color Helper

FunctionSignatureDescription
ARGBint ARGB(int a, int r, int g, int b)Create color int (0-255 each)
ARGBFint ARGBF(float a, float r, float g, float b)Create color int (0.0-1.0 each)

RPC / Networking Methods

Full reference: Chapter 6.9: Networking & RPC

Environment Checks

MethodSignatureDescription
GetGame().IsServer()bool IsServer()True on server / listen-server host
GetGame().IsClient()bool IsClient()True on client
GetGame().IsMultiplayer()bool IsMultiplayer()True in multiplayer
GetGame().IsDedicatedServer()bool IsDedicatedServer()True only on dedicated server

ScriptRPC

MethodSignatureDescription
ScriptRPC()void ScriptRPC()Constructor
Writebool Write(void value)Serialize a value (int, float, bool, string, vector, array)
Sendvoid Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient = null)Send RPC
Resetvoid Reset()Clear written data

Receiving (Override on Object)

MethodSignatureDescription
OnRPCvoid OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)RPC receive handler

ParamsReadContext

MethodSignatureDescription
Readbool Read(out void value)Deserialize a value (same types as Write)

Legacy RPC (CGame)

MethodSignatureDescription
RPCSingleParamvoid GetGame().RPCSingleParam(Object target, int rpc, Param param, bool guaranteed, PlayerIdentity recipient = null)Send single Param object
RPCvoid GetGame().RPC(Object target, int rpc, array<Param> params, bool guaranteed, PlayerIdentity recipient = null)Send multiple Params

ScriptInputUserData (Input-Verified)

MethodSignatureDescription
CanStoreInputUserDatabool ScriptInputUserData.CanStoreInputUserData()Check if queue has space
Writebool Write(void value)Serialize value
Sendvoid Send()Send to server (client only)

Math Constants & Methods

Full reference: Chapter 1.7: Math & Vectors

Constants

ConstantValueDescription
Math.PI3.14159...Pi
Math.PI26.28318...2 * Pi
Math.PI_HALF1.57079...Pi / 2
Math.DEG2RAD0.01745...Degrees to radians multiplier
Math.RAD2DEG57.2957...Radians to degrees multiplier
int.MAX2147483647Maximum int
int.MIN-2147483648Minimum int
float.MAX3.4028e+38Maximum float
float.MIN1.175e-38Minimum positive float

Random

MethodSignatureDescription
Math.RandomIntint RandomInt(int min, int max)Random int [min, max)
Math.RandomIntInclusiveint RandomIntInclusive(int min, int max)Random int [min, max]
Math.RandomFloat01float RandomFloat01()Random float [0, 1]
Math.RandomBoolbool RandomBool()Random true/false

Rounding

MethodSignatureDescription
Math.Roundfloat Round(float f)Round to nearest
Math.Floorfloat Floor(float f)Round down
Math.Ceilfloat Ceil(float f)Round up

Clamping & Interpolation

MethodSignatureDescription
Math.Clampfloat Clamp(float val, float min, float max)Clamp to range
Math.Minfloat Min(float a, float b)Minimum of two
Math.Maxfloat Max(float a, float b)Maximum of two
Math.Lerpfloat Lerp(float a, float b, float t)Linear interpolation
Math.InverseLerpfloat InverseLerp(float a, float b, float val)Inverse lerp

Absolute & Power

MethodSignatureDescription
Math.AbsFloatfloat AbsFloat(float f)Absolute value (float)
Math.AbsIntint AbsInt(int i)Absolute value (int)
Math.Powfloat Pow(float base, float exp)Power
Math.Sqrtfloat Sqrt(float f)Square root
Math.SqrFloatfloat SqrFloat(float f)Square (f * f)

Trigonometry (Radians)

MethodSignatureDescription
Math.Sinfloat Sin(float rad)Sine
Math.Cosfloat Cos(float rad)Cosine
Math.Tanfloat Tan(float rad)Tangent
Math.Asinfloat Asin(float val)Arc sine
Math.Acosfloat Acos(float val)Arc cosine
Math.Atan2float Atan2(float y, float x)Angle from components

Smooth Damping

MethodSignatureDescription
Math.SmoothCDfloat SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxSpeed, float dt)Smooth damp toward target (like Unity's SmoothDamp)
c
// Smooth damping usage
// val: current value, target: target value, velocity: inout float[] (persisted between calls)
// smoothTime: smoothing time, maxSpeed: speed cap, dt: delta time
float m_Velocity[1] = {0};  // MUST be float array, not plain float
float result = Math.SmoothCD(current, target, m_Velocity, 0.3, 1000.0, dt);

Angle

MethodSignatureDescription
Math.NormalizeAnglefloat NormalizeAngle(float deg)Wrap to 0-360

Vector Methods

MethodSignatureDescription
vector.Distancefloat Distance(vector a, vector b)Distance between points
vector.DistanceSqfloat DistanceSq(vector a, vector b)Squared distance (faster)
vector.Directionvector Direction(vector from, vector to)Direction vector
vector.Dotfloat Dot(vector a, vector b)Dot product
vector.Lerpvector Lerp(vector a, vector b, float t)Interpolate positions
v.Length()float Length()Vector magnitude
v.LengthSq()float LengthSq()Squared magnitude (faster)
v.Normalized()vector Normalized()Unit vector
v.VectorToAngles()vector VectorToAngles()Direction to yaw/pitch
v.AnglesToVector()vector AnglesToVector()Yaw/pitch to direction
v.Multiply3vector Multiply3(vector mat[3])Matrix multiply
v.InvMultiply3vector InvMultiply3(vector mat[3])Inverse matrix multiply
Vector(x, y, z)vector Vector(float x, float y, float z)Create vector

Global Functions

FunctionSignatureDescription
GetGame()CGame GetGame()Game instance
GetGame().GetPlayer()Man GetPlayer()Local player (CLIENT only)
GetGame().GetPlayers(out arr)void GetPlayers(out array<Man> arr)All players (server)
GetGame().GetWorld()World GetWorld()World instance
GetGame().GetTickTime()float GetTickTime()Server time (seconds)
GetGame().GetWorkspace()WorkspaceWidget GetWorkspace()UI workspace
GetGame().SurfaceY(x, z)float SurfaceY(float x, float z)Terrain height at position
GetGame().SurfaceGetType(x, z)string SurfaceGetType(float x, float z)Surface material type
GetGame().GetObjectsAtPosition(pos, radius, objects, proxyCargo)void GetObjectsAtPosition(vector pos, float radius, out array<Object> objects, out array<CargoBase> proxyCargo)Find objects near position
GetScreenSize(w, h)void GetScreenSize(out int w, out int h)Get screen resolution
GetGame().IsServer()bool IsServer()Server check
GetGame().IsClient()bool IsClient()Client check
GetGame().IsMultiplayer()bool IsMultiplayer()Multiplayer check
Print(string)void Print(string msg)Write to script log
ErrorEx(string)void ErrorEx(string msg, ErrorExSeverity sev = ERROR)Log error with severity
DumpStackString()void DumpStackString(out string stack)Get call stack as string (fills out param)
string.Format(fmt, ...)string Format(string fmt, ...)Format string (%1..%9)

Mission Hooks

Full reference: Chapter 6.11: Mission Hooks

Server-side (modded MissionServer)

MethodDescription
override void OnInit()Initialize managers, register RPCs
override void OnMissionStart()After all mods loaded
override void OnUpdate(float timeslice)Per-frame (use accumulator!)
override void OnMissionFinish()Cleanup singletons, unsubscribe events
override void OnEvent(EventType eventTypeId, Param params)Chat, voice events
override void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)Player joined
override void InvokeOnDisconnect(PlayerBase player)Player left
override void OnClientReadyEvent(int peerId, PlayerIdentity identity)Client ready for data
override void PlayerRegistered(int peerId)Identity registered

Client-side (modded MissionGameplay)

MethodDescription
override void OnInit()Initialize client managers, create HUD
override void OnUpdate(float timeslice)Per-frame client update
override void OnMissionFinish()Cleanup
override void OnKeyPress(int key)Key pressed
override void OnKeyRelease(int key)Key released

Action System

Full reference: Chapter 6.12: Action System

Register Actions on an Item

c
override void SetActions()
{
    super.SetActions();
    AddAction(MyAction);           // Add custom action
    RemoveAction(ActionEat);       // Remove vanilla action
}

ActionBase Key Methods

MethodDescription
override void CreateConditionComponents()Set CCINone/CCTNone distance conditions
override bool ActionCondition(...)Custom validation logic
override void OnExecuteServer(ActionData action_data)Server-side execution
override void OnExecuteClient(ActionData action_data)Client-side effects
override string GetText()Display name (supports #STR_ keys)

Full documentation: Home | Cheat Sheet | Entity System | Vehicles | Weather | Timers | File I/O | Networking | Mission Hooks | Action System

Released under CC BY-SA 4.0 | Code examples under MIT License