Jump to content
Sign in to follow this  
Tankbuster

object id in the editor. how to work with them?

Recommended Posts

Guys,

I want to collect an array of object ids of map objects that are in the editor. Specifically, those found by the nearRoads function.

But how do I work with the id?

hint format["%1", (getpos id438323)];

You get the idea, but what's the proper syntax, please?

Thanks,

T

Share this post


Link to post
Share on other sites

hint format["%1", (getpos object 438323)];

:rolleyes:

*UPDATE*

Command is not available in ArmA2.... =(

Edited by Buliwyf

Share this post


Link to post
Share on other sites
hint format["%1", (getpos object 438323)];

:rolleyes:

That's what i first answered, but it doesn't work since ArmA.

hint format["%1", (getpos player nearestobject 438323)];

should work.

Share this post


Link to post
Share on other sites
hint format["%1", (getpos player nearestobject 438323)];

should work.

That's returning the object, not its pos.

Share this post


Link to post
Share on other sites
That's returning the object, not its pos.

Ah yes, so try :

hint format["%1", getpos (getpos player nearestobject 438323)];

Share this post


Link to post
Share on other sites

Oui! Merci beaucoup

Don't worry. I won't punish you with any more of my French. :)

Share this post


Link to post
Share on other sites

This code gets me the ID's object name:

hint format["%1", (getpos player nearestobject 438323)];

But the object names usually have a .p3b at the end and wont let me work with the function !alive.

I want to see when the radar tower "telek1.p3b" has been destroyed.I have tried entering just telek1 and also tried enclosing "telek1.p3b" in quotes but that wont work as it turns it into a string and it is looking for an object.

Share this post


Link to post
Share on other sites

But the object names usually have a .p3b at the end and wont let me work with the function !alive.

Whenever an island object without a config class is queried like that, it will return its object id and model name but not its class because it does not have one. You always have to refer to it by its ID

Share this post


Link to post
Share on other sites

I figured out how to do it. I created a new variable named tower and assigned it the object ID in the following code:

tower = (getpos player nearestobject 438323);

now the variable "tower" seems to become a global variable with the ID so the variable seems to work as an object.

Now I can say:

!alive tower;

and it works as an object.

/////////////////////////////////

I have had problems with the above code before. Use MuzzleFlash's suggestion to store an ID in an object pointer:

myObj = [0,0,0] nearestObject 12346;

Edited by VISION1776

Share this post


Link to post
Share on other sites

That's excellent! I've actually moved on by doing what I wanted to do a totally different way, but that's useful to know anyway.

Share this post


Link to post
Share on other sites

I always use this instead of an actual object since this works on a dedicated too and doesn't rely on player variable being initialised:

myObj = [0,0,0] nearestObject 12346;

Share this post


Link to post
Share on other sites

It may be worth mentioning if your using the ID number of a building you can use triggers to achieve same thing without having to find the ID number.

Place a trigger over the building and group them to each other.

to give that building a global name just use this in the on act buildingname = thislist select 0

or if you just want to blow it up

(thislist select 0) setdamage 1

Share this post


Link to post
Share on other sites

all great stuff to know thanks.

---------- Post added at 11:10 AM ---------- Previous post was at 10:57 AM ----------

I dont expect anyone to answer this but just incase. I successfully got all this to work fine, but after some more editing of my mission in UTES I found that all of a sudden now the door on ID 296 remains open regardless of what commands I give it. Object 296 is a barracks to the north of utes in a fenced compound.

Has anyone experienced a similar problem before?

I am actually giving it the command:

barracks1 animate ["DOOR",1]; //this should close the door, it worked before.

Share this post


Link to post
Share on other sites

The problem is that you may have quit the mission while the door was moving. If I remember right you have to load a different map. Then when you load back the current map it will reset all the doors.

Share this post


Link to post
Share on other sites

thats a great idea will let you know if it works.

---------- Post added at 06:29 PM ---------- Previous post was at 06:25 PM ----------

yes it worked. 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  

×