Jump to content
Sign in to follow this  
dnl04

Checking if an unit is being aimed at

Recommended Posts

Good morning Ladies and Gentlemen,

First of all, I have no clue nor experience on how to script advanced stuff, but I've been recently wondering whether it would be possible to check, using some function that I may not be aware of, whether a (civilian) unit is being consciously aimed at/targeted within a certain radius/range like, let's say... 5 meters or something similar.

The hypothetical scenario I would like to achieve, is the following:

I would like to trigger a predetermined reaction when a certain unit is aware that he's being, like I said before, aimed at by a Bluefor soldier, but I'm not sure if such a thing is doable in an easy and struggle-free manner.

Is there a command/function that I may study?

Thank you in advance for the suggestions.

Share this post


Link to post
Share on other sites

Not sure it's possible.

The best thing I've been able to do on this matter is that:

 

Where's the code or script used in this video?

Share this post


Link to post
Share on other sites

Where's the code or script used in this video?

 

Initial code is coming from here: http://rte.jonasscholz.de/blog/rte.jonasscholz.de/blog/2009/11/05/new-to-arma-2-fsm-a-sample.html

 

You can find my version there: https://www.dropbox.com/s/2q37ntlcw8ct0ip/surrender2.fsm?dl=0

 

Add that in the init line of your unit: this dofsm ["surrender2.fsm", position this, this];

and make sure to call the bad guy VIP

 

the fsm is rather crude as I had to hack it to make in MP compatible (working on a dedi), handle some issues with animations in A3 and make it compatible with the handcuff part of ACE.

it clearly needs polish (and if the flyby bullet part is still there, it needs to be deleted).

  • Like 2

Share this post


Link to post
Share on other sites

Not sure it's possible.

The best thing I've been able to do on this matter is that:

Great showcase..

That's exactly one of the things I was trying to accomplish, man: I will check your code out as soon as possible, it looks very interesting and quite reliable.

Thank you for the useful material you've provided, It'll be analyzed.

Share this post


Link to post
Share on other sites

So, according to the first link you've posted, the line "cursorTarget == _target" can used to check whether the unit is targeted by the player. Am I wrong?

I'm not an expert on this argument, so i apologize for my ignorance.

Share this post


Link to post
Share on other sites

So, according to the first link you've posted, the line "cursorTarget == _target" can used to check whether the unit is targeted by the player. Am I wrong?

I'm not an expert on this argument, so i apologize for my ignorance.

 

it's more "looked at" instead of "aimed at" but yes, your're right.

Share this post


Link to post
Share on other sites

Take a look at this one:

https://forums.bistudio.com/topic/175819-release-function-aimedat/

 

It will give you more options and tolerance than cursorTarget and is still rather performance friendly.

 

 

The technique is actually rather simple.: I use the normalized weaponDirection, multiply it by the distance to the target and then check how far away that position is from the actual target. This allows it to work even if you aim in the general direction of someone, without having him exactly under your crosshairs.

 

 

Otherwise I'd recommend using the new cursorObject instead of cursorTarget. Also use an incremential variable so the target only feels threatened if you aim at him for a certain time and not immediately.

  • Like 3

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  

×