Jump to content
obrien979

Face Targets towards firing platform

Recommended Posts

I am building ranges to use for sniper training and I am running into an issue.  Well more like laziness, but I cant figure it out.  I want to be able to place the targets down, manually adjust their heading (roughly facing the tower), but then at mission start I would like to run a script that adjusts their heading so that they all are facing the tower head on.  This would result in better visibilty of the targets for the sniper.  I noticed and played with the setDir command and was successfully with getting a single target to adjust heading (using the init. line on the target), but I have a different script that needs to be on the init. line for mission start.

 

ANy help would be great, Thank You

Share this post


Link to post
Share on other sites
3 hours ago, obrien979 said:

I am building ranges to use for sniper training and I am running into an issue.  Well more like laziness, but I cant figure it out.  I want to be able to place the targets down, manually adjust their heading (roughly facing the tower), but then at mission start I would like to run a script that adjusts their heading so that they all are facing the tower head on.  This would result in better visibilty of the targets for the sniper.  I noticed and played with the setDir command and was successfully with getting a single target to adjust heading (using the init. line on the target), but I have a different script that needs to be on the init. line for mission start.

 

ANy help would be great, Thank You

For ease of use you could select all targets, hit right click on one, then select attributes, make sure the title then shows: "Edit n objects".

This way you can mark all of them at once, using this snippet:

this setVariable ["TAG_rotate",true];

Now you can select all of them and rotate them from initServer.sqf or wherever you seem fit:

{
	_x setDir (_x getDir YourFiringPlatform);
} forEach (allUnits select {_x getVariable ["TAG_rotate",false]});

Either use allUnits or vehicles, depending on what your targets are.

Note that not all models seem to be configured with the actual front facing forward, no idea why, some chairs for example will face backward etc.

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites
this setVariable ["TAG_rotate",true];

What exactly does this do?

Share this post


Link to post
Share on other sites

it sets the variable TAG_rotate to value true in namespace of the object this.

it's like marking an object. read the wiki entry of setVariable for further information

Share this post


Link to post
Share on other sites
2 hours ago, obrien979 said:

this setVariable ["TAG_rotate",true];

What exactly does this do?

As @sarogahtyp explained, it sets a variable that can later be used to retrieve units marked with it using select and the array that's holding the unit.

Think of it as a color you're marking specific needles in a haystack with, then you filter through the entire haystack only picking needles of your specified color.

 

Cheers

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

×