Jump to content

Recommended Posts

Hi!

 

My first post here.

I've recently had to take charge of a group's server side dealings and I have no clue how to make it work. I've searched these forums without success (pretty sure I just don't know what to look for).
Anyway our groups loadouts are made in each separate SQF file and then used with "add action". The inside of the SQF is copy-paste from the BI Arsenal with this replaced with player.

 

I'd like to know if its possible to make a list of uniforms and the script would pick one uniform from that list at random, while using the same SQF files.

Another question is if anyone has any good tips on how to make a loadout selector thingymajeeg? Like I said we currently have a SQF file for each loadout and then we compile those add actions into a inanimate NPC to know which loadout we are dealing with.

 

 

Keep in mind I'm green as a leprechaun's hat when it comes to scripting in Arma.

 

Thanks in advance for the answers.

D


EDIT! I managed to find a post from last year and got it to work.
Second question still stands though

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Beside of a ready to use script/mod, do you use the ace-arsenal to make the loadouts or the BI_Arsenal?

 

Second Question:

Do you want the players automatically have the items equipped? (from eden already?) If yes, you need within your "mission.Land" (example: awesomemission.Altis) a file thats named "description.ext"

Put in the first line:

respawnOnStart = -1; // Default: 0, -1 = no respawn on start

 

So you dont respawn on mission start, and you pretty much start with exactly the eden-outfit.

 

You can do it also with a respawn event, if you want, that players get their exact equipment when respawning. Then you need, within your mission-folder (mission.land, ex.: awesomemission.Altis) a file called "onPlayerRespawn.sqf"

Within that file you can use something like this:

// Prefab (Empty)
//    if (player isKindOf "unitclassname") then {
//        [player] execVM "scripts\loadouts\yourloadoutname.sqf";
//    };

 

Example:

// Asst. Autoriflemen (MG-Helfer)
    if (player isKindOf "B_soldier_AAR_F") then {
        [player] execVM "scripts\loadouts\stan_asstautorifle.sqf";
    };

 

Depending on what export-function you use, it is used differently. For an example i would need the ace or bi-question solved ^^

 

Have a good time, stay crunchy.

 

Narsiph.

  • Like 2

Share this post


Link to post
Share on other sites
12 hours ago, Narsiph said:

Beside of a ready to use script/mod, do you use the ace-arsenal to make the loadouts or the BI_Arsenal?

Already answered:

17 hours ago, aDIRTYnurse said:

The inside of the SQF is copy-paste from the BI Arsenal with this replaced with player.

 

 

12 hours ago, Narsiph said:

Do you want the players automatically have the items equipped? (from eden already?)

Already answered:

17 hours ago, aDIRTYnurse said:

and then used with "add action"

 

 

 

 

 

17 hours ago, aDIRTYnurse said:

if its possible to make a list of uniforms and the script would pick one uniform from that list at random

replace

player addUniform "uniformclassname"

with

player addUniform selectRandom ["uniformClassname2", "classname2", "classname3", "classname4"]

 

 

17 hours ago, aDIRTYnurse said:

Another question is if anyone has any good tips on how to make a loadout selector thingymajeeg?

Multiple addActions are already a loadout selector. What do you have in mind?

Share this post


Link to post
Share on other sites

This is one of the loadout scripts my group uses.

Quote

comment "Remove existing items";
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;

comment "Add weapons";
_rifle = ["rhs_weap_m4a1_blockII", 0.48, "rhs_weap_m4a1_blockII_KAC", 0.48, "rhs_weap_m4a1", 0.02, "rhs_weap_mk18", 0.02] call BIS_fnc_selectRandomWeighted;
player addWeapon _rifle;
_array = ["rhsusf_acc_M952V", "acc_flashlight", "rhsusf_acc_wmx", "rhsusf_acc_wmx_bk"];
_rail = selectRandom _array;
player addPrimaryWeaponItem _rail;
_optic = ["rhsusf_acc_eotech_552", 0.70, "rhsusf_acc_compm4", 0.20, "rhsusf_acc_ACOG_RMR", 0.10] call BIS_fnc_selectRandomWeighted;
player addPrimaryWeaponItem _optic;

comment "Add containers";
player forceAddUniform "milgp_u_g3_field_set_mc";
player addItemToUniform "ACE_epinephrine";
for "_i" from 1 to 5 do {player addItemToUniform "ACE_elasticBandage";};
for "_i" from 1 to 3 do {player addItemToUniform "ACE_tourniquet";};
player addItemToUniform "ACE_CableTie";
player addItemToUniform "ACE_EarPlugs";
player addItemToUniform "ACE_Flashlight_MX991";
player addItemToUniform "ACE_MapTools";
player addItemToUniform "B_IR_Grenade";
player addItemToUniform "Chemlight_green";
player addItemToUniform "ACE_Chemlight_IR";
player addItemToUniform "Chemlight_red";
_vest = ["rhsusf_spcs_ocp_rifleman", 0.45, "rhsusf_spcs_ocp_rifleman_alt", 0.45, "rhsusf_iotv_ocp_Rifleman", 0.10] call BIS_fnc_selectRandomWeighted;
player addVest _vest;
player addItemToVest "ACE_microDAGR";
for "_i" from 1 to 2 do {player addItemToVest "HandGrenade";};
player addItemToVest "ACE_EntrenchingTool";
for "_i" from 1 to 2 do {player addItemToVest "SmokeShell";};
player addItemToVest "SmokeShellBlue";
for "_i" from 1 to 8 do {player addItemToVest "rhs_mag_30Rnd_556x45_Mk318_Stanag";};
_array = ["rhsusf_ach_helmet_ocp_norotos", "rhsusf_ach_helmet_camo_ocp", "rhsusf_ach_helmet_headset_ess_ocp", "rhsusf_ach_helmet_headset_ocp", "rhsusf_ach_helmet_ESS_ocp", "rhsusf_ach_helmet_ocp"];
_helmet = selectRandom _array;
player addHeadgear _helmet;

comment "Add items";
player linkItem "ItemMap";
player linkItem "ItemCompass";
player linkItem "tf_microdagr";
player linkItem "tf_anprc152";
player linkItem "ItemGPS";
player linkItem "rhsusf_ANPVS_14";


player setSpeaker "ACE_NoVoice";

player setVariable ["ACE_GForceCoef", 1];

[[player],"ace_medical_medicClass", 1, true] call ace_common_fnc_assignObjectsInList;
[[player],"ACE_IsEngineer", 0, true] call ace_common_fnc_assignObjectsInList;

 

I need help with a if function with a specific primary weapon condition.
If after the weapon selection the primary weapon is rhs_weap_m4a1 then it would add a primaryWeaponItem, for example.

If that condition is not met, then it would run just as is.

 

Thanks for any help

Share this post


Link to post
Share on other sites

In the  Leadout you write:  remove....

Can i only say: AddItem... Without clear it first ? I think its Overwrite the Old loadout... Am i right ?

Share this post


Link to post
Share on other sites
On 6/30/2019 at 11:04 PM, Schokodiva said:

In the  Leadout you write:  remove....

Can i only say: AddItem... Without clear it first ? I think its Overwrite the Old loadout... Am i right ?

You have to clear out the loadout before you start adding items to it; otherwise you will end up with vanilla loadouts or whatever loads your base player model faction is from.

Share this post


Link to post
Share on other sites

I do this in the editor edit loadout/arsenal thing ctr shit c exports the loadout in sqf format like this.

 


// Exported from Arsenal
uniformClass = "U_BG_Guerilla2_1";
backpack = "B_FieldPack_taiga_F";
weapons[] = {"uns_ak47","CUP_hgun_Deagle","uns_binocular_army","Throw","Put"};
magazines[] = {"uns_ak47mag","CUP_7Rnd_50AE_Deagle","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_mk2gren","uns_mk2gren","CUP_7Rnd_50AE_Deagle","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_leaflet12","uns_item_condoms"};
items[] = {"FirstAidKit","UNS_TrapKit","ToolKit","FirstAidKit","FirstAidKit","FirstAidKit"};
linkedItems[] = {"CUP_V_OI_TKI_Jacket5_01","CUP_H_USArmy_Helmet_M1_plain_M81","CUP_G_Oakleys_Drk","ItemMap","ItemCompass","ItemWatch"};

Now if you have a scope on the weapon it has to be added in linked items, else you won't have it. Now you have to make a file called loadouts.cpp or whatever you want to name it as long as you keep the dot cpp part. It will have to have other parts as well not just the loadout. You can get the scope classname by hitting CTRL C and pasting the result into a regular old text file cause it won't be in SQF format

 

class CfgRoles
{
class east1
{
displayName = "Rebel Rifleman";
};
class east2
{
displayName = "Rebel Sapper Miner";  

};  <-- important LOL
///////these are from a scenario I'm making, name the loadout whatever you want but but do keep that class part. You can have as many as you want. east, west, civilian has to be spelled out and the green team has to be resistance, not shortened as far as I know, it can't be. 
        
        

Next is class CfgRespawnInventory, all in the same file but I separated it.

 

class CfgRespawnInventory
{

class east1
{
displayName = "Rebel Rifleman"; // Name visible in the menu
role = "east1";
// Loadout definition, uses same entries as CfgVehicles classes
uniformClass = "U_BG_Guerilla2_1";
backpack = "B_FieldPack_taiga_F";
weapons[] = {"uns_ak47","CUP_hgun_Deagle","uns_binocular_army","Throw","Put"};
magazines[] = {"uns_ak47mag","CUP_7Rnd_50AE_Deagle","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_mk2gren","uns_mk2gren","CUP_7Rnd_50AE_Deagle","uns_ak47mag_NT","uns_ak47mag_NT","uns_ak47mag_NT","uns_leaflet12","uns_item_condoms"};
items[] = {"FirstAidKit","UNS_TrapKit","ToolKit","FirstAidKit","FirstAidKit","FirstAidKit"};
linkedItems[] = {"CUP_V_OI_TKI_Jacket5_01","CUP_H_USArmy_Helmet_M1_plain_M81","CUP_G_Oakleys_Drk","ItemMap","ItemCompass","ItemWatch"};

};

class east2
{
displayName = "Rebel Sapper Miner"; // Name visible in the menu
role = "east2";

// Exported from Arsenal by
uniformClass = "U_BG_Guerilla2_1";
backpack = "CUP_B_CivPack_WDL";
weapons[] = {"uns_svt","uns_rpg7","uns_binocular_navy","Throw"};
magazines[] = {"uns_svtmag","uns_rpg7grenade","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","uns_svtmag","SmokeShell","SmokeShell","SmokeShell","SmokeShell","DemoCharge_Remote_Mag","uns_mine_TM_mag","PipeBomb","DemoCharge_Remote_Mag","DemoCharge_Remote_Mag"};
items[] = {"FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit"};
linkedItems[] = {"CUP_V_B_GER_Carrier_Rig_2_Brown","CUP_H_USArmy_Helmet_M1_plain_M81","CUP_G_Oakleys_Drk","ItemMap","ItemCompass","ItemWatch"};


}; 
}; 

Only 2 here and only 1 side. The sides aren't separated by anything but make sure you put the extra }; at the very end of the file. Also remember the scopes on the rifles have to added in the linked items part. You can get the scope classname by hitting CTRL C and pasting the result into a regular old text file cause it won't be in SQF format.All of that should be saved as loadout.cpp.

 

Now in your description.ext file you put this

respawnTemplateseast[] = {"MenuInventory","MenuPosition"};
respawnTemplateswest[] = {"MenuInventory","MenuPosition"};



#include "loadout.cpp"  
Quote

 

Now in your init.sqf you need to put this to create the respawn inventory thing the game needs to do the whole thing. Also include the respawn on start so you respawn or you might end up with the default inventory or no inventory since the guy in my scenario actually have nothing.

respawnOnStart = 1;
[east, "east1"] call BIS_fnc_addRespawnInventory;
[east, "east2"] call BIS_fnc_addRespawnInventory;


//this is in your init.sqf file

THIS is the one thing I never get wrong, I've made scenarios with 24 loadouts, 12 a side, they all work selectable from this screen.I used to know how to put images in here

 

https://images2.imgbox.com/1f/3d/TyASjwX1_o.jpg

 

TyASjwX1_t.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Good job there @Alleged Accomplice I haven't thought of doing it that way but I have seen it done before and it works nicely. I put my loadout script in the spoiler below. I create a loadout folder and place the following into a text file then rename it to the name of the slot (example is as follows: SEAL_TeamLead.sqf) and then I place the following into the init line of the players character in the editor. Example: ([this,"SEAL_TeamLead"] execVM "loadouts\SEAL_Teamlead.sqf";) and it runs when the person loads into that slot.
 

Spoiler

//comment "Exported from Arsenal by Nichols";
//[this,"SEAL_TeamLead"] execVM "loadouts\SEAL_Teamlead.sqf";

waitUntil {!isNull player};
_unit = _this select 0;

//comment "Remove existing items";
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;

//comment "Add containers";
_this forceAddUniform "VSM_MulticamTropic_Camo_SS";
_this addItemToUniform "ACE_Flashlight_XL50";
_this addItemToUniform "ACE_MapTools";
_this addItemToUniform "ACE_microDAGR";
_this addItemToUniform "ACE_plasmaIV_500";
_this addItemToUniform "ACE_EarPlugs";
for "_i" from 1 to 3 do {_this addItemToUniform "ACE_epinephrine";};
for "_i" from 1 to 3 do {_this addItemToUniform "ACE_morphine";};
for "_i" from 1 to 10 do {_this addItemToUniform "ACE_packingBandage";};
for "_i" from 1 to 4 do {_this addItemToUniform "ACE_tourniquet";};
for "_i" from 1 to 15 do {_this addItemToUniform "ACE_elasticBandage";};
for "_i" from 1 to 2 do {_this addItemToUniform "ACE_CableTie";};
for "_i" from 1 to 2 do {_this addItemToUniform "ACE_IR_Strobe_Item";};
_this addVest "VSM_LBT6094_operator_multicamTropic";
for "_i" from 1 to 3 do {_this addItemToVest "hlc_13Rnd_9x19_B_P228";};
for "_i" from 1 to 6 do {_this addItemToVest "SMA_30Rnd_68x43_BT";};
for "_i" from 1 to 5 do {_this addItemToVest "SMA_30Rnd_68x43_BT_IR";};
for "_i" from 1 to 2 do {_this addItemToVest "SmokeShell";};
for "_i" from 1 to 4 do {_this addItemToVest "ACE_M84";};
for "_i" from 1 to 2 do {_this addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_this addItemToVest "SmokeShellGreen";};
for "_i" from 1 to 2 do {_this addItemToVest "SmokeShellPurple";};
for "_i" from 1 to 2 do {_this addItemToVest "SmokeShellRed";};
_this addBackpack "VSM_MulticamTropic_Backpack_Kitbag";
_this addItemToBackpack "tfw_rf3080Item";
_this additemtoBackpack "VSM_MulticamTropic_Boonie";
for "_i" from 1 to 6 do {_this addItemToBackpack "Laserbatteries";};
_this addHeadgear "VSM_MulticamTropic_OPS_2";

//comment "Add weapons";
_this addWeapon "SMA_ACRREMMOECQBblk";
_this addPrimaryWeaponItem "SMA_supp1BOD_556";
_this addPrimaryWeaponItem "SMA_SFPEQ_ACRTOP_BLK";
_this addPrimaryWeaponItem "optic_DMS";
_this addPrimaryWeaponItem "SMA_Gripod_01";
_this addWeapon "hlc_pistol_P229R_Combat";
_this addHandgunItem "hlc_muzzle_TiRant9S";
_this addHandgunItem "hlc_acc_TLR1";
_this addHandgunItem "HLC_optic228_Siglite";
_this addWeapon "Laserdesignator_01_khk_F";

//comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "tf_anprc152";
_this linkItem "ItemGPS";
_this linkItem "A3_GPNVG18b_REC_BLK_F";

//comment "Set Medical Class";
_this setVariable ["ace_medical_medicClass",2];

 

 

Share this post


Link to post
Share on other sites
7 hours ago, Nichols said:

Good job there @Alleged Accomplice I haven't thought of doing it that way but I have seen it done before and it works nicely. I put my loadout script in the spoiler below. I create a loadout folder and place the following into a text file then rename it to the name of the slot (example is as follows: SEAL_TeamLead.sqf) and then I place the following into the init line of the players character in the editor. Example: ([this,"SEAL_TeamLead"] execVM "loadouts\SEAL_Teamlead.sqf";) and it runs when the person loads into that slot

 

I don't do anything to the init of the soldier. If I respawn on start I don't need to, it loads the loadout from the file.

 

Totally different from my supply vehicle/APC/truck respawn script where the truck has to have it in the init. I did the kind of script you have there. I got the truck script from here in the forums. 

 

If you are doing two, four, loadouts on soldiers what your are doing doesn't take too long. I did 24 that way, took some time, then I found out about Ctrl Shift C and it comes out in SQF format and all I might have to do is add the scope/optic in the linked items. I have since figured out that 12 loadouts a side is more than you need LOL.

 

Want to be able to do it like the truck script addmagazinecargoglobal ["uns_ak47mag_NT", 35], would be nice to do, magazines[] = ["uns_ak47mag_NT", 5]. Gonna see if that works, doubt it will.

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×