Jump to content
Sign in to follow this  
TheConen

Virtual Arsenal exported script doesn't work

Recommended Posts

Hey guys,

I got the following problem: I created a loadout in Virtual Arsenal, exported it in Virtual Arsenal, placed it into a .sqf and loaded this .sqf in the init of my unit in the editor... but it doesn't work, I still get the standard loadouts.

My exported script looks like this:

comment "Exported from Arsenal by TheConen";

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 "U_B_CombatUniform_mcam";
for "_i" from 1 to 2 do {this addItemToUniform "9Rnd_45ACP_Mag";};
this addItemToUniform "HandGrenade";
this addItemToUniform "SmokeShell";
this addItemToUniform "SmokeShellRed";
for "_i" from 1 to 3 do {this addItemToUniform "Chemlight_red";};
this addVest "V_TacVest_camo";
for "_i" from 1 to 2 do {this addItemToVest "FirstAidKit";};
this addItemToVest "AGM_EarBuds";
for "_i" from 1 to 4 do {this addItemToVest "30Rnd_65x39_caseless_mag";};
for "_i" from 1 to 5 do {this addItemToVest "1Rnd_HE_Grenade_shell";};
for "_i" from 1 to 3 do {this addItemToVest "UGL_FlareRed_F";};
this addBackpack "B_Parachute";
this addHeadgear "H_HelmetB_plain_mcamo";
this addGoggles "G_Combat";

comment "Add weapons";
this addWeapon "arifle_MX_GL_Black_F";
this addPrimaryWeaponItem "acc_pointer_IR";
this addPrimaryWeaponItem "optic_Hamr";
this addWeapon "hgun_ACPC2_F";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "tf_anprc152_2";
this linkItem "NVGoggles_INDEP";
this linkItem "Binocular";

comment "Set identity";
this setFace "WhiteHead_19";
this setSpeaker "Male01ENG";

The init of my unit looks like this:

 null = [this] execVM "loadouts\nato_grenadier.sqf";   this addeventhandler ["respawn","_this execVM 'loadouts\nato_grenadier.sqf'"]; this moveincargo c3;   _null = [this] execVM "trackerlaser.sqf";

Any idea why this is?

---------- Post added at 12:33 ---------- Previous post was at 12:00 ----------

Ok, found the problem.... the exported script from Arsenal only seems to work if directly copied into the unit's init...

To make it work in a script, you have to declare a variable which equals "_this select 0;" and replace every "this" occurrence with this variable.

The working script for the above code looks like this:

comment "Exported from Arsenal by TheConen";

private ["_unit"];
_unit = _this select 0;
IF(!local _unit) exitwith {};

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

comment "Add containers";
_unit forceAddUniform "U_B_CombatUniform_mcam";
for "_i" from 1 to 2 do {_unit addItemToUniform "9Rnd_45ACP_Mag";};
_unit addItemToUniform "HandGrenade";
_unit addItemToUniform "SmokeShell";
_unit addItemToUniform "SmokeShellRed";
for "_i" from 1 to 3 do {_unit addItemToUniform "Chemlight_red";};
_unit addVest "V_TacVest_camo";
for "_i" from 1 to 2 do {_unit addItemToVest "FirstAidKit";};
_unit addItemToVest "AGM_EarBuds";
for "_i" from 1 to 4 do {_unit addItemToVest "30Rnd_65x39_caseless_mag";};
for "_i" from 1 to 5 do {_unit addItemToVest "1Rnd_HE_Grenade_shell";};
for "_i" from 1 to 3 do {_unit addItemToVest "UGL_FlareRed_F";};
_unit addBackpack "B_Parachute";
_unit addHeadgear "H_HelmetB_plain_mcamo";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "arifle_MX_GL_Black_F";
_unit addPrimaryWeaponItem "acc_pointer_IR";
_unit addPrimaryWeaponItem "optic_Hamr";
_unit addWeapon "hgun_ACPC2_F";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152_2";
_unit linkItem "NVGoggles_INDEP";
_unit linkItem "Binocular";

comment "Set identity";
_unit setFace "WhiteHead_19";
_unit setSpeaker "Male01ENG";

Would be really nice if BI would update Arsenal so it can export scripts, too.

Share this post


Link to post
Share on other sites

if you pass variable into script you need to define the variable in that script or use params.

Define private as well

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
Sign in to follow this  

×