OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Nico [BOS] on 11 Nov 2009, 22:47:36

Title: How to get a classname from an ID
Post by: Nico [BOS] on 11 Nov 2009, 22:47:36
Hello,

I need to find the name (cfgVehicles) of this object :
(http://img38.imageshack.us/img38/8875/transfoq.th.jpg) (http://img38.imageshack.us/img38/8875/transfoq.jpg)
It can be seen on Chernarus :
on Utes :
I tried to display the name with this little script :
Code: [Select]
_obj = ([0,0,0] nearestObject ID);
sleep 1;
hint format ["%1", (typeOf _obj)];
But it doesn't work with those ID.

So, do you know the name of this object or do you have an other way to display it ?

Thank You  :)
Title: Re: How to get a classname from an ID
Post by: hoz on 12 Nov 2009, 01:53:35
Put yourself near the object and then run this code...

_nObject = getPos player nearestObject 10548;
hint format ["%1", (typeOf _nObject )];

You need to be within 50 meters.
Title: Re: How to get a classname from an ID
Post by: Nico [BOS] on 12 Nov 2009, 11:58:31
Thank you but it doesn't work. Even if I am very close to the object.
Title: Re: How to get a classname from an ID
Post by: hoz on 12 Nov 2009, 15:26:36
This works for me.. by putting in a radio trigger...

Code: [Select]
nObject = getPos player nearestObject 95494;  hint format ["%1", nobject];
I suspect because this object is an island object it isn't able to return the typeOF because there is no config definition for it.
Title: Re: How to get a classname from an ID
Post by: Planck on 12 Nov 2009, 15:45:58
It has no classname, as hoz suspected it has no config entry anywhere, its model name is powlines_transformer1.p3d.


Planck
Title: Re: How to get a classname from an ID
Post by: Nico [BOS] on 13 Nov 2009, 02:00:22
Ok, like I can't use a creatVehicle on this object or check if it's alive or not, I found an other way to continue my mission.

Thanks a lot  :)
Title: Re: How to get a classname from an ID
Post by: hoz on 13 Nov 2009, 03:12:43
You can still check on the health of the object.

ObjLocal = nameofsomeyouplaced;
nObject = getPos ObjLocal nearestObject 95494; 
hint format ["%1",getdammage nObject];