Home   Help Search Login Register  

Author Topic: Detect if player is Zoomed  (Read 1795 times)

0 Members and 1 Guest are viewing this topic.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Detect if player is Zoomed
« on: 08 Feb 2009, 07:36:22 »
Hi all,

Is it possible to detect if player is zoomed in on optics?

Thanks!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detect if player is Zoomed
« Reply #1 on: 08 Feb 2009, 08:47:51 »
I think it is not possible. I see no way to get the current FOV or the current camera.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Detect if player is Zoomed
« Reply #2 on: 08 Feb 2009, 11:52:36 »
maybe checking memory points and their position works?
« Last Edit: 09 Feb 2009, 19:53:41 by kju »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Detect if player is Zoomed
« Reply #3 on: 08 Feb 2009, 21:09:05 »
You can get the FOV from ArmAlib which I've used successfully to check for being zoomed in. I've tried hard to work it out myself and got nowhere with vanilla ArmA.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: Detect if player is Zoomed
« Reply #4 on: 08 Feb 2009, 23:53:36 »
 depending on the scenario , you could get a rough workaround using vanilla , simply by tracking the zoom key and the pressing of it.
 Of  course this would heavily depend on the circumstances for which you need to know if someone has zoomed on a scope and how much detail regarding the zoomage myou need to know and at what point in a mission or within an addon to activate whatever the next step maybe.

 my 1 cent (credit crunch)

 DB
I love ofp

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Detect if player is Zoomed
« Reply #5 on: 09 Feb 2009, 02:50:57 »
kju:  I don't understand your suggestion.  What is a "memories point"?

Mando and Spoon:  Thanks for the replies.  ArmaLib is overkill for what I was hoping I think.

I have a script where a unit is attached to a vehicle (back of a truck or whatever) via setpos loop, but player or AI that is attached can rotate and shoot.  When attached, there direction is fixed, but a unit (AI or  player) can move his gun about 10 degrees right or left (normal ARMA aiming allows weapon to float left or right a little before body turns, which changes unit's dir).  I test WeaponDirection to see if it has moved 8 degrees from unit Direction, and if so, rotate the unit a little.  This allows player to use the mouse to rotate left and right smoothly for shooting.

However, when zoomed in or using a scope, the Weapon Direction is fixed, or reduced to only a few degrees of movement.  If I set the threshold down to a one or two degrees, then they spin too fast when not zoomed.

So I was hoping to be able to detect Zooming, and then I would set the rotate threshold to only one or two degrees for Zoom view...
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Detect if player is Zoomed
« Reply #6 on: 09 Feb 2009, 07:27:39 »
Another option would be to prevent or force zooming, though I'm not sure that is useful in your situation. It would produce consistency though:
Code: (force non-zoom view) [Select]
player switchCamera "INTERNAL";
Code: (force zoomed view) [Select]
player switchCamera "GUNNER";
You'd need to continually run this command to keep the player in the specific mode though, which you could do at the same time as you are setPosing him. Another side-effect would be that it would disable 3rd person view.

Anyway, probably not directly useful to you, but it might be of use to someone else needing absolute knowledge of whether the player is zoomed in.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Detect if player is Zoomed
« Reply #7 on: 09 Feb 2009, 07:37:36 »
Deano said:

Quote
depending on the scenario , you could get a rough workaround using vanilla , simply by tracking the zoom key and the pressing of it.

I thought about this, and have done key press things before, but since people can map their keys anyway they want, how do we know its the zoom key?

Is there a command that tells us which keys are bound to which functions?  I've wanted to know this before for other cases...
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detect if player is Zoomed
« Reply #8 on: 09 Feb 2009, 08:22:19 »
This is a way to list them all:
Code: [Select]
_msg = "";
for [{_i=1},{_i<238},{_i=_i+1}] do
{
   _msg = _msg + format["%1 - %2\n", _i, keyName _i];
};
hint _msg;

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Detect if player is Zoomed
« Reply #9 on: 09 Feb 2009, 19:56:59 »
http://community.bistudio.com/wiki/actionKeysNames
http://community.bistudio.com/wiki/actionKeys

http://community.bistudio.com/wiki/Oxygen_2_-_Manual#Memory

characters.pbo/config.cpp
Code: [Select]
class CAManBase: Man
...
memoryPointLStep = "footstepL";
memoryPointRStep = "footstepR";
memoryPointAim = "aimPoint";
memoryPointCameraTarget = "camera";
memoryPointCommonDamage = "l_femur_hit";
memoryPointLeaningAxis = "leaning_axis";
memoryPointAimingAxis = "aiming_axis";
memoryPointHeadAxis = "head_axis";

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: Detect if player is Zoomed
« Reply #10 on: 09 Feb 2009, 20:16:09 »
Quote
I thought about this, and have done key press things before, but since people can map their keys anyway they want, how do we know its the zoom key?
Yeah that could be a problem , i wasnt sure what you wanted this for mate, if is for a cutscene then a rough workaround is ok, but the speed and accuracy you need here expecially in mp , you need a really efficient way .
 On the oher hand :)0. let me throw a curveball at you, its something i have often thought of but will never have the time to do.

 why dont you if this is for use on an addon vehicle . take a bis man mlod and make it a part of the vehicle and use the dik code for getting wasd keys .
 place the unit int the turret which is a man with a gun and part of the vehicle .and animate the turret on the vehicle , you have all the anims ready made.
 you can set object texture the whole man shape and apply the right kind of clothing (cept intricate pouches etc).
 it will all be good in mp and you could get away with some generic gun shape i guess ?
 sounds cheesy huh , but i think personally its better than the ,now you see me here ,err no iam over her we get by using setpos in mp.
   
 anyway good luck wth which ever way you use.

I love ofp

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Detect if player is Zoomed
« Reply #11 on: 09 Feb 2009, 20:52:38 »
Thanks for the suggestion Deano.

I think the Addon suggestion is the best solution for my Molotov Cocktails for MP also.  Seems like it shouldn't be too hard to inherit from grenade class, use the graphic images for the Arma bottle in place of the grenade, and replace an explosion with my fire scripts.

However due to time constraints, I'm not willing to take on the whole addon learning curve.

This script is fairly usable as is for SP.  If there is lag in MP I suspect the setpos loop will have issues like you said (I haven't tested it).
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Detect if player is Zoomed
« Reply #12 on: 12 Feb 2009, 10:23:40 »
actionKeys will tell you which keys are attached to which functions, but it would be hard to track them at all accurately (immediately lose track if someone has V as zoom and ctrl-V as speak, for example, necessitating you tracking all actions and all key presses). Maybe in a very simple mission without any addons you could track them to a reasonable degree, but the killer issue is that most people attach zoom to right-mouse-button which can't be detected via key handlers.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)