Jump to content
johnnyboy

[Release] JBOY Stack Objects script

Recommended Posts

Here's a useful script I created for stacking objects in my new mission Property of Mabunga

 

In the Eden editor, stacking objects is much easier now with drag and drop and snap to grid, but this is still a time saver if you want to stack several objects neatly.

 

 

To use this script, put this line of code in the init field of the object you wish to stack:

dummy = [this, 3] execVM "Scripts\JBOY_StackObjects.sqf";

In your mission folder, create a script file named JBOY_StackObjects, and put this code in it:

//////////////////////////////////////////////////////////
// JBOY_StackObjects.sqf 
// By: johnnyboy
// dummy = [this, 3] execVM "Scripts\JBOY_StackObjects.sqf";
//////////////////////////////////////////////////////////
_obj = _this select 0;
_objCount = _this select 1;

_z = 0;
_pos = getposasl _obj;

_bbr = boundingBoxReal _obj;
_p1 = _bbr select 0;
_p2 = _bbr select 1;
//_maxWidth = abs ((_p2 select 0) - (_p1 select 0));
//_maxLength = abs ((_p2 select 1) - (_p1 select 1));
_maxHeight = abs ((_p2 select 2) - (_p1 select 2));
_height = _maxHeight+(_pos select 2);
_vectorDir = vectorDir _obj;
_dir = direction _obj;
while {_z < _objCount} do
{
    _z = _z + 1;
    _newObj = (typeOf _obj) createvehicle [0,0,0];
     _newObj setDir _dir;
    _newObj setposasl [_pos select 0, _pos select 1, _height];
    _height = _height + _maxHeight;
};

Feel free to use this and modify it any way you want.

  • Like 4

Share this post


Link to post
Share on other sites

Thanks for sharing all these neat little scripts from your uber cool mission......Much appreciated JB. ;)   

  • Like 1

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

×