Jump to content

Recommended Posts

Hi,

 

Okay, this same problem is haunting me time to time.

 

class1.sqf

private ["_unit"];
_unit = _this select 0;

_unit forceAddUniform "U_BG_Guerilla1_1";
for "_i" from 1 to 2 do {_unit addItemToUniform "20Rnd_762x51_Mag";};
_unit addVest "V_Chestrig_rgr";
_unit addBackpack "B_AssaultPack_Kerry";
_unit addHeadgear "H_Cap_surfer";
_unit addGoggles "G_Bandanna_khk";

_unit addWeapon "srifle_DMR_06_camo_F";
_unit addWeapon "Binocular";

_unit setFace "GreekHead_A3_02";
_unit setSpeaker "Male06GRE";

I have tried to execute this is from triggers / script and everytime i fail.

It is supposed to change the gear of the guy who activates it.

_nil = [this] ExecVM "BNAE\Class\class1.sqf"

Any ideas why i cannot make it work?

Share this post


Link to post
Share on other sites

Example of presets from our mission:

[|u (unit)|,|str ("0"|"r")|]execvm"se.sqf";

se.sqf

switch (_this select 1) do {
case "0": {

removeAllWeapons (_this select 0);
removeAllItems (_this select 0);
removeAllAssignedItems (_this select 0);
removeUniform (_this select 0);
removeVest (_this select 0);
removeBackpack (_this select 0);
removeHeadgear (_this select 0);
removeGoggles (_this select 0);

_this select 0 forceAddUniform "U_B_CombatUniform_mcam";

_this select 0 addItemToUniform "FirstAidKit";

_this select 0 linkItem "ItemMap";
_this select 0 linkItem "ItemCompass";
_this select 0 linkItem "ItemWatch";
_this select 0 linkItem "ItemRadio";
_this select 0 linkItem "ItemcTab";
};
case "r": {

removeAllWeapons (_this select 0);
removeAllItems (_this select 0);
removeAllAssignedItems (_this select 0);
removeUniform (_this select 0);
removeVest (_this select 0);
removeBackpack (_this select 0);
removeHeadgear (_this select 0);
removeGoggles (_this select 0);

_this select 0 forceAddUniform "U_B_CombatUniform_mcam";

_this select 0 addItemToUniform "30Rnd_65x39_caseless_mag";
_this select 0 addWeapon "arifle_MX_F";
_this select 0 addPrimaryWeaponItem "acc_pointer_IR";
_this select 0 addPrimaryWeaponItem "optic_Arco";
_this select 0 addItemToUniform "16Rnd_9x21_Mag";
_this select 0 addWeapon "hgun_P07_F";

for "_i" from 1 to 2 do {_this select 0 addItemToUniform "FirstAidKit";};
_this select 0 addVest "V_PlateCarrier1_rgr";
_this select 0 addItemToVest "ItemcTabHCam";
_this select 0 addItemToVest "SmokeShell";
for "_i" from 1 to 2 do {_this select 0 addItemToVest "Chemlight_green";};
_this select 0 addItemToVest "SmokeShellGreen";
_this select 0 addItemToVest "MiniGrenade";
for "_i" from 1 to 4 do {_this select 0 addItemToVest "30Rnd_65x39_caseless_mag";};
_this select 0 addItemToVest "16Rnd_9x21_Mag";
_this select 0 addItemToVest "HandGrenade";
_this select 0 addItemToVest "SmokeShellRed";
for "_i" from 1 to 2 do {_this select 0 addItemToVest "30Rnd_65x39_caseless_mag_Tracer";};
_this select 0 addItemToVest "Chemlight_red";
_this select 0 addHeadgear "H_HelmetB";
_this select 0 addGoggles "G_Sport_Blackred";

_this select 0 linkItem "ItemCompass";
_this select 0 linkItem "ItemWatch";
_this select 0 linkItem "ItemRadio";
_this select 0 linkItem "NVGoggles_INDEP";

};
};

Share this post


Link to post
Share on other sites

Most of the commands take local arguments.

 

UPD: You will have to use remote execution:

_nil = [this, "BNAE\Class\class1.sqf"] remoteExec ["execVM", this];

Share this post


Link to post
Share on other sites

 

Most of the commands take local arguments.

 

UPD: You will have to use remote execution:

_nil = [this, "BNAE\Class\class1.sqf"] remoteExec ["execVM", this];

 

Still not working.

"Error Type Any, expected Number, Side, Object, Group, String"

Share this post


Link to post
Share on other sites

 

Most of the commands take local arguments.

 

UPD: You will have to use remote execution:

_nil = [this, "BNAE\Class\class1.sqf"] remoteExec ["execVM", this];

 

Creating the file, executing the command anywhere, it will work.

Share this post


Link to post
Share on other sites

Still not working.

"Error Type Any, expected Number, Side, Object, Group, String"

Right. Must pass argument in array, my bad.

_nil = [[this], "BNAE\Class\class1.sqf"] remoteExec ["execVM", this];

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

×