sancron 32 Posted July 12, 2012 Hello, i am really new on ArmA 2 mission Development so i got a question i was search for a solution, but i don't find any one that fit my wishes. So i hope some one of the community can help me out, to get my wish to work in ArmA 2. I use the BB Mercs units and want, that the headgear is changeable during gameplay throught the actionmenu. I know it works when i use MCC and put "UNIT setidentity "XYZ"" on the Command line, but i don't find a way to get a script working that does this via actionmenu. I was show at Feints Sniper Camo Change to get a usable solution, but i don't have expirence in enhanced scripting. So my last try was this on private ["_caller","_headGear"];_caller = _this select 1; switch (true) do { case 0: {_caller setidentity "Pro_Helmet"}; case 1: {_caller setidentity "black_beret"}; } And use this Code in the init line of the Unit init="this addAction[""Pro Helmet"", ""x_custom\x_headgear.sqf"", [player, this, 0, (0)]];"; But i don't work Share this post Link to post Share on other sites
cuel 25 Posted July 12, 2012 http://community.bistudio.com/wiki/addAction 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 synt So; _target = _this select 0; _caller = _this select 1; _id = _this select 2; [b]_args[/b] = _this select 3; _var1 = [b]_args[/b] select 0; _var2 = [b]_args[/b] select 1; _var3 = [b]_args[/b] select 2; This: private ["_caller","_headGear"]; _caller = _this select 1; switch (true) do { case 0: {_caller setidentity "Pro_Helmet"}; case 1: {_caller setidentity "black_beret"}; } Doesn't work since _caller is not case 0 or 1. It's an object, not an integer. You could add switch (true) do { case 0: {_caller setidentity "Pro_Helmet"}; case 1: {_caller setidentity "black_beret"}; default: {hint "NOTHING IN THE SWITCH WAS SELECTED";}; } To see if the switch works (which it does not). Anyway, a solution would be (untested): Unit init: this addAction["Pro Helmet", "x_custom\x_headgear.sqf",0]; this addAction["Black Beret", "x_custom\x_headgear.sqf",1]; headgear.sqf: _caller = _this select 1; _selection = _this select 3; switch (_selection) do { case 0: {_caller setIdentity "Pro_Helmet"}; case 1: {_caller setIdentity "black_beret"}; }; Share this post Link to post Share on other sites
sancron 32 Posted July 12, 2012 Thanks for the reply, your second solution works perfect for me. Btw, is it possible to made the actionmenu entry only for usable / visible for my own, so that i don't get actionmenu entry displayed from a other unit? Share this post Link to post Share on other sites
cuel 25 Posted July 12, 2012 It won't be displayed unless you add the action to another unit. Is that what you meant? Share this post Link to post Share on other sites
sancron 32 Posted July 12, 2012 (edited) Nope i mean, when i use this code [left][color=#333333]this addAction["Pro Helmet", "x_custom\x_headgear.sqf",0]; this addAction["Black Beret", "x_custom\x_headgear.sqf",1];[/color][/left] to me and one other unit, and i watch to the other unit, i get the menu entries displayed twice. So i want, that the menu entrie is only for the local player visible. So only i see my menu entries and the other unit see only his menu entries. So i don't get displayed both his and my custom headgear menuentries when i watch to him. i hope i explained it right, my english is horrible. Edited July 12, 2012 by sancron Share this post Link to post Share on other sites
cuel 25 Posted July 12, 2012 put this in the init.sqf player addAction["Pro Helmet", "x_custom\x_headgear.sqf",0]; player addAction["Black Beret", "x_custom\x_headgear.sqf",1]; Share this post Link to post Share on other sites