Jump to content
DankanX37

Return the cursor position?

Recommended Posts

I'm trying to make a custom CAS Support, the problem is that I am not able to return the cursor position, I've tried both cursorTarget and cursorObject, but when I am not facing a target it return object nul, if I get the position of where I am facing it returns [0,0,0], is there a way to return the position of the cursor?

  • Like 2

Share this post


Link to post
Share on other sites

Yeah I think 

 

_wPos = screenToWorld [0.5,0.5]; 

 

does that

 

Wiki: "Returns the position on landscape (PositionAGL) corresponding to the given point on screen (in UI coordinates)."

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, gc8 said:

Yeah I think 

 


_wPos = screenToWorld [0.5,0.5]; 

 

does that

 

Wiki: "Returns the position on landscape (PositionAGL) corresponding to the given point on screen (in UI coordinates)."

 

Yeah that should do it,

Do you know a way of doing the same when using the map? So get the cursor coordinates on map screen into position?

Share this post


Link to post
Share on other sites
9 hours ago, the_one_and_only_Venator said:

 

Yeah that should do it,

Do you know a way of doing the same when using the map? So get the cursor coordinates on map screen into position?

 

If you want map click position there is onMapSingleClick command.

Share this post


Link to post
Share on other sites

_wPos = screenToWorld [0.5,0.5]; this works well

  • Like 1

Share this post


Link to post
Share on other sites

Hello there DankanX37 !

 

This way it will give you the enemy.

 

_target = cursorTarget;
_displayname = getText (configFile >> "cfgVehicles" >> typeOf _target >> "displayname");
_information =  format ["%1",_displayname]; 

 

Share this post


Link to post
Share on other sites

Related question for you guys:

How do I get the exact cursor position as you would for the basic "suppress" command. If I order a team member to suppress a target with vanilla actions, he will blast the exact spot I aimed at, not a cursorTarget or Object. How do I find that position and make him shoot at it the same way, but by script? screenToWorld and the others don't seem to work in this regard.
What I'm doing is having an assaultman shoot a rocket, which he does by removing primary weapon and suppressing. But I'm trying to do it through a single Ace action instead of having to find him and go through the action menu. So basically just point and shoot that spot. cursorTarget just has him aim at the base of a building, which for my purposes does not work. Maybe you've covered it already here but I can't seem to connect the dots.

Thanks guys

Share this post


Link to post
Share on other sites

Me and @Tankbuster needed a similar solution. screenToWorld always gives 0 for surface. Made a little hacky work around. I know this isn't exactly what you are after but thought I'd share anyway. I'm sure Tank will share his input on what we use it for. Debug:

[] spawn
{
	_ctrl = findDisplay 46 ctrlCreate ["RscPicture", 31357];
	_ctrl ctrlSetPosition [0.48, 0.4799, 0.04, 0.04];
	_ctrl ctrlSetText "\A3\ui_f\data\map\markers\military\destroy_CA.paa";
	_ctrl ctrlSetTextColor [1, 0, 0, 1]; 
	_ctrl ctrlCommit 0;
};

Probably a better way to do this but couldn't figure it out with drawIcon3D.

https://i.imgur.com/st8WiDn.jpg

https://i.imgur.com/9MgscfK.jpg

  • Like 3

Share this post


Link to post
Share on other sites

Hmm, tried it. that's pretty cool. Thanks for sharing. Might use it. How do I delete that marker after spawning it? So like, once I set the target? Sorry, I'm still pretty new to this. 

As for the "suppress exact spot" concept, I feel like it should be pretty straight forward. It's been in the game for awhile. Figured the syntax has got be posted somewhere..

Share this post


Link to post
Share on other sites
11 minutes ago, bcon117 said:

Hmm, tried it. that's pretty cool. Thanks for sharing. Might use it. How do I delete that marker after spawning it? So like, once I set the target? Sorry, I'm still pretty new to this. 

As for the "suppress exact spot" concept, I feel like it should be pretty straight forward. It's been in the game for awhile. Figured the syntax has got be posted somewhere..

https://community.bistudio.com/wiki/ctrlDelete

31357 is the IDC. I recommend not using display #46. It was just a quick example/test in debug.

  • 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

×