Jump to content
Sign in to follow this  
dr_eyeball

Get ID of object

Recommended Posts

Quick question:

Q: How do you get the (Visitor) ID of a static object (like a house) programmatically?

(Assuming you've got an object variable of the house already using something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Houses = [getPos _unit select 0, getPos _unit select 1] nearObjects ["House", 50];

_House = _Houses select (floor (random (count _Houses)));

_id = ? ? ?;

...

_waypoint = _group addWaypoint [ position _House, 0 ];

_waypoint waypointAttachObject _id; // <- need the id for here

_waypoint setWaypointHousePosition 1;

There are lots of functions to get an object from an ID, but I don't see one going the other way.

Thanks in advance.

Share this post


Link to post
Share on other sites

might need to set your own once you have your obj:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_id = _House setVehicleId 1

setVehicleId

Share this post


Link to post
Share on other sites

The id from SetVehicleId doesn't appear to be suitable for the waypointAttachObject where I need it.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waypoint waypointAttachObject idStatic

There must be a way to get the proper static ID.

Edit: Or it may be that waypointAttachObject doesn't work, even with a valid ID from the map.

There doesn't seem to be a way to get the number of house positions in a building either, for use by setWaypointHousePosition.

Share this post


Link to post
Share on other sites

That's a tricky one since object ID has been removed there is the workaround with nearestposition to at least get a pointer to the map objects, but for the actual ID i have no clue.

I wonder anyway why BIS removed the object ID option,

since you still can change objects in the map, it's just slightly more complicated, so it can't be to prevent cheating or some similar motivation. Have you tried out SenseleSS Violence's tip?

Share this post


Link to post
Share on other sites

Isnt there just a button in the editor saying Show ID's

And when you press it and zoom in enough it shows you the object ID's?

Or did they removed that option?

Share this post


Link to post
Share on other sites

Right, there is that editor option , i assumed he wants to retrieve the ID with a script, but that would be the easiest way wink_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]I wonder anyway why BIS removed the object ID option

afaik its related to the streaming engine - better ask an expert here though.

Share this post


Link to post
Share on other sites

As far as I know (I have v1.02) the option 'Show IDs' works... At least it does for me - I see the IDs...

Share this post


Link to post
Share on other sites

Yes I know "Show ID's" button works, but I need to deal with hundreds of ID's randomly based on their class type, so you can guess now that I wanted it to be obtained programatically.

I guess I just wanted confirmation whether a command for it exists, given that some commands still expect a StaticObjectID instead of the object itself, with no way of automatically obtaining it. Reading elsewhere, apparently OFP had a suitable command but it's not in ArmA.

Thanks.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×