Ilias38rus 5 Posted September 14, 2015 /* lua = _x; selectWeapon (handgunweapon lua); or selectWeapon str (handgunweapon lua); or lua = handgunweapon _x; selectWeapon (lua); or lua = handgunweapon _x; selectWeapon str (lua); Do not working, why? */ How to get the weapon muzzleName? Share this post Link to post Share on other sites
d3limit3r 13 Posted September 14, 2015 The one thing that I immediately notice is that you aren't specifying a unit for selectWeapon. The syntax for selectWeapon is unitName selectWeapon muzzleName; So you should be able to do something like { _sidearm = handgunWeapon _x; _x selectWeapon _sidearm; } forEach units group player; Additionally, you do not need to use the str command as handgunWeapon already returns a string. Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 14, 2015 On 9/14/2015 at 2:12 PM, d3limit3r said: The one thing that I immediately notice is that you aren't specifying a unit for selectWeapon. The syntax for selectWeapon is unitName selectWeapon muzzleName; So you should be able to do something like { _sidearm = handgunWeapon _x; _x selectWeapon _sidearm; } forEach units group player; Additionally, you do not need to use the str command as handgunWeapon already returns a string. Sorry, forgot to insert, it looks: lua = primaryweapon _x; _x addaction ["Select weapon",{(_this select 0) selectWeapon lua;},"_x"]; and do not working, i need muzzle name, found: class arifle_MX_GL_F : arifle_MX_Base_F { muzzles[] = {this, GL_3GL_F}; but dont know how to get this mussle lua = primaryweapon _x;// >> muzzles[] select 0 //? Share this post Link to post Share on other sites
Larrow 2827 Posted September 14, 2015 EDIT: never mind, note to self must remember to refresh old pages before posting :) 2 Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 14, 2015 Try this: _muzzles = getArray (configFile >> "CfgWeapons" >> (primaryWeapon _x) >> "muzzles") Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 14, 2015 On 9/14/2015 at 2:37 PM, Heeeere's johnny! said: Try this: _muzzles = getArray (configFile >> "CfgWeapons" >> (primaryWeapon _x) >> "muzzles") laia = []; lia1 = 0; laia = getArray (configFile >> "CfgWeapons" >> (primaryweapon _x) >> "muzzles"); lia1 = laia select 0; _x addaction ["Select weapon",{(_this select 0) selectWeapon lia1;},"_x"]; Nope, selectWeapon |#|lia1 undefined variabdle or laia = []; lia1 = 0; laia = getArray (configFile >> "CfgWeapons" >> (primaryweapon _x) >> "muzzles"); lia1 = laia select 0; _x addaction ["Select weapon",{(_this select 0) selectWeapon str (lia1);},"_x"]; Nope, selectWeapon str (|#|lia1) undefined variabdle Share this post Link to post Share on other sites
Larrow 2827 Posted September 14, 2015 { _weapon = _x; _muzzles = getArray( configFile >> "CfgWeapons" >> _weapon >> "muzzles" ); { _muzzle = _x; _muzzleSelect = _x; if ( _muzzleSelect isEqualTo "this" ) then { _muzzleSelect = _weapon; }; player addAction [ format[ "Use %1 - %2", _weapon, _muzzle ], format[ "player selectWeapon %1", str _muzzleSelect ] ]; }forEach _muzzles; }forEach [ primaryWeapon player, secondaryWeapon player, handgunWeapon player ]; Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted September 14, 2015 On 9/14/2015 at 3:14 PM, Ilias38rus said: laia = []; lia1 = 0; laia = getArray (configFile >> "CfgWeapons" >> (primaryweapon _x) >> "muzzles"); lia1 = laia select 0; _x addaction ["Select weapon",{(_this select 0) selectWeapon lia1;},"_x"]; Nope, selectWeapon |#|lia1 undefined variabdle or laia = []; lia1 = 0; laia = getArray (configFile >> "CfgWeapons" >> (primaryweapon _x) >> "muzzles"); lia1 = laia select 0; _x addaction ["Select weapon",{(_this select 0) selectWeapon str (lia1);},"_x"]; Nope, selectWeapon str (|#|lia1) undefined variabdle on a sidenote, you might wanna think a bit about naming your variables (and your thread titles) since it's confusing as hell to read. Cheers Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 14, 2015 On 9/14/2015 at 3:49 PM, Grumpy Old Man said: on a sidenote, you might wanna think a bit about naming your variables (and your thread titles) since it's confusing as hell to read. Cheers With the system i using, i can at anytime, in any skript write needeble variable without any help, notes (in the mission currently like ~80 global variables) Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 14, 2015 On 9/14/2015 at 3:46 PM, Larrow said: { _weapon = _x; _muzzles = getArray( configFile >> "CfgWeapons" >> _weapon >> "muzzles" ); { _muzzle = _x; _muzzleSelect = _x; if ( _muzzleSelect isEqualTo "this" ) then { _muzzleSelect = _weapon; }; player addAction [ format[ "Use %1 - %2", _weapon, _muzzle ], format[ "player selectWeapon %1", str _muzzleSelect ] ]; }forEach _muzzles; }forEach [ primaryWeapon player, secondaryWeapon player, handgunWeapon player ]; Is that nessesary? { _muzzle = _x; _muzzleSelect = _x; if ( _muzzleSelect isEqualTo "this" ) then { _muzzleSelect = _weapon; }; player addAction [ format[ "Use %1 - %2", _weapon, _muzzle ], format[ "player selectWeapon %1", str _muzzleSelect ] ]; }forEach _muzzles; Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 14, 2015 N. m., thats do not working, at all.(for Ai, i need it for Ai) Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 14, 2015 _x addaction ["Select grenade launcher",{(_this select 0) selectWeapon "GL_3GL_F";},"_x"]; is working, but any with str (this) not and i need exactly str (this) Actualy _this selectweapon "hgun_pd7_f"; right in object init do not working at all, i starting be a little scared Share this post Link to post Share on other sites
davidoss 552 Posted September 15, 2015 On 9/14/2015 at 1:43 PM, Ilias38rus said: How to get the weapon muzzleName? _muzzleSlotItem = (primaryWeaponItems _unit) select 0; str _muzzleSlotItem; Return muzzle classname ""muzzle_mas_snds_M"" What are you want to create? Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 15, 2015 On 9/15/2015 at 5:05 PM, davidoss said: _muzzleSlotItem = (primaryWeaponItems _unit) select 0; What are you want to create? Nope, sorry do not working Need command for Ai to change ugl on primarywapon Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted September 15, 2015 On 9/15/2015 at 5:11 PM, Ilias38rus said: Nope, sorry do not working Need command for Ai to change ugl on primarywapon Why didn't you ask this in the first place? 1 Share this post Link to post Share on other sites
davidoss 552 Posted September 15, 2015 by Schatten : //Adding muzzle { _unit = _x; if (alive _unit) then { _primaryWeapon = primaryWeapon _unit; if ((_primaryWeapon != '') and {((primaryWeaponItems _unit) select 0) == ''}) then { _muzzleSlotItem = ''; _compatibleMuzzleSlotItems = getArray (configFile >> 'CfgWeapons' >> _primaryWeapon >> 'WeaponSlotsInfo' >> 'MuzzleSlot' >> 'compatibleItems'); { _item = _x; {if (_x == _item) exitWith {_muzzleSlotItem = _x}} forEach _compatibleMuzzleSlotItems; if (_muzzleSlotItem != '') exitWith {}; } forEach (items _unit); if (_muzzleSlotItem != '') then { _unit removeItem _muzzleSlotItem; _unit addPrimaryWeaponItem _muzzleSlotItem; }; }; }; } forEach (units (group player)); //removing muzzle { _muzzleSlotItem = (primaryWeaponItems _x) select 0; if (_muzzleSlotItem != '') then { _x removePrimaryWeaponItem _muzzleSlotItem; _x addItem _muzzleSlotItem; }; } forEach (units (group player)); Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 15, 2015 On 9/15/2015 at 5:44 PM, davidoss said: by Schatten : //Adding muzzle { _unit = _x; if (alive _unit) then { _primaryWeapon = primaryWeapon _unit; if ((_primaryWeapon != '') and {((primaryWeaponItems _unit) select 0) == ''}) then { _muzzleSlotItem = ''; _compatibleMuzzleSlotItems = getArray (configFile >> 'CfgWeapons' >> _primaryWeapon >> 'WeaponSlotsInfo' >> 'MuzzleSlot' >> 'compatibleItems'); { _item = _x; {if (_x == _item) exitWith {_muzzleSlotItem = _x}} forEach _compatibleMuzzleSlotItems; if (_muzzleSlotItem != '') exitWith {}; } forEach (items _unit); if (_muzzleSlotItem != '') then { _unit removeItem _muzzleSlotItem; _unit addPrimaryWeaponItem _muzzleSlotItem; }; }; }; } forEach (units (group player)); //removing muzzle { _muzzleSlotItem = (primaryWeaponItems _x) select 0; if (_muzzleSlotItem != '') then { _x removePrimaryWeaponItem _muzzleSlotItem; _x addItem _muzzleSlotItem; }; } forEach (units (group player)); Do not working Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 15, 2015 Please, for the sake of us being able to help you, provide a bit more information than "do not working". What exactly is not working? Do you get a script error? Does nothing happen? Is something not happening as it's supposed to or as you want it? You can't expect us to help you if you provide as little information as possible. 2 Share this post Link to post Share on other sites
davidoss 552 Posted September 15, 2015 Yeah! Finally. Share this post Link to post Share on other sites
Larrow 2827 Posted September 15, 2015 { if !( isPlayer _x ) then { _unit = _x; { if ( getText( configFile >> "CfgWeapons" >> primaryWeapon _unit >> _x >> "cursorAim" ) isEqualTo "gl" ) then { _muzzle = configName( configFile >> "CfgWeapons" >> primaryWeapon _unit >> _x ); _unit addAction [ "Select UGL", { _unit = _this select 0; _unit selectWeapon ( _this select 3 select 0 ); }, [ _muzzle ]]; }; }forEach ( getArray( configFile >> "CfgWeapons" >> primaryWeapon _unit >> "muzzles" ) - [ "this" ] ); }; }forEach units group player; Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 15, 2015 If i'm getting precise script error, i'm fixing it, if i'm getting script error, but do not understanding it i'm writing the error, if i'm getting some wrong working, i'm writing what wrong, if is nothing working (nothing happening), i have nothing to write, is it difficult? 1 Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 15, 2015 Just please all i need is command to get thing (what i can use for selectwepon for change ai weapon from ugl on rifle) this is all, i do not need all the { if !( isPlayer _x ) then { _unit = _x; { }; _unit addAction [ "Select UGL", { _unit = _this select 0; _unit selectWeapon ( _this select 3 select 0 ); }, [ _muzzle ]];}forEach units group player; Share this post Link to post Share on other sites
Larrow 2827 Posted September 15, 2015 There is no such thing as switch to ugl. It is all based off of the weapons muzzles and can be different based on what weapon a unit is carrying. It is not like a rifle or handgun where there is a dedicated command for it like primaryweapon _unit etc, it is not its own weapon but instead is a secondary muzzle of the primary weapon, as such you need to query the config for the primaryweapon to find the muzzle name. So yes you need all the ^. If you are unwilling to learn from the help given then im out. Maybe someone else knows the magic command you are looking for. Good luck. Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 15, 2015 On 9/15/2015 at 10:35 PM, Larrow said: There is no such thing as switch to ugl. It is all based off of the weapons muzzles and can be different based on what weapon a unit is carrying. It is not like a rifle or handgun where there is a dedicated command for it like primaryweapon _unit etc, it is not its own weapon but instead is a secondary muzzle of the primary weapon, as such you need to query the config for the primaryweapon to find the muzzle name. So yes you need all the ^. If you are unwilling to learn from the help given then im out. Maybe someone else knows the magic command you are looking for. Good luck. i not need to swith to ugl, i need from and }forEach units group player; i don't need for sure , i have all i need to identificate weapon, just imagine what it's with ugl, ai selected ugl, and tell how to order unit to switch back to riffle, please Share this post Link to post Share on other sites