Page MenuHomeFeedback Tracker

Broadcasting a variable to all clients via setVariable does not work in "init" in case of Zeus spawning
Closed, ResolvedPublic


If I setVariable with global broadcasting in an object namespace of a recently created object by Zeus in it's "init" phase, the variable is not broadcasted to all clients. In "postInit" this seems to work. If I add a sleep command and wait for a certain amount of time, the variable is also broadcasted in case of "init". So, this seems to me like the object or it's namespace is not available in that early stage and therefore the setVariable command fails to broadcast to all clients. This variable is also missing on the client that used the Zeus mode. See steps to reproduce.


Operating System
Windows 11 x64
Operating System Version
Windows 11 Version 22H2 (Build 22621.1928)
Steps To Reproduce

Put the following code inside a class definition of an object, that is placeable by Zeus. Then spawn the object in Zeus mode (dedicated server and minimum 1 client) and check the 4 variables on the connected clients. The variable "DEBUG_testVar1" will be missing on clients even on the Zeus machine. "DEBUG_testVar2", "DEBUG_testVar3" and "DEBUG_testVar4" will be available.

class EventHandlers
	init = "params ['_entity']; if (isServer) then { _entity setVariable ['DEBUG_testVar1', 1, true]; [_entity] spawn { params ['_entity']; sleep 1; _entity setVariable ['DEBUG_testVar3', 1, true]; }; };";
	postInit = "params ['_entity']; if (isServer) then { _entity setVariable ['DEBUG_testVar2', 1, true]; [_entity] spawn { params ['_entity']; sleep 1; _entity setVariable ['DEBUG_testVar4', 1, true]; }; };";
Additional Information

Dedicated Server 2.12.150715 (Profile Build)
Client 2.12.150715 (Profile Build)

Mods: CBA, ACE3, Advanced Developer Tools, Advanced Equipment (The last one contained my testing class)

Event Timeline

y0014984 created this task.Jul 7 2023, 7:17 PM
y0014984 edited Steps To Reproduce. (Show Details)Jul 7 2023, 7:19 PM
dedmen closed this task as Resolved.Jul 7 2023, 7:20 PM
dedmen claimed this task.
dedmen added a subscriber: dedmen.

You are sending a setVariable message, before the object is initialized.
The server will receive the object message after its spawned.
You are sending variable WHILE its being spawned.

The server will receive variable for a object that doesn't exist, and discard it.

Won't fix