Home   Help Search Login Register  

Author Topic: Radial Array?  (Read 1491 times)

0 Members and 1 Guest are viewing this topic.

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Radial Array?
« on: 14 Mar 2010, 15:25:40 »
A complicated problem, at least as I see it.

How would I compile an array of every object within a specified radius of a soldier?

 ???
Snarling creature, lurking in the background, still writing in .sqs

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Radial Array?
« Reply #1 on: 14 Mar 2010, 18:27:11 »
Try:

_objectList = position mysoldier nearObjects <specified radius>


Planck
I know a little about a lot, and a lot about a little.

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: Radial Array?
« Reply #2 on: 14 Mar 2010, 20:03:13 »
ERROR Unknown operator nearObjects!

My line of scripting looks like this:

_targetList = position _c nearObjects 400

 :dry:

[EDIT] If someone could write me a .sqf file to do the job with minimum processing time I would be grateful.  :D
« Last Edit: 14 Mar 2010, 20:17:02 by Lone~Wolf »
Snarling creature, lurking in the background, still writing in .sqs

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Radial Array?
« Reply #3 on: 14 Mar 2010, 21:17:28 »
nearObjects is a A1/A2 command so that's why it doesn't work.

The problem is a bit complicated as you said because the command nearestObject has a 50 meter search radius limit, which means you would have to do a nested nearest object searches from positions around the soldier or something up until you reach the desired radius :dunno:
Maybe this would be of some help: improvedNearestObject.sqf :dunno:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: Radial Array?
« Reply #4 on: 14 Mar 2010, 21:31:05 »
Um, no offence but what does your script actually do?  ???
I've looked over it but can't figure out:

A.  How to use it.

[EDIT] Okay, I've determined what the script does, and it does exactly the same job as pablo's closesttarget.sqf script... which is to take an array and then determine the nearest object, backwards of what I need.  :confused:

B.  Whether it does what I asked - A .sqf file to create an array that consists of every object within a 500m radius of an object.

P.S. An alternative method, albeit more tedius, would be to add nearestObject returns to the array where it checked for the nearest object repeatedly in concentric circles around the player.
« Last Edit: 14 Mar 2010, 22:53:42 by Lone~Wolf »
Snarling creature, lurking in the background, still writing in .sqs

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Radial Array?
« Reply #5 on: 15 Mar 2010, 08:22:57 »
It's not my script, and didn't even check the script I linked, just thought it might have something in it that could steer you to the right direction.

I don't think what you want is possible/feasible because the only way to find objects in OFP is nearestObject, and it returns on single object per search, so you would need to do searches around the soldier for like 1 meter intervals until you have searched the whole 500 radius area which comes to hundreds, if not thousands of searches which would crash OFP in an instant.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Radial Array?
« Reply #6 on: 17 Mar 2010, 01:33:42 »
I made a function that finds multiple objects within a given distance of a given object. Actually, more than one function, one finds everything, the other finds objects of a given type. They are both attached. Instructions are in the function headers.

I do not advise using this function using a radius too large. I think that 500 m radius will probably crash OFP as h- says. You use it in a script that check smaller sections in a loop that will move the check area around until you cover the larger area. Or, if you do have a larger search radius, you could set the search increments to a large value (like 10 m), then you may be able to search a 500 m radius in one call of the function, but you would then miss many items. The largest area I have entered for the function is 150 m with a search increment of 5 m.
« Last Edit: 17 Mar 2010, 01:43:06 by Raptorsaurus »