splatsh 10 Posted January 12, 2011 How to addaction with this? This is what I have in player initfield to get the right loadout. hNil = [this, "SMAW"] call compile preprocessFile "scripts\fnc_gear.sqf"; Now I want to add some addaction that is load different loadouts. Some code to show you how I want it. player addaction ["GEAR: SMAW","[player, "SMAW"]scripts\fnc_gear.sqf"]; player addaction ["GEAR: STINGER","[player, "STINGER"]scripts\fnc_gear.sqf"]; But this code don't work. So how do I write right code that works for my purpose? Thanks Share this post Link to post Share on other sites
shay_gman 272 Posted January 12, 2011 Try this: __null= this addAction ["GEAR: SMAW","scripts\fnc_gear.sqf",([this, "SMAW"])]; Share this post Link to post Share on other sites
splatsh 10 Posted January 12, 2011 Thanks I did try this code player addAction ["GEAR: SMAW","scripts\fnc_gear.sqf",([player, "SMAW"])]; It did not work, it deleted all my gear. So the first part in my fnc_gear.sqf file worked, but it did not give me any new gear =/ Share this post Link to post Share on other sites
shay_gman 272 Posted January 12, 2011 Well u'll have to post your script in order to understand what is wrong. Share this post Link to post Share on other sites
splatsh 10 Posted January 12, 2011 OK Player initfield: (Working when I play) hNil = [this, "START"] call compile preprocessFile "scripts\fnc_gear.sqf"; fnc_gear.sqf (Working when I play) if (!isServer) exitWith {}; _unit = _this select 0; _strLoadout = _this select 1; removeAllWeapons _unit; removeBackpack _unit; switch (_strLoadout) do { case "MG": { if (local _unit) then { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; }; case "START": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; case "STINGER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; _unit addWeapon "Stinger"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["Stinger",1]; }; case "JAVELIN": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Javelin_Direct";} forEach [1]; _unit addWeapon "ACE_Javelin_Direct"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["ACE_Javelin_Direct",1]; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; }; case "SNIPER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "ACE_5Rnd_127x99_B_TAC50";} forEach [1,2,3,4,5,6,7,8,9,10,11]; _unit addWeapon "ACE_AS50"; (unitBackpack _unit) addMagazineCargo ["ACE_5Rnd_127x99_B_TAC50",10]; }; case "SMAW": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "SMAW_HEAA";} forEach [1,2]; _unit addWeapon "SMAW"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["SMAW_HEAA",1]; }; }; if (!(_unit hasWeapon "itemGPS")) then { _unit addWeapon "itemGPS"; }; _unit addWeapon "Binocular_Vector"; _unit addWeapon "NVGoggles"; _unit addMagazine "ACE_Battery_Rangefinder"; _primaryWeapon = primaryWeapon _unit; _unit selectweapon _primaryWeapon; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primaryWeapon >> "muzzles"); _unit selectWeapon (_muzzles select 0); Now I want to addaction in my init.sqf file This one down here is not working, but you can see how I want to have it =) init.sqf player addAction ["GEAR: SMAW","scripts\fnc_gear.sqf",([player, "SMAW"])]; player addAction ["GEAR: SNIPER","scripts\fnc_gear.sqf",([player, "SNIPER"])]; player addAction ["GEAR: JAVELIN","scripts\fnc_gear.sqf",([player, "JAVELIN"])]; player addAction ["GEAR: STINGER","scripts\fnc_gear.sqf",([player, "STINGER"])]; player addAction ["GEAR: MG","scripts\fnc_gear.sqf",([player, "MG"])]; Share this post Link to post Share on other sites
splatsh 10 Posted January 12, 2011 unitName addAction [title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition)] But this player addAction ["GEAR: JAVELIN","scripts\fnc_gear.sqf",(player, "JAVELIN")]; or this player addAction ["GEAR: JAVELIN","scripts\fnc_gear.sqf",([player, "JAVELIN"])]; does not work...... help please Share this post Link to post Share on other sites
Gekkibi 11 Posted January 12, 2011 How about this: player addAction ["GEAR: JAVELIN", "scripts\fnc_gear.sqf", [player, "JAVELIN"]]; Share this post Link to post Share on other sites
splatsh 10 Posted January 12, 2011 How about this: player addAction ["GEAR: JAVELIN", "scripts\fnc_gear.sqf", [player, "JAVELIN"]]; No, sorry, don't work Share this post Link to post Share on other sites
Muzzleflash 111 Posted January 12, 2011 No, sorry, don't work Well you gonna have to change your script to make it work using addAction. Where you write _this in you "normal" script write (_this select 3) in the script file your addaction uses. So if you somewhere in your "normal" script wrote: _this select 0 write (_this select 3) select 0 instead. Share this post Link to post Share on other sites
splatsh 10 Posted January 13, 2011 (edited) Well you gonna have to change your script to make it work using addAction.Where you write _this in you "normal" script write (_this select 3) in the script file your addaction uses. So if you somewhere in your "normal" script wrote: _this select 0 write (_this select 3) select 0 instead. What? I am using that you can see above. In SP and MP and this code is working fine now: in player initfield I have this: hNil = [this, "JAVELIN"] call compile preprocessFile "scripts\fnc_gear.sqf"; fnc_gear.sqf if (!isServer) exitWith {}; _unit = _this select 0; _strLoadout = _this select 1; removeAllWeapons _unit; removeBackpack _unit; switch (_strLoadout) do { case "MG": { if (local _unit) then { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; }; case "START": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; case "STINGER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; _unit addWeapon "Stinger"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["Stinger",1]; }; case "JAVELIN": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Javelin_Direct";} forEach [1]; _unit addWeapon "ACE_Javelin_Direct"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["ACE_Javelin_Direct",1]; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; }; case "SNIPER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "ACE_5Rnd_127x99_B_TAC50";} forEach [1,2,3,4,5,6,7,8,9,10,11]; _unit addWeapon "ACE_AS50"; (unitBackpack _unit) addMagazineCargo ["ACE_5Rnd_127x99_B_TAC50",10]; }; case "SMAW": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "SMAW_HEAA";} forEach [1,2]; _unit addWeapon "SMAW"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["SMAW_HEAA",1]; }; }; if (!(_unit hasWeapon "itemGPS")) then { _unit addWeapon "itemGPS"; }; _unit addWeapon "Binocular_Vector"; _unit addWeapon "NVGoggles"; _unit addMagazine "ACE_Battery_Rangefinder"; _primaryWeapon = primaryWeapon _unit; _unit selectweapon _primaryWeapon; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primaryWeapon >> "muzzles"); _unit selectWeapon (_muzzles select 0); Now I want to have something that give my player (me) some actions (addAction) so I can change gear while I am playing. But all my addActions try are fail and I don't know how to set up some addActions that can use my fnc_gear.sqf file. addAction http://community.bistudio.com/wiki/addAction unitName addAction [title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition)] I have try this and I can't get it to work right. I can't get right arguments for the code, all that happen is that my weapon and ammor are lost when I try this: player addAction ["GEAR: JAVELIN", "scripts\fnc_gear.sqf", [player, "JAVELIN"]]; player addAction ["GEAR: JAVELIN","scripts\fnc_gear.sqf",([player, "JAVELIN"])]; player addAction ["GEAR: JAVELIN","scripts\fnc_gear.sqf",(player, "JAVELIN")]; But I need help with getting the right arguments for it (player) and (TYPE OF GEAR) Thanks Edited January 13, 2011 by splatsh Share this post Link to post Share on other sites
-)rStrangelove 0 Posted January 13, 2011 (edited) [player, "JAVELIN"] are supposed to be the parms the script gets, so as a test i'd rewrite the script to show you if those parms are correct: if (!isServer) exitWith {}; _unit = _this select 0; _strLoadout = _this select 1; player sidechat format["%1 %2", _unit, _strLoadout]; And did you see the Biki for addaction?: Parameters of the called script upon activation:An array of parameters is passed to the called script: [target, caller, ID, (arguments)] * target: Object - the object which the action is assigned to * caller: Object - the unit that activated the action * ID: Integer - ID of the activated action * arguments: Anything - arguments given to the script if you are using the extended syntax The script gets its arguments inside another array, hence the info Muzzleflash gave you. So what your script gets is: [target, caller, ID, [player, "JAVELIN"]] (_this select 3) would be [player, "JAVELIN"] and ((_this select 3) select 0) would be player Edited January 13, 2011 by ])rStrangelove Share this post Link to post Share on other sites
Bon 12 Posted January 13, 2011 Consult the BIKI: addaction. Starting a script by action, e.g.: player addAction ["GEAR: JAVELIN", "scripts\fnc_gear.sqf", [player, "JAVELIN"]]; the script gets passed the following parameters: [target, caller, ID, (arguments)]; Means, in fnc_gear.sqf, you could do: _target = _this select 0; // the object the action is assigned to; here: player _caller = _this select 1; // the object using the action; here: usually the player _id = _this select 2; // the action id, also the return value of addaction _parameters = _this select 3; // the parameters; here: [player,"JAVELIN"] In this example: (_this select 3) select 0 -> player (_this select 3) select 1 -> "JAVELIN" Share this post Link to post Share on other sites
splatsh 10 Posted January 13, 2011 So how can I do to use my fnc_gear.sqf file to my purpose? I need this so my starting loadout work B]fnc_gear.sqf[/b] _unit = _this select 0; _strLoadout = _this select 1; And I need this to get addAction to work? B]fnc_gear.sqf[/b] _target = _this select 0; // the object the action is assigned to; here: player _caller = _this select 1; // the object using the action; here: usually the player _id = _this select 2; // the action id, also the return value of addaction _parameters = _this select 3; // the parameters; here: [player,"JAVELIN"] I want to use the same file twice, can it be done? (I don't want to have more then one fnc_gear.sqf file) Share this post Link to post Share on other sites
Deadfast 43 Posted January 13, 2011 Add -showScriptErrors to your shortcut. That way you will see errors on the screen. They are also logged to your arma2.RPT, with or without that parameter. Share this post Link to post Share on other sites
splatsh 10 Posted January 13, 2011 Add -showScriptErrors to your shortcut. That way you will see errors on the screen. They are also logged to your arma2.RPT, with or without that parameter. I think that is not the problem, the problem is that I don't know to write this down with right parameters and so on, need someone to guide me to write it right... My script is working fine... And I need to add some addActions that can change my gear while I am playing the game. And that addAction is going to point at my fnc_gear.sqf file. Can it not be done with my code (fnc_gear.sqf) now, so please show me how to do it right. Thanks. Share this post Link to post Share on other sites
twirly 11 Posted January 13, 2011 (edited) LOL! Your script is not "working fine" if it does not work! The add "showscripterrors" and looking in the report file is excellent advice. Anyway...just from reading this thread and the help you have already been given....I got it working with not too much trouble at all.... Demo here. EDIT: You can name your script anything you want...it is your script. As it stands however....it is not a function.....so maybe you should leave out the "fnc_" in the name. This normally means it is a function of some sort and may be confusing to others. Edited January 13, 2011 by twirly Added some text Share this post Link to post Share on other sites
st_dux 26 Posted January 13, 2011 (edited) 1. Remove the "player," brackets and parenthesis from the third parameter in your addAction lines. For example, replace: player addAction ["GEAR: SMAW","scripts\fnc_gear.sqf",([player, "SMAW"])]; with: player addAction ["GEAR: SMAW","scripts\fnc_gear.sqf","SMAW"]; 2. In your fnc_gear script, add the following line immediately below line 3: if (_strLoadout == _unit) then {_strLoadout = _this select 3}; If you follow those two steps exactly, it should work the way you want it to. Edited January 13, 2011 by ST_Dux Share this post Link to post Share on other sites
splatsh 10 Posted January 14, 2011 Thanks, I have now done this: At player init: _playerInit = [this] execVM "init_player.sqf"; init_player.sqf _unit = _this select 0; _plactID1 = _unit addAction ["Gear: STINGER","scripts\change_gear.sqf",[_unit, "STINGER"],1,false]; _plactID2 = _unit addAction ["Gear: JAVELIN","scripts\change_gear.sqf",[_unit, "JAVELIN"],1,false]; _plactID2 = _unit addAction ["Gear: SMAW","scripts\change_gear.sqf",[_unit, "SMAW"],1,false]; _plactID2 = _unit addAction ["Gear: MG","scripts\change_gear.sqf",[_unit, "MG"],1,false]; _plactID2 = _unit addAction ["Gear: SNIPER","scripts\change_gear.sqf",[_unit, "SNIPER"],1,false]; At this works great and it works as I wanted it do work. Thanks for the assist on that one :) No to the problem I got, how do I call a custom loadout from a player at player initfield? My change_gear.sqf look like this now: change_gear.sqf _unit = _this select 1; _strLoadout = (_this select 3) select 1; removeAllWeapons _unit; removeBackpack _unit; switch (_strLoadout) do { case "MG": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; case "START": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; case "STINGER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "Stinger"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["Stinger",1]; }; case "JAVELIN": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; {_unit addMagazine "ACE_Javelin_Direct";} forEach [1]; _unit addWeapon "ACE_Javelin_Direct"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["ACE_Javelin_Direct",1]; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; }; case "SNIPER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "ACE_5Rnd_127x99_B_TAC50";} forEach [1,2,3,4,5,6,7,8,9,10,11]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "ACE_AS50"; (unitBackpack _unit) addMagazineCargo ["ACE_5Rnd_127x99_B_TAC50",10]; }; case "SMAW": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; {_unit addMagazine "SMAW_HEAA";} forEach [1,2]; _unit addWeapon "SMAW"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["SMAW_HEAA",1]; }; }; if (!(_unit hasWeapon "itemGPS")) then { _unit addWeapon "itemGPS"; }; _unit addWeapon "Binocular_Vector"; _unit addWeapon "NVGoggles"; _unit addMagazine "ACE_Battery_Rangefinder"; _primaryWeapon = primaryWeapon _unit; _unit selectweapon _primaryWeapon; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primaryWeapon >> "muzzles"); _unit selectWeapon (_muzzles select 0); And I want that each of my player start diferent loadouts. Example of players initfield: Player 1: _LoadOut = [this, "MG"] execVM "scripts\change_gear.sqf"; Player 2: _LoadOut = [this, "JAVELIN"] execVM "scripts\change_gear.sqf"; Player 3: _LoadOut = [this, "STINGER"] execVM "scripts\change_gear.sqf"; Now this exampel is not working, so how to write it so it will work with my change_gear.sqf file? And my addAction must work at the same time in that way I got it now with my change_gear.sqf file. Share this post Link to post Share on other sites
st_dux 26 Posted January 14, 2011 If you go back to your original script and follow the two steps I outlined in the post above, it will work both for initial gear selection and changing gear later. Share this post Link to post Share on other sites
splatsh 10 Posted January 14, 2011 If you go back to your original script and follow the two steps I outlined in the post above, it will work both for initial gear selection and changing gear later. Are you sure? I tested to do so at firts, but without good result. Please upload a demo so I can see that I tested the right thing. Share this post Link to post Share on other sites
st_dux 26 Posted January 14, 2011 Yes, I'm sure. Please post your original script and the init lines for your players, both with the suggested changes made, so I can see what's going wrong. Share this post Link to post Share on other sites
splatsh 10 Posted January 14, 2011 oki :) Initfield player: _startGear = [this, "JAVELIN"] call compile preprocessFile "scripts\fnc_gear.sqf"; _playerInit = [this] execVM "init_player.sqf"; fnc_gear.sqf if (!isServer) exitWith {}; _unit = _this select 0; _strLoadout = _this select 1; if (_strLoadout == _unit) then {_strLoadout = _this select 3}; removeAllWeapons _unit; removeBackpack _unit; switch (_strLoadout) do { case "MG": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; case "START": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "100Rnd_556x45_BetaCMag";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "M249_m145_EP1"; (unitBackpack _unit) addMagazineCargo ["100Rnd_556x45_BetaCMag",5]; }; case "STINGER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "Stinger"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["Stinger",1]; }; case "JAVELIN": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; {_unit addMagazine "ACE_Javelin_Direct";} forEach [1]; _unit addWeapon "ACE_Javelin_Direct"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["ACE_Javelin_Direct",1]; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; }; case "SNIPER": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "ACE_5Rnd_127x99_B_TAC50";} forEach [1,2,3,4,5,6,7,8,9,10,11]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; _unit addWeapon "ACE_AS50"; (unitBackpack _unit) addMagazineCargo ["ACE_5Rnd_127x99_B_TAC50",10]; }; case "SMAW": { {_unit addBackpack "US_Backpack_AmmoMG_EP1";} forEach [1]; clearMagazineCargo unitBackpack _unit; {_unit addMagazine "20Rnd_762x51_B_SCAR";} forEach [1,2,3,4,5]; {_unit addMagazine "ACE_Bandage";} forEach [1,2,3,4,5,6,7,8]; {_unit addMagazine "SMAW_HEAA";} forEach [1,2]; _unit addWeapon "SMAW"; _unit addWeapon "ACE_SCAR_H_STD_Spect"; (unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",5]; (unitBackpack _unit) addMagazineCargo ["SMAW_HEAA",1]; }; }; if (!(_unit hasWeapon "itemGPS")) then { _unit addWeapon "itemGPS"; }; _unit addWeapon "Binocular_Vector"; _unit addWeapon "NVGoggles"; _unit addMagazine "ACE_Battery_Rangefinder"; _primaryWeapon = primaryWeapon _unit; _unit selectweapon _primaryWeapon; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primaryWeapon >> "muzzles"); _unit selectWeapon (_muzzles select 0); init_player.sqf _unit = _this select 0; _plactID1 = _unit addAction ["Gear: STINGER","scripts\fnc_gear.sqf",[_unit, "STINGER"],1,false]; _plactID2 = _unit addAction ["Gear: JAVELIN","scripts\fnc_gear.sqf",[_unit, "JAVELIN"],1,false]; _plactID3 = _unit addAction ["Gear: SMAW","scripts\fnc_gear.sqf",[_unit, "SMAW"],1,false]; _plactID4 = _unit addAction ["Gear: MG","scripts\fnc_gear.sqf",[_unit, "MG"],1,false]; _plactID5 = _unit addAction ["Gear: SNIPER","scripts\fnc_gear.sqf",[_unit, "SNIPER"],1,false]; _plactID6 = _unit addAction ["Request: Transport","init_transport.sqf"]; Share this post Link to post Share on other sites
st_dux 26 Posted January 17, 2011 fnc_gear.sqf is fine, but you need to change your addAction calls. Instead of this: ["Gear: STINGER","scripts\fnc_gear.sqf",[_unit, "STINGER"],1,false] Use this: ["Gear: STINGER","scripts\fnc_gear.sqf",[b]"STINGER"[/b],1,false] The unit is already passed to the script by virtue of it being an addAction. The only additional argument that you need to pass is the weapon string. Share this post Link to post Share on other sites