OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: qba69 on 18 Jan 2012, 19:04:51
-
A few issues regarding distance in OFP:
- I checked comref but can't see setDistance command:/ So how am I to place two units in exact distance from each other? Or make units follow e.g. tank in some specific range?
- While playing I noticed that AI units are very inexact in telling distance from enemy:/ For example - enemy tank spotted first time - AI unit says: "T80, 500m". And in just few moments the same units says: "Engage, T80, 200m". Why is that?
- I'm not sure but it seems to me that distance in OFP can be 50, 100, 200, 500, 1000 meters (and some more I assume but never experienced). Am I right? Btw, that would explain an issue mentioned above I guess?
-
For the first point, I would imagine something like this would work:
In the init line of object 1:
this setpos [(getpos object2 select 0) + 250, (getpos object2 select 1), 0]
Unless I'm mistaken, that should put object1 250m to the west(?) of object2.
Syntax not guaranteed.
As for the second point, I came to the conclusion that the AI rounds the distance up or down to certain distances, like 50, 100, 200 etc.
-
Thank you very much for that code - works like a charm:)
But here's a new issue regarding distances in OFP. I put 315 instead of 250 in that code to see how AI unit will "see" it. And here's what I got (click to enlarge):
(http://img812.imageshack.us/img812/746/distancen.th.jpg) (http://imageshack.us/photo/my-images/812/distancen.jpg/)
Now, that's very strange to me ??? I mean the variance between 200m and 310m. Do you know how it works actually?
-
Hmm very interesting indeed.
I suppose that, somewhere amongst all of the scripts that make up OFP, are a series of conditions that determine which distance should be said in the radio.
If we use 315 as an example:
?((_unit distance _spotter) < 500) and ((_unit distance _spotter) >= 200): _unit groupRadio _ogg
That's my guess anyway. It would probably be more complex than that, but I imagine it's something along those lines. So basically if the spotter was less than 500m away but greater or equal to 200m away, then he would say that the _unit was 200m away.
-
somewhere amongst all of the scripts that make up OFP
The game is not written in the scripting language :P
This AI stuff is done within the game code (C++, or whatever), not with any scripts..
But it is pretty much like you put it, the AI spotted distance is rounded up/down with some criteria, it simulates the AI estimating the distance (for one, other reasons exist most likely).
After all you can't tell exactly how far something is when you see it, can you? ;)
-
Haha :-[ :D well as I said on another thread, all these years and I'm still learning something new about the game :)
-
But it is pretty much like you put it, the AI spotted distance is rounded up/down with some criteria, it simulates the AI estimating the distance (for one, other reasons exist most likely).
After all you can't tell exactly how far something is when you see it, can you? ;)
Yes, that is most likely the main reason for making it work that way. And another might have been that they would have had to record over 2000 different radio messages for every single distance;o
But at least command distance works correctly - and can read range between two objects accurately:)