Page MenuHomeFeedback Tracker

paramsArray not available at preInit time on dedicated servers
Closed, ResolvedPublic

Description

On a dedicated server, the paramsArray is not available when function module's preInit functions are processed. This used to work before 1.44, and it still works on hosted servers. {F26233} {F26234}

Details

Legacy ID
1097813536
Severity
None
Resolution
Duplicate
Reproducibility
Always
Category
Dedicated Server

Event Timeline

Varanon set Category to Dedicated Server.May 8 2015, 8:30 PM
Varanon set Reproducibility to Always.
Varanon set Severity to None.
Varanon set Resolution to Duplicate.
Varanon set Legacy ID to 1097813536.May 8 2016, 12:03 PM

Tested on latest DEV

This is my Params class

class Params
{
class Hours
{

		title = "Mission Time / Hours";
		texts[] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"};
		values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
		default = 12;
		function = "KK_fnc_test";

};
};

This is what paramsArray looks like when executed in server preInit

[12]

On stable branch 1.44 I get "any".

Please see attached example:

A dedicated server outputs:
"Starting test"
"paramsArray has scalar entries and value any"
"paramsArray is of type "

while a self-hosted server outputs:
"Starting test"
"paramsArray has 4 entries and value [1,25,0,1]"
"paramsArray is of type ARRAY"

To reproduce: Start a dedicated server with the supplied mission, launch it by slotting in and clicking ok, and then examine the server's RPT file

For the record latest Dev build exhibits the exact same problem. Note again, must be dedicated server

OK, retested and if paramsArray executed immediately, then it is any, however

frame = diag_frameno;
pa = paramsArray;
oneachFrame {diag_log [pa, paramsArray, frame, diag_frameno]; oneachframe{}};

shows it is executed on the same frame but paramsArray is available

Yeah it broke DTAS mission too, had to create workarounds.

Calling a script from init line of a game object makes it unavailable, but using it in init.sqf it is available immediately.

bhaz added a subscriber: bhaz.May 8 2016, 12:03 PM
bhaz added a comment.May 10 2015, 6:48 AM

Is this new change intended? I rely on paramsArray to set some variables for modules before module init happens.
I believe this could also break use of paramsArray in unit init fields on dedicated servers.

https://community.bistudio.com/wiki/Functions_Library_%28Arma_3%29#Initialization_Order

Yes, using paramsArray in init field may fail now.

As a workaround, spawn/execVM a script with:
waituntil {!isNil "paramsArray"};

However, this workaround prevents being able to properly set the date on the server based on parameters.