Jump to content
Northup

Changing weather on a dedicated server adverntures

Recommended Posts

 

Hi all.

Starting a new mission, and I want the weather to be configurable by an authorized in game admin via the parameters menu. Since it's a multiplayer mission, I want to ensure all clients match the intended setting.

In description.ext:

class Params
{
    
    class BR_TimeOfDay                                                                                                
    {
        title = "Environment: Time of Day";
        values[] = {0,4,8,12,16,18,20,24};
        texts[] = {"Random Time of Day", "Dawn","Mid Morning","Noon","Afternoon","Evening","Night","Midnight"};
        default = 0;
        
    };
};


In initServer.sqf:

 

// === Get the BR_daytime variable from Params in description.ext
_BR_Time = ["BR_TimeOfDay"] call BIS_fnc_getParamValue;

// === Check if host selected random. If so, select a random value from the options available, if not, use the value they selected, set date on server and broadcast to all clients. 
if (_BR_Time == 0) then {
_randomTime = [4, 8, 12, 16, 18, 20, 24] call BIS_fnc_selectRandom;
[_randomTime] call BIS_fnc_paramDaytime;
diag_log format["_randomTime value: %1", _randomTime]; // Debug output
["setDate", [2024, 10, 10, _randomTime, 0]] call BIS_fnc_MP;
} else {
[_BR_Time] call BIS_fnc_paramDaytime;
 diag_log format["_BR_Time value: %1", _BR_Time]; // Debug output
["setDate", [2024, 10, 10, _BR_Time, 0]] call BIS_fnc_MP;
};



The code "works" but I get a hint error:
 

[BIS_fnc_MP] Error: type Array, expected string, on index 1, in ["setDate"[2024,10,10,8,0],0,false,false]



In this case, the "8" in ["setDate"[2024,10,10,8,0],0,false,false] does represent the correct value being passed, so I am at a loss as to what is causing it. The same is true when "random" is selected. The time of day changes, but I still get a hint error.

 

 8:22:15 "3den Enhanced: Debug Options initialized."
 8:22:57 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
 8:23:00 Starting mission:
 8:23:00  Mission file: SomeName%2eAltis
 8:23:00  Mission world: Stratis
 8:23:00  Mission directory: C:\Users\Username\Documents\Arma 3\mpmissions\SomeName%2eAltis.Stratis\
 8:23:01 No more slot to add connection at 033057 (3386.8,5735.4)
 8:23:01 d:\bis\source\stable\futura\lib\network\networkserver.cpp NetworkServer::OnClientStateChanged:NOT IMPLEMENTED - briefing!
 8:23:03 "_BR_Time value: 8"
 8:23:04  Mission id: 1c9cc5d519ba6c4a31aabc2dc1d86b6da522b887

 

Share this post


Link to post
Share on other sites

Your params for BIS_fnc_MP are wrong...

Quote

Syntax:

[params, functionName, target, isPersistent, isCall] call BIS_fnc_MP

so...

[ [2024, 10, 10, _BR_Time, 0], "setDate" ] call BIS_fnc_MP;

 

BUT BIS_fnc_MP is deprecated, you should use remoteExec instead...

Quote

Syntax:

params remoteExec [order, targets, JIP]

so...

[ 2024, 10, 10, _BR_Time, 0 ] remoteExec[ "setDate" ];

 

  • Like 1

Share this post


Link to post
Share on other sites
32 minutes ago, Larrow said:

Your params for BIS_fnc_MP are wrong...

so...


[ [2024, 10, 10, _BR_Time, 0], "setDate" ] call BIS_fnc_MP;

 

BUT BIS_fnc_MP is deprecated, you should use remoteExec instead...

so...


[ 2024, 10, 10, _BR_Time, 0 ] remoteExec[ "setDate" ];

 

Thanks!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×