Jump to content
Sign in to follow this  
cael817

Rotate each spawned object x degrees

Recommended Posts

Hi im using this script that i believe Larrow made for making lights around a helipad

#define RADIUS 30
#define AMOUNT 100

_target = cursorTarget;
_target_pos = getPos _target;

if (isNil "borderObjects") then {
   borderObjects = [];
   _rad = RADIUS;
   _bcount = AMOUNT;
   _inc = 360/_bcount; 
   for "_ang" from 1 to 360 step _inc do {
       _a = (_target_pos select 0)+(sin(_ang)*_rad);
       _b = (_target_pos select 1)+(cos(_ang)*_rad);
       _pos = [_a,_b,_target_pos select 2];
	_object = createVehicle ["Land_CncShelter_F", _pos, [], 0, "CAN_COLLIDE"];
	borderObjects pushBack _object;
   };

[format ["Added objects around a radius of (%1m) they will be removed in 30 seconds",RADIUS], 5] call mf_notify_client;	
};

sleep 30;
if ( !(isNil "borderObjects") ) then {
   {
       deleteVehicle _x;    
   }forEach borderObjects;
   borderObjects = nil;
}; 

Can i easily add to this script so each Land_CncShelter_F is rotated x degrees for each increment?

I used the Land_CncShelter_F for testing as its easy to see if my changes worked.

Share this post


Link to post
Share on other sites

Just set the _object dir after you spawn it..

#define RADIUS 30
#define AMOUNT 100

_target = cursorTarget;
_target_pos = getPos _target;

if (isNil "borderObjects") then {
borderObjects = [];
_inc = 360/AMOUNT; 
for "_ang" from 0 to 359 step _inc do {
	_a = (_target_pos select 0)+(sin(_ang)*RADIUS);
	_b = (_target_pos select 1)+(cos(_ang)*RADIUS);
	_pos = [_a,_b,_target_pos select 2];
	_object = createVehicle ["Land_CncShelter_F", _pos, [], 0, "CAN_COLLIDE"];
	_object setDir _ang;
	borderObjects pushBack _object;
};

[format ["Added objects around a radius of (%1m) they will be removed in 30 seconds",RADIUS], 5] call mf_notify_client;
};

sleep 30;
if ( !(isNil "borderObjects") ) then {
{
	deleteVehicle _x;    
}forEach borderObjects;
borderObjects = nil;
};

Share this post


Link to post
Share on other sites

Worked prefectly, and thanks for cleaning up =)

Thank you very much Larrow

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  

×