Home   Help Search Login Register  

Author Topic: Objects vs Map Objects  (Read 3841 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Objects vs Map Objects
« on: 07 Jun 2007, 02:59:36 »
The nearObject command and all its variants do not return all objects on the map. In particular they do not return trees nor do they return walls. They return some pieces of fence but not others. Why is this and is there a work-around?
urp!

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Objects vs Map Objects
« Reply #1 on: 07 Jun 2007, 22:50:15 »
I would love the answer to this one too!  So far my work around has been pretty lame-- putting in game logics near objects i'd like to pull into scripts.  But putting 100 game logics into a mission is probably not a good idea   :no:
So please anyone who knows how to pull these objects into scripts like in OFP please post

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Objects vs Map Objects
« Reply #2 on: 07 Jun 2007, 23:39:59 »
I think Planck is your man for these matters.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Objects vs Map Objects
« Reply #3 on: 08 Jun 2007, 15:42:17 »
Yes, but Planck seems to be on an extended afk.
urp!

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Objects vs Map Objects
« Reply #4 on: 10 Jun 2007, 01:09:59 »
Well the plants and bushes in both OFP and Arma do not have classnames because they are not configured with one in any config.bin files.

There are various objects in both games that do not have classnames for the same reason, but they are normally used instead as .wrp embedded objects in the island .wrp files and for this reason do not require to have a classname declared in a config.bin file.

The model files for these objects declare what class type they are within the .p3d model file, so the engine knows what to do with them when it encounters them in an island .wrp file.

Consequently using commands such as typeOf and isKindOf, which both require a classname to work, will not give you anything useful as a result.

Incidentally, there is a second format for the isKindOf command which I added to the comref yesterday, though it won't help any to resolve this issue.   :P

Hope this has shed some light on the reasons why you fail to get a classname returned.   :cool2:


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

Offline Eymerich

  • Members
  • *
Re: Objects vs Map Objects
« Reply #5 on: 11 Jun 2007, 10:05:37 »
There is a smart way to do what your searching for.
It works well and you have to use only a single global array variable.

Just put any object on the map to "tag" the position you want.
In the init field of any object simply put this:

[getpos this, this, 0.(1 + any object on the map)] exec "GetPos.sqs"

;getpos

_Pos = _This select 0

_object = _this select 1

_time = _this select 2

(tilde)_time

PosArray = PosArray + [_Pos]

(tilde).1

deletevehicle _object

exit


In this way, you have a lot of position stored in the array, you can easly call with PosArray select (elment your interested in)

 :)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Objects vs Map Objects
« Reply #6 on: 11 Jun 2007, 20:55:53 »
But that does help the problem of wanting to be able to detect if a unit is near any given map object. It only provides a method of storing the positions of a finite set of objects for which you manually specify the ID and place an object near it.
« Last Edit: 11 Jun 2007, 20:57:39 by Mr.Peanut »
urp!

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Objects vs Map Objects
« Reply #7 on: 11 Jun 2007, 21:11:46 »
Yeh seems like we are still at an impasse.

For the mission I'm working on I'd end up with some 50 objects thrown into the array. (trying to use the map ID's to move around "sound candy" triggers with the player, like having a wolf trigger moved around to 10 of the objects, a chicken to another 10 objects near farms, etc etc).  Learned this idea from THobson's Abandoned Armies.  Not sure if adding another 50 objects into a global array would create lag and swamp things more or be a non-issue? What do you guys think? 


Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Objects vs Map Objects
« Reply #8 on: 11 Jun 2007, 21:18:18 »
I don't think it would be an issue at all.  This is very frustrating. You can not hook most objects of the map without knowing their ID. It is ridiculous.
urp!

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Objects vs Map Objects
« Reply #9 on: 11 Jun 2007, 21:50:23 »
ok thanks Mr. Peanut, and thanks Eymerich as well for the suggestion.  Well, after work it will be time to put in 50 objects for the moving sound candy!

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Objects vs Map Objects
« Reply #10 on: 12 Jun 2007, 19:00:13 »
Quote from: From fasad on BI forums
Code Sample: 
(nearestObjects [player,[], 10]) - ((getPos player) nearObjects 10)


Returns an array of objects within 10m of the player that have no class, including things like roads and trees.

Yes!
urp!

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Objects vs Map Objects
« Reply #11 on: 12 Jun 2007, 19:45:20 »
Yes, but..........this gives you the p3d model name of the classless objects.

The p3d model name does not always make it clear exactly what the object is.....for example  'plastovy_patnik.p3d' , 'ker_deravej.p3d' , 'asf25.p3d'.....etc......(plastic road post with reflectors , type of bush , 25 metre straight length of asphalt road).

You would need a huge list of these model names in order to find out what they were.   :blink:


Planck



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

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Objects vs Map Objects
« Reply #12 on: 12 Jun 2007, 20:05:48 »
Well, I am only interested in being able to access the object's boundBox, but I am sure similar objects share common (Czech)substrings in their p3d names, a list of which could be compiled. If BI ever includes a string comparison operator... well then the possibilities are endless.

There is already Kronzky's String functions which have an inStr function, but they use such brute force methods(padding a string to its size limit) that they create massive amounts of lag. For non time critical (>10s) applications, one could add sleeps to the functions so that the cpu drain is better distributed in time.
« Last Edit: 12 Jun 2007, 20:07:34 by Mr.Peanut »
urp!

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Objects vs Map Objects
« Reply #13 on: 13 Jun 2007, 18:23:56 »
I'm a bit confused as to this new idea,

I'm trying to move a trigger to the object ID location based on the player's movement. So if the player is closer to the object ID 1234 tree than he is object ID 6789 house, then the trigger which plays an Owl sound will move to object ID 1234.

Hypothetical example:

ArrayofSounds = [object ID 1234, 5678, tank1, object ID 6789]

ArrayofSoundtriggers =[Owl, Wolf, Owl]


Of course the problem is you can't just throw Object ID 1234 into an array and get what you want with Armed Assault, though you could with OFP.  Does this bounding box idea help solve this problem?  Sorry i'm a bit confused.
Thanks

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Objects vs Map Objects
« Reply #14 on: 13 Jun 2007, 18:46:28 »
Not really, Bounding Box is just the boundings of the object in object coordinates. But in a pretty loose way. For example, If you draw the Bounding Box of a Vulcan you will be quite surprised because it expands about 2m above Vulcan's turret (may be because the antenna), and same thing would happen with any object in the map. BoundingBox doesnt take care of main parts of an object, just the whole object limits.

On the other hand, BoundingBox would be a viable method to find some objects with quite particular properties like roads, because the relation between max height and max lenght or width would be always quite small because they are just flat squares, so you can effectively detect road segments. But this is not true with the trees as you have all kind of trees size-wise.