Jump to content
Sign in to follow this  
ringoray

adding arsenal code to spawned ammobox.

Recommended Posts

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

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

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

You would just put it along with wherever you are using objectsMapper?

Share this post


Link to post
Share on other sites

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

"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

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 by ringoray

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
Sign in to follow this  

×