Page MenuHomeFeedback Tracker

Missing ECE_ constant for spawn flag to initialize AI when creating object with CreateObjectEx
Assigned, UrgentPublic

Description

The CGame::CreateObject method accepts an optional parameter, init_ai, to initialize the created object's AI. This parameter is useful when spawning in infected and animals, since it enables the entities to move around and behave as they should, instead of standing still at their spawn position.

The CGame::CreateObjectEx method (which, I've been told, is preferred over CreateObject) does not accept an init_ai parameter, but it does accept iFlags, which is a bitmask of various flags. However, none of the ECE_ constants defined in 3_game\ce\centraleconomy.c correspond to a flag for initializing the object's AI.

Through the help of the DayZ Modders Discord (thank you, Jacob_Mango), I have learned that 2048 is the equivalent spawn flag for initializing the object's AI.

For your consideration, here is a very small patch to add a new ECE_INIT_AI constant for the undocumented flag:

--- scripts/3_game/ce/centraleconomy.c.orig	2021-03-20 09:36:30.908857000 -0500
+++ scripts/3_game/ce/centraleconomy.c	2021-03-20 09:37:26.086041200 -0500
@@ -14,6 +14,7 @@
 
 const int ECE_ROTATIONFLAGS					= 512;	// enable rotation flags for object placement
 const int ECE_CREATEPHYSICS					= 1024;	// create collision envelope and related physics data (if object has them)
+const int ECE_INIT_AI						= 2048;
 const int ECE_AIRBORNE						= 4096;	// create flying unit in the air
 
 const int ECE_EQUIP_ATTACHMENTS				= 8192;		// equip with configured ATTACHMENTS

Would it be possible to have this new constant added in the next DayZ update?

Details

Severity
Minor
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

N/A

Event Timeline

tjensen created this task.Mar 20 2021, 3:48 PM
Geez changed the task status from New to Assigned.Mar 22 2021, 7:17 PM