R3vo/Sandbox2 – User

From Bohemia Interactive Community
< R3vo
Category: Spearhead 1944
mNo edit summary
Tag: Reverted
mNo edit summary
Tag: Reverted
Line 1: Line 1:
{{Wiki|TODO|⧼Do Stuff⧽}}
The [[Spearhead 1944]] vehicle customization feature allows the player to customize one or multiple selected vehicles and is fully '''multiplayer compatible''' Customization includes:
* Selecting a different vehicle from a defined list
* Changing the paint job, if any are available
* Adjust the parts shown such as additional shields, camo nets or armor
 
In addition to that, each vehicle can have a custom ''Vehicle Description'' displaying additional information to the player.
 
Lastly, each vehicle will have a ''Vehicle Strength''. This value is calculated from the vehicles config ''cost'' property and set into relation of all vehicles that can be selected.


<gallery mode="slideshow">
<gallery mode="slideshow">
Line 10: Line 17:
spe vehicle customization 6.jpg
spe vehicle customization 6.jpg
</gallery>
</gallery>
== Setup ==
For this example we are going to add a [[BIS_fnc_holdActionAdd|hold action]] to two tanks that are then available to all players.
# Place two tanks with the name {{hl|SPE_o_Player_Tank_SP}} and {{hl|SPE_o_Player_Tank_MP}} in [[Eden Editor]]
# Create a file called [[init.sqf]] in the scenario folder, see [[Event Scripts]]
# Paste the following code into the file
<sqf>
#define VEHICLE_CLASSES ["SPE_PzKpfwIII_J", "SPE_PzKpfwIII_L", "SPE_PzKpfwIII_M", "SPE_PzKpfwVI_H1", "SPE_Jagdpanther_G1"]
#define VEHICLE_DESCRIPTIONS ["STR_SPE_DESC_PZKPFWIII_J", "STR_SPE_DESC_PZKPFWIII_L", "STR_SPE_DESC_PZKPFWIII_M", "STR_SPE_DESC_PZKPFWVI_H1", "STR_SPE_DESC_JAGDPANTHER_G1"]
{
    _x addAction
    [
        localize "STR_SPE_UTILITYFUNCTIONS_VEHICLECUSTOMIZATION_ACTION_TITLE",
        {
            params ["_target"];
            [
                "init",
                _target,
                VEHICLE_CLASSES,
                VEHICLE_DESCRIPTIONS,
                ["SPE_GroupID"]
            ] call SPE_missionUtilityFunctions_fnc_vehicleCustomization;
        },
        nil,
        500,
        true,
        true,
        "",
        "!(_target inArea 'SPE_m_mission_area')",
        15
    ];
} forEach [SPE_o_Player_Tank_SP, SPE_o_Player_Tank_MP];
</sqf>
# Preview the scenario and approach one of the tanks
# Now select the action entry and open the menu
== Function Documentation ==
<sqf inline>[_mode, _vehicle, _vehicleClasses, _vehicleDescriptions, _variablesToCopy, _params] call SPE_missionUtilityFunctions_fnc_vehicleCustomization;</sqf>
* _mode - [[String]]: Defines the mode. Use '''init''' to open the UI. The other modes are used internally.
* _vehicle - [[Object]]: Defines the vehicle that can be customized
* _vehicleClasses - [[Array]] of [[String]]s: The vehicle classes that will be available for selection
* _vehicleDescriptions - [[Array]] of [[String]]s: The description for each vehicle class. Order needs to match the order of ''_vehicleClasses''
* _variablesToCopy - [[Array]] of [[String]]s: Variables that will be copied upon switching the vehicle. These variables will automatically be made public
* _params - [[Array]] - '''Internal use only!'''
== Restrictions ==
Some limitations were implemented to prevent fauly behaviour. These consist of:
* The vehicle needs to be [[alive]]
* There must be at least one vehicle class defined
* The [[speed]] of the vehicle needs to be smaller than 1
* Only one player at a time can customize a vehicle
* In [[isMultiplayer|multiplayer]] the vehicle has to be empty
* In [[isMultiplayer|multiplayer]] only one player can customize a vehicle
'''Appropriate [[hint]]s are displayed to inform the player why customization is currently not possible'''


[[Category:Spearhead 1944]]
[[Category:Spearhead 1944]]

Revision as of 11:13, 5 July 2025

The Spearhead 1944 vehicle customization feature allows the player to customize one or multiple selected vehicles and is fully multiplayer compatible Customization includes:

  • Selecting a different vehicle from a defined list
  • Changing the paint job, if any are available
  • Adjust the parts shown such as additional shields, camo nets or armor

In addition to that, each vehicle can have a custom Vehicle Description displaying additional information to the player.

Lastly, each vehicle will have a Vehicle Strength. This value is calculated from the vehicles config cost property and set into relation of all vehicles that can be selected.

Setup

For this example we are going to add a hold action to two tanks that are then available to all players.

  1. Place two tanks with the name SPE_o_Player_Tank_SP and SPE_o_Player_Tank_MP in Eden Editor
  2. Create a file called init.sqf in the scenario folder, see Event Scripts
  3. Paste the following code into the file

#define VEHICLE_CLASSES ["SPE_PzKpfwIII_J", "SPE_PzKpfwIII_L", "SPE_PzKpfwIII_M", "SPE_PzKpfwVI_H1", "SPE_Jagdpanther_G1"] #define VEHICLE_DESCRIPTIONS ["STR_SPE_DESC_PZKPFWIII_J", "STR_SPE_DESC_PZKPFWIII_L", "STR_SPE_DESC_PZKPFWIII_M", "STR_SPE_DESC_PZKPFWVI_H1", "STR_SPE_DESC_JAGDPANTHER_G1"] { _x addAction [ localize "STR_SPE_UTILITYFUNCTIONS_VEHICLECUSTOMIZATION_ACTION_TITLE", { params ["_target"]; [ "init", _target, VEHICLE_CLASSES, VEHICLE_DESCRIPTIONS, ["SPE_GroupID"] ] call SPE_missionUtilityFunctions_fnc_vehicleCustomization; }, nil, 500, true, true, "", "!(_target inArea 'SPE_m_mission_area')", 15 ]; } forEach [SPE_o_Player_Tank_SP, SPE_o_Player_Tank_MP];

  1. Preview the scenario and approach one of the tanks
  2. Now select the action entry and open the menu

Function Documentation

[_mode, _vehicle, _vehicleClasses, _vehicleDescriptions, _variablesToCopy, _params] call SPE_missionUtilityFunctions_fnc_vehicleCustomization;

  • _mode - String: Defines the mode. Use init to open the UI. The other modes are used internally.
  • _vehicle - Object: Defines the vehicle that can be customized
  • _vehicleClasses - Array of Strings: The vehicle classes that will be available for selection
  • _vehicleDescriptions - Array of Strings: The description for each vehicle class. Order needs to match the order of _vehicleClasses
  • _variablesToCopy - Array of Strings: Variables that will be copied upon switching the vehicle. These variables will automatically be made public
  • _params - Array - Internal use only!

Restrictions

Some limitations were implemented to prevent fauly behaviour. These consist of:

  • The vehicle needs to be alive
  • There must be at least one vehicle class defined
  • The speed of the vehicle needs to be smaller than 1
  • Only one player at a time can customize a vehicle
  • In multiplayer the vehicle has to be empty
  • In multiplayer only one player can customize a vehicle

Appropriate hints are displayed to inform the player why customization is currently not possible