Mission Parameters – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Remove dupe)
m (Some wiki formatting)
Line 1: Line 1:
[[Category:Arma 3: Editing|Mission Parameters]]
Server admin / host can customize multiplayer missions in ROLE ASSIGNMENT menu using parameters prepared by the mission designer.
Server admin / host can customize multiplayer missions in ROLE ASSIGNMENT menu using parameters prepared by the mission designer.


Important limitation. In an MP environment, the Paramsarray is not available on the client until some time after preinit. but before postinit so any code called upon the client should take this into consideration
Important limitation. In an MP environment, the Paramsarray is not available on the client until some time after preinit. but before postinit so any code called upon the client should take this into consideration


== Manual Params ==
== Manual Params ==
=== Config ===
=== Config ===
[[File:Arma3 Mission Parameters.png|thumb|Mission Parameters selection]]
[[File:Arma3 Mission Parameters.png|thumb|Mission Parameters selection]]
Params are defined in [[description.ext]].
Params are defined in [[Description.ext]].
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
class Params
class Params
Line 35: Line 36:
// When 'texts' are missing, values will be displayed directly instead
// When 'texts' are missing, values will be displayed directly instead
default = 1000;
default = 1000;
file = "setViewDistance.sqf"; // (Optional) Script [[call]]ed when player joins, selected value is passed as an argument
file = "setViewDistance.sqf"; // (Optional) Script called when player joins, selected value is passed as an argument
};
};
};
};
Line 57: Line 58:


=== Functions ===
=== Functions ===
<u>It is highly recommended</u> that you use [[BIS_fnc_getParamValue]] instead of paramsArray to get value of a param with given class name. It is fast and secure and globally available on any connected PC as well as JIP.
<u>It is highly recommended</u> that you use [[BIS_fnc_getParamValue]] instead of paramsArray to get value of a param with given class name. It is fast and secure and globally available on any connected PC as well as JIP.


<code>_viewDistance = "ViewDistance" [[call]] [[BIS_fnc_getParamValue]];
<code>_viewDistance = "ViewDistance" [[call]] [[BIS_fnc_getParamValue]];
_viewDistance = ["ViewDistance", 500] [[call]] [[BIS_fnc_getParamValue]];</code>
_viewDistance = ["ViewDistance", 500] [[call]] [[BIS_fnc_getParamValue]];</code>


== Predefined Params ==
== Predefined Params ==
Arma 3 introduces a framework for defining commonly used params (e.g., time of the day or mission duration), which can be shared across multiple missions. Once included to description.ext, they will initialize automatically. Some of them can be further customized using specific [[PreProcessor_Commands|macros]].
Arma 3 introduces a framework for defining commonly used params (e.g., time of the day or mission duration), which can be shared across multiple missions. Once included to description.ext, they will initialize automatically. Some of them can be further customized using specific [[PreProcessor_Commands|macros]].
{{warning | Make sure that include path to a3 mod has leading backslash:  
{{warning | Make sure that include path to a3 mod has leading backslash:  
Line 68: Line 72:
<code>#include "\a3\functions_f\Params\paramCountdown.hpp" // good</code>
<code>#include "\a3\functions_f\Params\paramCountdown.hpp" // good</code>
}}
}}
<syntaxhighlight lang=cpp>
<syntaxhighlight lang="cpp">


class Params
class Params
Line 131: Line 135:
| Set starting hour, options are represented by whole hours
| Set starting hour, options are represented by whole hours
|
|
  {{codecomment| //Can be any integer between 0 and 23}}
  {{cc|Can be any integer between 0 and 23}}
  #define DAYTIMEHOUR_DEFAULT 19
  #define DAYTIMEHOUR_DEFAULT 19


Line 138: Line 142:
| Set starting hour, options are described by words
| Set starting hour, options are described by words
|
|
  {{codecomment| //Can be 0, 6, 12 or 18}}
  {{cc|Can be 0, 6, 12 or 18}}
  #define DAYTIMEPERIOD_DEFAULT 12
  #define DAYTIMEPERIOD_DEFAULT 12


Line 145: Line 149:
| Allow [[Mission_Editor:_Debug_Console_(Arma_3)|debug console]] for server host or logged in admin
| Allow [[Mission_Editor:_Debug_Console_(Arma_3)|debug console]] for server host or logged in admin
|
|
  {{codecomment| //0 (disabled) or 1 (enabled)}}
  {{cc|0 (disabled) or 1 (enabled)}}
  #define DEBUGCONSOLE_DEFAULT 1
  #define DEBUGCONSOLE_DEFAULT 1


Line 152: Line 156:
| Set to whom will [[independent]] side be friendly
| Set to whom will [[independent]] side be friendly
|
|
  {{codecomment| //Can be any -1 (Nobody}, 0 (OPFOR), 1 (BLUFOR) or 2 (Everybody)}}
  {{cc|Can be any -1 (Nobody}, 0 (OPFOR), 1 (BLUFOR) or 2 (Everybody)}}
  #define GUERFRIENDLY_DEFAULT -1
  #define GUERFRIENDLY_DEFAULT -1


Line 159: Line 163:
| Set respawn tickets for all sides<br>The "NoDisabled" version has no "disabled" option, and will pick the middle option by default.
| Set respawn tickets for all sides<br>The "NoDisabled" version has no "disabled" option, and will pick the middle option by default.
|
|
  #define TICKETS_MIN 100
  #define TICKETS_MIN 100
  #define TICKETS_MAX 1100
  #define TICKETS_MAX 1100
  #define TICKETS_DEFAULT -1
  #define TICKETS_DEFAULT -1


Line 167: Line 171:
| Set default weather
| Set default weather
|
|
  {{codecomment| //Can be 0 (sunny), 25, 50, 75 or 100 (storm))}}
  {{cc|Can be 0 (sunny), 25, 50, 75 or 100 (storm))}}
  #define WEATHER_DEFAULT 75
  #define WEATHER_DEFAULT 75


Line 174: Line 178:
| Sets a time multiplier for in-game time. See [[setTimeMultiplier|setTimeMultiplier]]
| Sets a time multiplier for in-game time. See [[setTimeMultiplier|setTimeMultiplier]]
|
|
  {{codecomment| //Can be x1, x2, x5, x10 or x20}}
  {{cc|Can be x1, x2, x5, x10 or x20}}
  #define TIMEACCELERATION_DEFAULT 10
  #define TIMEACCELERATION_DEFAULT 10


Line 181: Line 185:
| Set rendering distance, in meters. See [[setViewDistance|setViewDistance]]
| Set rendering distance, in meters. See [[setViewDistance|setViewDistance]]
|
|
  #define VIEW_DISTANCE_MIN 1500
  #define VIEW_DISTANCE_MIN 1500
  #define VIEW_DISTANCE_MAX 4000
  #define VIEW_DISTANCE_MAX 4000
  #define VIEW_DISTANCE_DEFAULT 2000
  #define VIEW_DISTANCE_DEFAULT 2000
|-
|-
Line 189: Line 193:
|
|
|}
|}


== See Also ==
== See Also ==
* [[Mission Parameters]]
* [[Mission Parameters]]
* [[Description.ext#Mission_parameters|Description.ext]]
* [[Description.ext#Mission_parameters|Description.ext]]
[[Category:Arma 3: Editing|Mission Parameters]]

Revision as of 19:19, 23 August 2020

Server admin / host can customize multiplayer missions in ROLE ASSIGNMENT menu using parameters prepared by the mission designer.

Important limitation. In an MP environment, the Paramsarray is not available on the client until some time after preinit. but before postinit so any code called upon the client should take this into consideration


Manual Params

Config

Mission Parameters selection

Params are defined in Description.ext.

class Params
{
	class AISkill
	{
		title = "AI Skill"; // Param name visible in the list
		values[] = {0,1,2}; // Values; must be integers; has to have the same number of elements as 'texts'
		texts[] = {"Recruit","Regular","Veteran"}; // Description of each selectable item
		default = 1; // Default value; must be listed in 'values' array, otherwise 0 is used
		// Default values that are not whole numbers do not work. Param will default to 0 (or 1 if defined)
	};
	class Daytime
	{
		title = "Time";
		texts[] = {"Morning","Day","Evening","Night"};
		values[] = {6,12,18,0};
		default = 12;
		function = "BIS_fnc_paramDaytime"; // (Optional) Function called when player joins, selected value is passed as an argument
		isGlobal = 1; // (Optional) 1 to execute script / function locally for every player who joins, 0 to do it only on server
	};
	class ViewDistance
	{
		title = "View distance (in metres)";
		values[] = {500,1000,2000,5000};
		// When 'texts' are missing, values will be displayed directly instead
		default = 1000;
		file = "setViewDistance.sqf"; // (Optional) Script called when player joins, selected value is passed as an argument
	};
};

Mission

Selected values are stored in paramsArray array, accessible anytime during the mission on any connected computer. Their order is the same as is in description.ext (for example, params above would result in [12,1] if default values were kept).

Example (can be used in init.sqf): if (isServer) then { _skill = [0.1, 0.5, 1] select (paramsArray select 0); { _x setSkill _skill; } forEach allUnits; };

setViewDistance.sqf:

setViewDistance (_this select 0);

Functions

It is highly recommended that you use BIS_fnc_getParamValue instead of paramsArray to get value of a param with given class name. It is fast and secure and globally available on any connected PC as well as JIP.

_viewDistance = "ViewDistance" call BIS_fnc_getParamValue; _viewDistance = ["ViewDistance", 500] call BIS_fnc_getParamValue;


Predefined Params

Arma 3 introduces a framework for defining commonly used params (e.g., time of the day or mission duration), which can be shared across multiple missions. Once included to description.ext, they will initialize automatically. Some of them can be further customized using specific macros.

Make sure that include path to a3 mod has leading backslash:

#include "a3\functions_f\Params\paramCountdown.hpp" // bad

#include "\a3\functions_f\Params\paramCountdown.hpp" // good
class Params
{
	#define COUNTDOWN_MIN 600
	#define COUNTDOWN_MAX 3600
	#define COUNTDOWN_DEFAULT -1
	#include "\a3\functions_f\Params\paramCountdown.hpp"

	#define DAYTIMEHOUR_DEFAULT 19
	#include "\a3\functions_f\Params\paramDaytimeHour.hpp"

	//#define DAYTIMEPERIOD_DEFAULT 12
	//#include "\a3\functions_f\Params\paramDaytimePeriod.hpp"

	#define DEBUGCONSOLE_DEFAULT 1
	#include "\a3\functions_f\Params\paramDebugConsole.hpp"

	#define GUERFRIENDLY_DEFAULT -1
	#include "\a3\functions_f\Params\paramGuerFriendly.hpp"

	#define TICKETS_MIN 100
	#define TICKETS_MAX	1100
	#define TICKETS_DEFAULT	-1
	#include "\a3\functions_f\Params\paramRespawnTickets.hpp"

	#define WEATHER_DEFAULT	40
	#include "\a3\functions_f\Params\paramWeather.hpp"

	#define TIMEACCELERATION_DEFAULT 10
	#include "\a3\Functions_F_MP_Mark\Params\paramTimeAcceleration.hpp"

	#define VIEW_DISTANCE_MIN 1500
	#define VIEW_DISTANCE_MAX 4000
	#define VIEW_DISTANCE_DEFAULT 2000
	#include "\a3\Functions_F_Heli\Params\paramViewDistance.hpp"

    #include "\a3\Functions_F\Params\paramRevive.hpp"

};
Param templates currently don't work with PBO missions manually copied to MPMissions folder. Unpacked missions, Steam missions and missions which are part of an addon works correctly.

Available Templates

File Description Optional variables
\a3\functions_f\Params\paramCountdown.hpp\a3\functions_f\Params\paramCountdownNoDisabled.hpp Set mission countdown (in seconds)
The "NoDisabled" version has no "disabled" option, and will pick the middle option by default.
#define COUNTDOWN_MIN		600
#define COUNTDOWN_MAX		3600
#define COUNTDOWN_DEFAULT	-1
\a3\functions_f\Params\paramDaytimeHour.hpp Set starting hour, options are represented by whole hours
// Can be any integer between 0 and 23
#define DAYTIMEHOUR_DEFAULT	19
\a3\functions_f\Params\paramDaytimePeriod.hpp Set starting hour, options are described by words
// Can be 0, 6, 12 or 18
#define DAYTIMEPERIOD_DEFAULT	12
\a3\functions_f\Params\paramDebugConsole.hpp Allow debug console for server host or logged in admin
// 0 (disabled) or 1 (enabled)
#define DEBUGCONSOLE_DEFAULT	1
\a3\functions_f\Params\paramGuerFriendly.hpp Set to whom will independent side be friendly
// Can be any -1 (Nobody}, 0 (OPFOR), 1 (BLUFOR) or 2 (Everybody)
#define GUERFRIENDLY_DEFAULT	-1
\a3\functions_f\Params\paramRespawnTickets.hpp\a3\functions_f\Params\paramRespawnTicketsNoDisabled.hpp Set respawn tickets for all sides
The "NoDisabled" version has no "disabled" option, and will pick the middle option by default.
#define TICKETS_MIN			100
#define TICKETS_MAX			1100
#define TICKETS_DEFAULT		-1
\a3\functions_f\Params\paramWeather.hpp Set default weather
// Can be 0 (sunny), 25, 50, 75 or 100 (storm))
#define WEATHER_DEFAULT		75
\a3\Functions_F_MP_Mark\Params\paramTimeAcceleration.hpp Sets a time multiplier for in-game time. See setTimeMultiplier
// Can be x1, x2, x5, x10 or x20
#define TIMEACCELERATION_DEFAULT	10
\a3\Functions_F_Heli\Params\paramViewDistance.hpp Set rendering distance, in meters. See setViewDistance
#define VIEW_DISTANCE_MIN		1500
#define VIEW_DISTANCE_MAX		4000
#define VIEW_DISTANCE_DEFAULT	2000
"\a3\Functions_F\Params\paramRevive.hpp" Set various revive related options Arma 3 Revive


See Also