OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: seanver on 29 Oct 2002, 21:50:30
-
Is there any way to know if a unit is looking at an object? Or at a direction, such as a range between 270 and 300 degrees, for example.
I'll explain what I want to do. I want the player to be able to execute an action if he's looking at an object. But he must be looking at it, so only a trigger with a small size is not enough. I need him to be seeing it, and besides (I know how to do that) he must be close enough. Ideas? Suggestions? An example mission? ::)
-
? getdir player > 270 and getdir player <300 and player distance objname < 10:[] exec "something.sqs"
:-*
8)PEACE
-
I'm not sure how to tell if someone is looking at something, but you can tell what direction the person is looking. Use the getDir command.
_dir = getDir player1
? (_dir > 270 and _dir < 300) : Do Something
[edit]Gameer_77 beat me to it. :)[/edit]
-
Thanks! I think that's enough, since the player will be in a room, the object's direction will be the same for the player at any position.