Jump to content
Sign in to follow this  
Nephris1

cursorTarget and key

Recommended Posts

Is it possible to use "cursorTarget" and pressing a key like "shift" or a rmb click to identifie an object?

Atm i am using "cursorTarget", coz "knowsabout" is not liable enough, as u can see an object, but the engine sometimes doesnt assign a correct value, to ask for.

But "cursorTarget" only, is a bit less, as a player could also just mark the object by chance, coz his "rifle" just brushed the object by chance, although he doesnt really know about it.

Inthis case a combination of "cursorTarget" and a confirming click would be cool and imho the solution, to identifie the object.

I know we can use shift and alt as default e.g. in onmapclick, but i dont want to open the map.

I hope i was able to express what i actually wanna try to do.

Any ideas?

Edited by Nephris1

Share this post


Link to post
Share on other sites

Use displayAddEventHandler. If you have Domino (scripts\UAV\Engine.sqf), this technique is used by the UAV operator (RESCUE2) to order the UAV to increase or lower the UAV altitude (it's remote controlled now, player is not in UAV), or to place temporary UAV markers. Not in vanilla Domination, not yet anyways, maybe in D4? Xeno? ;)

Share this post


Link to post
Share on other sites

This should do what you ask for. I'm typing from the top of my head so please excuse any syntax errors there could be. Copy it to your init.sqf.

TAG_onKeyDown =
{
    private ["_key", "_return"];
    _key = _this select 1;
    _return = false;
    if (_key == 42 && !isNull cursorTarget) then //L Shift
    {
         if (cursorTarget == dude1) then
         {
              hint "This is dude1!";
              _return = true;
         };
    };
   _return
};

waitUntil {!isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler ["keyDown", "_this call TAG_onKeyDown"];

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  

×