Open AndreasBrostrom opened 6 months ago
cScripts Gear are our loadout script strongly inspired and taken from Poppy, our old loadout script. The gear system is rewritten and is greatly tailored to our community needs and have a extra simplification added to it. The loadout utilized a loadout array obtained from ace export loadout or the bis getUnitLoadout
script command. The config also for customizing and can handle abilities and unit cosmetics such as rank and insignia.
Loadouts are automatically applied to units on spawn based on the variable, variableName, classname or side. Loadouts are also saved when altered (See below). Loadouts using Public
scope (See below) in the config will also be present in loadout selectors such as ACE Arsenal default loadouts and [[staging]] and [[starter crate]] selectors.
When you alter your loadout it automatically get saved and reapplied on respawn. The save event is run when you alter the loadout in arsenal or when you close your inventory and only happens when your inside of a defined [[Staging Zone|staging zone]]. All gear related functions will honer the saved loadout. Permissions are also kept based on the core loadout used before the save was committed.
The gear system is quite simple it utilized config values to obtain and apply your loadout.
Loadouts are defined in the CfgLoadouts.hpp
. The system allow loadout application for any side and unit and are inherited from parent classnames.
In order to make loadout for a side can setup a Common<Blufor|Opfor|Independant|Civilian>
baseclass an example for Bluefor side can be found below.
class CommonBlufor {};
class My_Loadout: CommonBlufor {
regiment = "";
company = "";
platoon = -1;
squad = -1;
team = "";
displayName = "";
scope = 0;
category[] = {};
loadout = [[],[],[],[],[],[],"","",[],["","","","","",""]];
equipmentTags[] = {};
icon = "";
insignia = "";
abilityMedic = 0;
abilityEngineer = 0;
abilityEOD = 0;
preLoadout = "";
postLoadout = "";
};
class CommonBlufor {};
class My_Loadout: CommonBlufor {
regiment = ""; // Style value
company = ""; // Used for arsenal whitelist based on side as well as gives your company callsign
platoon = -1; // Used for arsenal whitelist based on side as well as gives your platoon callsign
squad = -1; // Used for arsenal whitelist based on side as well as gives your squad callsign
team = ""; // Used for auto assign unit to a fire team color.
displayName = ""; // Used to make the selection label
scope = 0; // 0 private: not obtainable. 1 protected: can be used but not selected. 2 public: can be selected and used
category[] = {}; // Hardcoded category paths found in ".\cScripts\CavFnc\functions\systems\fn_setupLoadoutCategories.sqf"
loadout = [[],[],[],[],[],[],"","",[],["","","","","",""]]; // loadout array none quoted warped
equipmentTags[] = {}; // Equipment tags
icon = ""; // Style value (use classname of a unit icon)
insignia = ""; // Style value (use classname of a insignia)
abilityMedic = 0; // 0 Nothing, 1 Medic, 2 Doctor
abilityEngineer = 0; // 0 Nothing, 1 Repair Specialists, 2 Engineer
abilityEOD = 0; // 0 Nothing, 1 EOD Specialist
preLoadout = ""; // code that gets applied before loadout and abilities are applied
postLoadout = ""; // code that gets applied after loadout and abilities are applied
};
class CommonBlufor {};
class My_Rifleman_Local: CommonBlufor {
displayName = "Rifleman";
scope = 2;
loadout = [[],[],[],[],[],[],"","",[],["","","","","",""]];
equipmentTags[] = {"BasicSoldierEquipment"};
};
class My_TeamLeader_Local: My_Rifleman_Local {
displayName = "Team Leader";
loadout = [[],[],[],[],[],[],"","",[],["","","","","",""]];
equipmentTags[] += {"TeamLeaderEquipment"};
};
class My_SquadLeader_Local: My_TeamLeader_Local {
displayName = "Squad Leader";
loadout = [[],[],[],[],[],[],"","",[],["","","","","",""]];
equipmentTags[] += {"SquadLeaderEquipment"};
};
class My_SpecialSoldier_Local: CommonBlufor {
displayName = "Engineer";
scope = 2;
abilityEngineer = 2;
loadout = [[],[],[],[],[],[],"","",[],["","","","","",""]];
equipmentTags[] = {"BasicSoldierEquipment", "EngineerEquipment"};
};
Loadouts can be applied in several ways. The main system used is the classname based system but it can also apply to units using variableName, setVariable or side. The loadout also need to be public
or protected
scope to be automatically applied, public
to be select it via a selector.
this setVariable ["cScripts_Gear_LoadoutClass", "Cav_B_C_Rifleman_F"];
You can keep the EDEN selected loadout by adding the following variable to a player unit:
this setVariable ["cScripts_Gear_LoadoutClass", "default"];
In our current setup of our loadouts default
is not defined. This means it will not be applied. A warning of this will be shown in Eden SP and Eden MP.
The arsenal is built automatically when opening the staging variant of the arsenal and utilizes side, company, weapon system and equipmentTags to construct the whitelist.
Equipment tags are defined in CfgEquipmentTags.hpp
and called from a loadout using the equipmentTags[]
array in a CfgLoadouts.hpp
.
The system have some magic collections starting with common
. There are 3 difrent variants side, company, and platoon. The global tag collection common
is always applied to all soldiers. The side based tags are declared by adding the corresponding side; common<Blufor|Opfor|Independant|Civilian>
. Companies are defined as common<Side>Company<CompanyName>
. While platoons have the given platoon number common<Side>Company<CompanyName><PlatoonNumber>
.
It is also possible to make your own equipmentTags by adding a new config entrys (Example: my_custom_equipment_tag[] = {};
).
The system can also auto detect weapons (primary, pistols and launchers) to this in order to automatically provide you with variants and basic items the system uses a prefix followed by the top baseclass of weapon variant. class_<allowed_weapon_baseclass_variant>
.
class CfgEquipmentTags {
common[] = {"G_Aviator"};
commonBlufor[] = {
"rhs_weap_mk18_KAC_bk",
"rhs_weap_mk18_KAC",
"rhs_mag_30Rnd_556x45_M855A1_PMAG_Tracer_Red"
};
commonBluforCompanyCharlie[] = {"ace_banana"};
class_rhs_weap_m4a1[] = {
"rhs_weap_m4a1",
"rhs_weap_m4a1_carryhandle"
};
};
The tag system allow you to make collection and groups of items and you can also reference this collections from other tags by adding their name to the tag.
class CfgEquipmentTags {
collection_all_rifles[] = {
"class_rhs_weap_m4a1",
"class_rhs_weap_m16a4",
"collection_rifle_magazines"
};
class_rhs_weap_m4a1[] = {
"rhs_weap_m4a1",
"rhs_weap_m4a1_carryhandle"
};
class_rhs_weap_m16a4[] = {
"rhs_weap_m16a4",
"rhs_weap_m16a4_carryhandle"
};
collection_rifle_magazines[] = {
"rhs_mag_30Rnd_556x45_M855A1_PMAG",
"rhs_mag_30Rnd_556x45_M855A1_PMAG_Tracer_Red"
};
};
When merged this pull request will:
common
), side (common<side>
), company (common<side>Company<company>
) and platoon (Common<side>Company<company><platoon>
).