Jump to content
Sign in to follow this  
frag

Executing script when the player looks thru the range finder.

Recommended Posts

Hi guys,

Let’s say I would like to see a hint “Looking thru range finder†as soon as a player uses the range finder (when he right click to look into it).

How I could do that? I would really like to catch that command that would let me know when the player starts looking thru the range finder.

Share this post


Link to post
Share on other sites

I don't think there is an exact command for this but I haven't checked to see if there are any new commands.

if (currentweapon player == "Rangefinder") then {hint "RangeFinder in Use};

would tell you if the RF was in the units hand but not if he's actually looking through it.

You could add a check to see if the right button is pressed while holding it.

Share this post


Link to post
Share on other sites

If you make an init.sqf file and place this in it it may help a little.

waituntil {!(IsNull (findDisplay 46))}; 

findDisplay 46 displayAddEventHandler ["MouseButtondown","if ((_this select 1)==1 and (currentweapon player == 'Rangefinder')) then {hint 'RangeFinder in Use'}"];

Share this post


Link to post
Share on other sites

Hi F2kSel...

good idea. I understand what you are trying to do here. But ... what the ((_this select 1)==1 does exactly? What does the _this select 1 represent?

Share this post


Link to post
Share on other sites

Use camera view to know if you are sighted or not.

if ( (currentWeapon player == "Rangefinder") && (cameraView == "GUNNER") ) then {
   hint "You are looking through your RangeFinder";
   //do stuff
};

Share this post


Link to post
Share on other sites

You guys are my angels ... everything works!

THANKS FOR THE HELP!

This forum is a bless.

Share this post


Link to post
Share on other sites

the ((_this select 1)==1 would be the button that is being pressed.

I think ((_this select 1)==0 left button and ((_this select 1)==1 is the right ect.

But (cameraView == "GUNNER") is a better solution for this problem.

Share this post


Link to post
Share on other sites
Use camera view to know if you are sighted or not.

if ( (currentWeapon player == "Rangefinder") && (cameraView == "GUNNER") ) then {
   hint "You are looking through your RangeFinder";
   //do stuff
};

That's really cool. Nice job.

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  

×