OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Karik on 13 Dec 2004, 22:22:54
-
I'm trying to find one, and when I asked about that in "Addon ideas" someone told that maybe there is a script available?
If that script can be used for example with binoculars it would be most useful.
-
Well, if you have a squad under your command, you can just select one of your men with the F1-F12 keys, and then it will show you the distance to wherever the mouse is pointed.
This Q has come up a few different times, I believe. Scripting-wise, it can't be done, short of using a weapon that is fired, and the distance to impact calculated. But there is no way, scriptingwise, of knowing where a player is pointing in 3 dimensions, other than having him fire something (like a gun or laser designator).
So it could be done, but it would require making an addon of some sort in addition to the script, or else settling for having the player fire a gun or his laser designator, and calling it a rangefinder.
-
This isn't an offer to do it, but the following approaches seem[im]perfectly plausible if it's really necessary:
1) Scripting: use the laser designator as-is, capture the dot (fired EH to run script?), the dot's an object so should be able to do 'dot Distance player', tidy up the number and display. The downside is lugging the LD about; it won't do much for your concealment.
2) Script and config: it should be possible to config a new addon that's an LD 'weapon' that looks like the binocular 'weapon'. Then treat as above.
Firing the laser dot is a toggle so the script might have to loop and continuously display live range data. I suspect it's a unique simulation type so it seems unlikely that it could be changed to a 'single-shot' ranging; I've not seen the unencrypted config for the LD.
Nothing more than a flicker of an idea, but is the LD was configured for a 2-round burst, would that be dot-on, dot-off and would it be too quick to capture?
-
Yeah, you can do it. In fact, if you look at the CoC Unified Artillery package, I add Laser Rangefinder features to the laser designator; and if you look back into the archives of OFPEC forums, I even posted an example of how to capture the laser designator dot with one line of code in the activation field of a trigger.
The Laser Designator weapon type does work in the pistol slot as well, so you could conceivably make a weapon with binocular optics, that sits in the pistol slot (so Y brings it up) and that -- if you plafce a trigger on the map -- automatically gives the range when you "turn it on"