Mission Parameters – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Comments were the wrong way around)
m (Fix category)
 
(51 intermediate revisions by 10 users not shown)
Line 1: Line 1:
[[Category:Arma 3: Editing|Mission Parameters]]
#REDIRECT [[Mission Parameters]]
 
Server admin / host can customize multiplayer missions in ROLE ASSIGNMENT menu using parameters prepared by the mission designer.
 
== Manual Params ==
=== Config ===
[[File:Arma3 Mission Parameters.png|thumb|Mission Parameters selection]]
Params are defined in [[description.ext]].
class Params
{
class AISkill
{
title = "AI Skill"; {{codecomment|// Param name visible in the list}}
values[] = {0.2,0.6,1}; {{codecomment|// Values; must be integers; has to have the same number of elements as 'texts'}}
texts[] = {"Recruit","Regular","Veteran"}; {{codecomment|// Description of each selectable item}}
default = 0.6; {{codecomment|// Default value; must be listed in 'values' array, otherwise 0 is used}}
};
class Daytime
{
title = "Time";
texts[] = {"Morning","Day","Evening","Night"};
values[] = {6,12,18,0};
default = 12;
function = "BIS_fnc_paramDaytime"; {{codecomment|// (Optional) [[Functions_Library_(Arma_3)|Function]] [[call]]ed when player joins, selected value is passed as an argument}}
  isGlobal = 1; {{codecomment|// (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};
{{codecomment|// When 'texts' are missing, values will be displayed directly instead}}
default = 1000;
file = "setViewDistance.sqf"; {{codecomment|// (Optional) Script [[call]]ed 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 [[PreProcessor_Commands|macros]].
 
class Params
{
#include "\a3\functions_f\Params\paramWeather.hpp"
#define TICKETS_DEFAULT 600
#include "\a3\functions_f\Params\paramRespawnTickets.hpp"
};
 
{{Important|Param templates currently don't work with PBO missions manually copied to MPMissions folder. Unpacked missions, Steam missions and [[Mission_Export#Addon_Format|missions which are part of an addon]] works correctly.}}
 
=== Available Templates ===
{| class="wikitable sortable"
 
! File
! Description
! Optional variables
 
|-
| <code>\a3\functions_f\Params\paramCountdown.hpp</code>
| Set mission countdown (in seconds)
|
#define COUNTDOWN_MIN 600
#define COUNTDOWN_MAX 3600
#define COUNTDOWN_DEFAULT -1
 
|-
| <code>\a3\functions_f\Params\paramDaytimeHour.hpp</code>
| Set starting hour, options are represented by whole hours
|
{{codecomment| //Can be any integer between 0 and 23}}
#define DAYTIMEHOUR_DEFAULT 19
 
|-
| <code>\a3\functions_f\Params\paramDaytimePeriod.hpp</code>
| Set starting hour, options are described by words
|
{{codecomment| //Can be 0, 6, 12 or 18}}
#define DAYTIMEPERIOD_DEFAULT 12
 
|-
| <code>\a3\functions_f\Params\paramDebugConsole.hpp</code>
| Allow [[Mission_Editor:_Debug_Console|debug console]] for logged in admin
|
{{codecomment| //0 (disabled) or 1 (enabled)}}
#define DEBUGCONSOLE_DEFAULT 1
 
|-
| <code>\a3\functions_f\Params\paramGuerFriendly.hpp</code>
| Set to whom will [[independent]] side be friendly
|
{{codecomment| //Can be any -1 (Nobody}, 0 (OPFOR), 1 (BLUFOR) or 2 (Everybody)}}
#define GUERFRIENDLY_DEFAULT -1
 
|-
| <code>\a3\functions_f\Params\paramRespawnTickets.hpp</code>
| Set respawn tickets for all sides
|
#define TICKETS_MIN 100
#define TICKETS_MAX 1100
#define TICKETS_DEFAULT -1
 
|-
| <code>\a3\functions_f\Params\paramWeather.hpp</code>
| Set default weather
|
{{codecomment| //Can be 0 (sunny), 25, 50, 75 or 100 (storm))}}
#define WEATHER_DEFAULT 40
 
|}

Latest revision as of 23:21, 24 June 2022

Redirect to: