ringoray 1 Posted April 21, 2015 Hey all, is it possible to add the arsenal code to an ammobox that I have spawned in dynamically using the objectgrabber.sqf method? Thanks in advance for any help and input given. Share this post Link to post Share on other sites
jshock 513 Posted April 21, 2015 Well if your talking the BIS_fnc_objectsGrabber/Mapper then yes, you should be able to save the array of objects created from objectsMapper then iterate through them looking for your specific classname of the objects you want to have arsenal then add it to them: _arrayOfObjects = [/*blah*/] call BIS_fnc_objectMapper; { if (typeOf _x isEqualTo "Classname") then {["AmmoboxInit",_x] spawn BIS_fnc_arsenal;}; } forEach _arrayOfObjects; Share this post Link to post Share on other sites
ringoray 1 Posted April 21, 2015 Yep that's what I am looking for. Where would I put that code you posted? Sorry scripting is not my strong point and thanks a lot for your quick response. Share this post Link to post Share on other sites
jshock 513 Posted April 21, 2015 You would just put it along with wherever you are using objectsMapper? Share this post Link to post Share on other sites
ringoray 1 Posted April 21, 2015 Ok got ya thanks for the help, appreciate it. ---------- Post added at 00:00 ---------- Previous post was at 23:58 ---------- So I would put the class name of the ammo box where it says blah in that code you posted? Share this post Link to post Share on other sites
jshock 513 Posted April 21, 2015 "blah" would be your parameters for objectsMapper, where you see "Classname" is where you would put the classname of the box you want to add arsenal to. Share this post Link to post Share on other sites
ringoray 1 Posted April 21, 2015 Ok thanks again I'll give it a go. Share this post Link to post Share on other sites
ringoray 1 Posted April 22, 2015 (edited) So I looked at BIS_fnc_ObjectMapper and seen the parameters. So I am wondering is this what I have to do? _arrayOfObjects = [_this select 2] call BIS_fnc_objectMapper; { if (typeOf _x isEqualTo "Classname") then {["AmmoboxInit",_x] spawn BIS_fnc_arsenal;}; } forEach _arrayOfObjects; I checked the Function and this is what it says regarding parameters, sorry if I am getting this all wrong, as I said I am dumb when it comes to understanding scripting. File: objectMapper.sqf Description: Takes an array of data about a dynamic object template and creates the objects. Parameter(s): _this select 0: position of the template - Array [X, Y, Z] _this select 1: azimuth of the template in degrees - Number _this select 2: objects for the template - Array / composition class - String / tag list - Array _this select 3: (optional) randomizer value (how much chance each object has of being created. 0.0 is 100% chance) - Number Returns: Created objects (Array) Yup this was wrong too, but found this code, credit to Swiss Maverick for this one. All that has to be done is add this code to your init.sqf and it works great. { _x allowDamage false; _x addAction ["<t color='#ff1111'>BIS Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}]; } forEach nearestObjects [getpos player,["B_supplyCrate_F"],15000]; Thanks for your input and help dude. Edited April 22, 2015 by ringoray Share this post Link to post Share on other sites