Mission Parameters – Arma 3
Killzone Kid (talk | contribs) (overview) |
Killzone Kid (talk | contribs) (params (wip)) |
||
Line 14: | Line 14: | ||
In any case, a person selecting parameters from parameters menu at the beginning of the mission has the final say what those options will be. | In any case, a person selecting parameters from parameters menu at the beginning of the mission has the final say what those options will be. | ||
== Param Types == | |||
There are 2 types of parameters, primary and secondary. While primary parameters are inherited from earlier versions of Arma, they are still valid and recognised by the engine. | |||
=== Primary Params === | |||
Also known as '''param1''' and '''param2'''. They are defined in the following way in [[description.ext]], for example: | |||
<syntaxhighlight lang="cpp"> | |||
titleParam1 = "Time limit:"; | |||
textsParam1[] = {"Unlimited", "5 min", "10 min", "15 min"}; | |||
valuesParam1[] = {0, 300, 600, 900}; | |||
defValueParam1 = 900; | |||
titleParam2 = "Score to win:"; | |||
textsParam2[] = {"Don't keep score", "50", "100", "150"}; | |||
valuesParam2[] = {0, 50, 100, 150}; | |||
defValueParam2 = 50; | |||
</syntaxhighlight> | |||
Here is some info about each entry and what it means: | |||
* titleParam - This is tile that will be displayed in parameters menu available to server admin or host at Role Selection | |||
* textsParam - This are options presented to the server admin or host when they double click on the title in the parameters menu | |||
* valuesParam - This are the actual param values for each of the text options, that will be passed to the mission accordingly to chosen option | |||
* defValueParam - This is default option which would be passed to the mission if no selection was made. It '''must''' match one of the ''valuesParam'' values | |||
The chosen option value will be stored in '''param1''' or '''param2''' variable (respectfully) and then broadcast to everyone as [[publicVariable]]. As mentioned before, ''defValueParam'' value can be overridden from the server config. Here is an example of such override for both params in [[server.cfg]]: | |||
<syntaxhighlight lang="cpp"> | |||
class Missions | |||
{ | |||
class Mission1 | |||
{ | |||
template = "Mission1.Altis"; | |||
difficulty = "Veteran"; | |||
param1 = 600; | |||
param2 = 100; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
As with ''defValueParam'' provided override values '''must''' match one of the ''valuesParam'' values. The logged admin during Role Selection phase can still override even server override by selection option from parameters UI. | |||
== Manual Params == | == Manual Params == |
Revision as of 18:36, 25 December 2015
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
Overview
Mission parameters are integer values that are passed to the mission at the beginning and which are used by the mission designer to customise user experience accordingly. The parameters are set in description.ext. They can also be either manually altered by a dedicated server admin or host during ROLE ASSIGNMENT in MP lobby from available parameters menu or by including override values in dedicated server config server.cfg. In short:
- Mission maker can set up a list of parameters for the game and set default values for each
- Dedicated server admin or host can change default values by selection different options from provided parameters menu
- Dedicated server owner can additionally override the default values in server config for each mission separately
In any case, a person selecting parameters from parameters menu at the beginning of the mission has the final say what those options will be.
Param Types
There are 2 types of parameters, primary and secondary. While primary parameters are inherited from earlier versions of Arma, they are still valid and recognised by the engine.
Primary Params
Also known as param1 and param2. They are defined in the following way in description.ext, for example:
titleParam1 = "Time limit:";
textsParam1[] = {"Unlimited", "5 min", "10 min", "15 min"};
valuesParam1[] = {0, 300, 600, 900};
defValueParam1 = 900;
titleParam2 = "Score to win:";
textsParam2[] = {"Don't keep score", "50", "100", "150"};
valuesParam2[] = {0, 50, 100, 150};
defValueParam2 = 50;
Here is some info about each entry and what it means:
- titleParam - This is tile that will be displayed in parameters menu available to server admin or host at Role Selection
- textsParam - This are options presented to the server admin or host when they double click on the title in the parameters menu
- valuesParam - This are the actual param values for each of the text options, that will be passed to the mission accordingly to chosen option
- defValueParam - This is default option which would be passed to the mission if no selection was made. It must match one of the valuesParam values
The chosen option value will be stored in param1 or param2 variable (respectfully) and then broadcast to everyone as publicVariable. As mentioned before, defValueParam value can be overridden from the server config. Here is an example of such override for both params in server.cfg:
class Missions
{
class Mission1
{
template = "Mission1.Altis";
difficulty = "Veteran";
param1 = 600;
param2 = 100;
};
};
As with defValueParam provided override values must match one of the valuesParam values. The logged admin during Role Selection phase can still override even server override by selection option from parameters UI.
Manual Params
Config
Params are defined in description.ext.
class Params { class AISkill { title = "AI Skill"; // Param name visible in the list values[] = {20,60,100}; // Values; must be integers; has to have the same number of elements as 'texts' texts[] = {"Recruit","Regular","Veteran"}; // Description of each selectable item default = 60; // 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.cfg (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 = paramsArray select 0; { _x setSkill _skill; } forEach allUnits; };
setViewDistance.sqf:
setViewDistance (_this select 0);
Functions
When you're not sure about order of paramsArray items (e.g., in a module which can be used in any mission), you can use BIS_fnc_getParamValue to get value of a param with given classname.
_viewDistance = "ViewDistance" 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.
class Params { #include "\a3\functions_f\Params\paramWeather.hpp" #define TICKETS_DEFAULT 600 #include "\a3\functions_f\Params\paramRespawnTickets.hpp" };
Available Templates
File | Description | Optional variables |
---|---|---|
\a3\functions_f\Params\paramCountdown.hpp
|
Set mission countdown (in seconds) |
#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 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
|
Set respawn tickets for all sides |
#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 40
|
\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 |