Home   Help Search Login Register  

Author Topic: distance  (Read 1887 times)

0 Members and 1 Guest are viewing this topic.

Offline qba69

  • Members
  • *
distance
« 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?


Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: distance
« Reply #1 on: 18 Jan 2012, 19:10:51 »
For the first point, I would imagine something like this would work:

In the init line of object 1:

Code: [Select]
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.
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline qba69

  • Members
  • *
Re: distance
« Reply #2 on: 18 Jan 2012, 19:46:43 »
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):
 


Now, that's very strange to me ??? I mean the variance between 200m and 310m. Do you know how it works actually?

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: distance
« Reply #3 on: 18 Jan 2012, 19:56:49 »
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:

Code: [Select]
?((_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.

"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: distance
« Reply #4 on: 18 Jan 2012, 20:21:08 »
Quote
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? ;)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: distance
« Reply #5 on: 18 Jan 2012, 20:31:47 »
Haha  :-[  :D well as I said on another thread, all these years and I'm still learning something new about the game  :)
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline qba69

  • Members
  • *
Re: distance
« Reply #6 on: 18 Jan 2012, 20:55:13 »
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:)