Jump to content
lexx

Getting cursor position in Tactical View

Recommended Posts

Ok, people, I require some help again.

 

What I have: A CommunicationMenu entry that will send a group to a certain position.

 

What I want to do: It should work exactly the same way as the current CAS implementation does. I can get this to partly working with screenToWorld when "looking around normally", but of course this does not work when in Tactical View, which is a problem and I have no clue how to solve this. Also, it doesn't work when on the map screen.

 

Anyone got any clue for me? Maybe there is already some premade function for something like this?

Share this post


Link to post
Share on other sites

Wow, never tried to do something while in tactical view, but for the map part you should be able to detect an open map and switch your pos to onMapSingleClick instead of screenToWorld.

Share this post


Link to post
Share on other sites

Yeah, screenToWorld and onMapSingleClick are easy, but I have no idea how to deal with the tactical view. I mean, it's used for ordering units around already anyway, so it can't be that hard to do the same... or can it?

Share this post


Link to post
Share on other sites

Comms menu already returns the place your are looking in all views(FP,TP,Map and TV) in a local variable called _pos, see the documentation HERE under Expression Arguments.

Quick example using commanding menu, I know its not the Supports but it is the same thing in essence just set up slightly different rather than a class in your description.ext its a global var as below.

MyCommsMenu =
[
	["MenuName",false],
	["Teleport", [2], "", -5, [["expression", "
		h = _pos spawn { 
			Player setvariable [ 'tpos', _this ];
			TGROUPS = [ ['Groups',false] ];
			{
				_nul = TGROUPS pushback call compile format[ ""['Teleport %1', [2], '', -5, [['expression', '%1 SetPos ( player getvariable ''tpos'' );']], '1', '1', '']"", _x call BIS_fnc_objectvar ];
			}foreach ( player nearEntities [ 'Man', 10 ] );
			sleep 0.1;
			showCommandingMenu '#USER:TGROUPS'
		};
	"]], "CursorOnGround", "1", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"]
];
showCommandingMenu '#USER:MyCommsMenu';

Also see the note by LaKing HERE for enable/simple argument options. Im not sure all of them still work but 'CursorOnGround' definately does and maybe handy for you for selecting teleport positions.

Share this post


Link to post
Share on other sites

Awesome! I knew there must be an easier way. Works perfect and I was able to reduce my code by a few lines.

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

×