R3vo/Sandbox2 – User

From Bohemia Interactive Community
< R3vo
Categories:
m (Replaced content with "350px|thumb|The parameter UI|right Single Player Mission Parameters Spearhead 1944 introduced a system that allows players to use Arma 3: Mission Parameters also in single player scenarios. The system will automatically: * Read the mission parameters * Fill a UI appropriately * Execute the parameter code according to the player selection == Scenario Setup == 1. Define Arma 3: Mission Parameters as u...")
Tags: Replaced Reverted
m (Blanked the page)
Tags: Blanking Manual revert
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File: spe singleplayer mission parameters ui.jpg|350px|thumb|The parameter UI|right]]


Single Player Mission Parameters
[[Spearhead 1944]] introduced a system that allows players to use [[Arma 3: Mission Parameters]] also in single player scenarios. The system will automatically:
* Read the mission parameters
* Fill a UI appropriately
* Execute the parameter code according to the player selection
== Scenario Setup ==
1. Define [[Arma 3: Mission Parameters]] as usual in the [[description.ext]].
<syntaxhighlight lang="cpp">
class Params
{
class Environment_Header // If the class name contains either "header", "separator", "title" or "spacer" it will be formatted as a header and not treated as an actual parameter
{
title = "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_ENVIRONMENT_HEADER";
texts[] = {""};
values[] = {0};
default = 0;
};
class Daytime
{
title = __EVAL("      " + localize "$STR_A3_CFGVEHICLES_MODULEDATE_F_ARGUMENTS_HOUR_0"); // The indentation here is for the multiplayer parameters UI, the singleplayer UI will trim the title and no spaces before and after the text are added
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};
texts[] = {"00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"};
default = 5;
// function = "BIS_fnc_paramDaytime";
function = "SPE_PZKW_fnc_paramDaytime";
isGlobal = 0;
tooltip = "A tooltip"; // The tooltip propery is not available in the vanilla parameter system but is for the custom singleplayer system
ignoreInSingleplayer = 1; // If this is set to 1, the parameters will not be executed in single player
};
};
</syntaxhighlight>
<spoiler text="Full Example">
<syntaxhighlight lang="cpp">
class Params
{
class Environment_Header
{
title = "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_ENVIRONMENT_HEADER";
texts[] = {""};
values[] = {0};
default = 0;
};
class Daytime
{
title = __EVAL("      " + localize "$STR_A3_CFGVEHICLES_MODULEDATE_F_ARGUMENTS_HOUR_0");
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};
texts[] = {"00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"};
default = 5;
// function = "BIS_fnc_paramDaytime";
function = "SPE_PZKW_fnc_paramDaytime";
isGlobal = 0;// Run only on server
};
class Weather
{
title = __EVAL("      " + localize "$STR_A3_RSCATTRIBUTEOVERCAST_TITLE");
values[] = {0, 25, 50, 75, 100};
texts[] =
{
"$STR_A3_RSCATTRIBUTEOVERCAST_VALUE000_TOOLTIP", // 0 (Clear)
"$STR_A3_RSCATTRIBUTEOVERCAST_VALUE025_TOOLTIP", // 25 (Cloudy)
"$STR_A3_RSCATTRIBUTEOVERCAST_VALUE050_TOOLTIP", // 50 (Overcast)
"$STR_A3_RSCATTRIBUTEOVERCAST_VALUE075_TOOLTIP", // 75 (Rainy)
"$STR_A3_RSCATTRIBUTEOVERCAST_VALUE100_TOOLTIP"  // 100 (Stormy)
};
default = 0;
// function = "SPE_missionUtilityFunctions_fnc_paramWeather";
function = "SPE_PZKW_fnc_paramWeather";
isGlobal = 0;// Run only on server
};
class Fog
{
title = __EVAL("      " + localize "$STR_A3_PARAM_FOG_TITLE");
values[] = {0, 1, 2, 3, 4};
texts[] =
{
"$STR_A3_PARAM_FOG_0", //"None"
"$STR_A3_PARAM_FOG_1", //"Light"
"$STR_A3_PARAM_FOG_2", //"Medium"
"$STR_A3_PARAM_FOG_3", //"Heavy"
"$STR_A3_PARAM_FOG_4"  //"Infantry Only"
};
default = 0;
function = "SPE_PZKW_fnc_paramFogGlobal";
isGlobal = 0;// Run only on server
};
class TimeAcceleration
{
title = __EVAL("      " + localize "$STR_USRACT_TIME_INC");
values[] = {1, 2, 5, 10, 20};
texts[] = {"x1", "x2", "x5", "x10", "x20"};
default = 1;
// function = "BIS_fnc_paramTimeAcceleration";
function = "SPE_PZKW_fnc_paramTimeAcceleration";
isGlobal = 0;// Run only on server
};
class ViewDistance
{
title = __EVAL("      " + localize "$STR_A3_PARAMVIEWDISTANCE_TITLE");
values[] = {500, 1000, 1500, 2000, 2500, 3000, 3500, 4000};
texts[] = {"500m", "1000m", "1500m", "2000m", "2500m", "3000m", "3500m", "4000m"};
default = 1000;
function = "SPE_PZKW_fnc_paramViewDistanceSPandMP";
isGlobal = 1;// Run on server + clients
};
class RemoveTrees
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_REMOVETREES");
values[] = {0, 1, 2, 3, 4, 5, 6, 7};
texts[] = {$STR_DISABLED, "10%", "20%", "30%", "40%", "50%", "60%", "70%"};
default = 4;
function = "SPE_PZKW_fnc_paramRemoveTreesGlobal";
isGlobal = 0;// Run only on server
};
class RemoveBoulders
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_REMOVE_BOULDERS");
values[] = {0, 1};
texts[] = {$STR_DISABLED, $STR_ENABLED};
default = 1;
function = "SPE_PZKW_fnc_paramRemoveBouldersGlobal";
isGlobal = 1;// Run on server + clients
};
class RemoveWalls: RemoveBoulders
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_REMOVE_WALLS");
function = "SPE_PZKW_fnc_paramRemoveWallsGlobal";
isGlobal = 1;// Run on server + clients
};
class RemoveBocage: RemoveBoulders
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_REMOVE_BOCAGE");
function = "SPE_PZKW_fnc_paramRemoveBocageGlobal";
isGlobal = 1;// Run on server + clients
};
class Difficulty_Header: Environment_Header
{
title = "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_DIFFICULTY_HEADER";
};
class HunterGroupCount
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_NUMBER_OF_HUNTER_SQUADS");
values[] = {0, 1, 2, 3, 4};
texts[] = {$STR_DISABLED, "1", "2", "3", "4"};
default = 1;
};
class RespawnTickets
{
title = __EVAL("      " + localize "$STR_A3_PARAMRESPAWNTICKETS_TITLE");
values[] = {0, 6, 12, 18, 24, 30, 36};
texts[] = {$STR_DISABLED, "6", "12", "18", "24", "30", "36"};
default = 3;
// function = "BIS_fnc_paramRespawnTickets";
function = "SPE_PZKW_fnc_paramRespawnTickets";
isGlobal = 0;// Run only on server
ignoreInSingleplayer = 1;
};
class GroupIcons
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_SHOW_GROUP_ICONS");
tooltip = "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_SHOW_GROUP_ICONS_TOOLTIP";
values[] = {0, 1, 2};
texts[] = {$STR_DISABLED, "2D", "2D + 3D"};
default = 1;
function = "SPE_PZKW_fnc_paramGroupIcons";
isGlobal = 1;// Run on server + clients
};
class VehicleVisualization
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_VV");
values[] = {0, 1};
texts[] = {$STR_DISABLED, $STR_ENABLED};
default = 1;
function = "SPE_PZKW_fnc_paramVehicleVisualization";
isGlobal = 1;// Run on server + clients
};
class Autosaving
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_AUTOSAVING");
values[] = {0, 1};
texts[] = {$STR_DISABLED, $STR_ENABLED};
default = 1;
};
class HelperTasks
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_HELPER_TASKS");
values[] = {0, 1};
texts[] = {$STR_DISABLED, $STR_ENABLED};
default = 1;
};
  #include "paramsRepairAction.inc"
class Misc_Header: Environment_Header
{
title = "$STR_SPE_MISSIONS_SCENARIOS_PARAMETER_MISC_HEADER";
};
class VoiceActingVolume
{
title = __EVAL("      " + localize "$STR_SPE_MISSIONS_CAMPAIGNS_SHARED_PARAMETER_TITLE_DEFAULT_VOICE_ACTING_VOLUME");
texts[] = {"$STR_SPE_MISSIONS_CAMPAIGNS_SHARED_PARAMETER_TEXT_MUTE","25%","50%","75%","100%"};
values[] = {0, 25, 50, 75, 100};
default = 100;
};
};
</syntaxhighlight>
</spoiler>
{{Feature|informative|Note that the code will automatically select the best control type for each parameter.}}
2. Create a function in [[Arma 3: Functions Library]] that is executed on {{hl|preInit}}. Put the following code in it <sqf inline>BIS_fnc_initParams_skip = true;</sqf>. This ensures that the vanilla mission parameter behaviour is disabled. Otherwise changes in our UI will have no effect or parameter code gets executed twice.

Latest revision as of 12:19, 27 July 2025