Home   Help Login Register  

Author Topic: How to get a classname from an ID  (Read 3044 times)

0 Members and 1 Guest are viewing this topic.

Offline Nico [BOS]

  • Members
  • *
    • Communauté Francophone ArmA
How to get a classname from an ID
« on: 11 Nov 2009, 22:47:36 »
Hello,

I need to find the name (cfgVehicles) of this object :

It can be seen on Chernarus :
  • 124 028, with ID 95494,
  • 045 129, with ID 344585.
on Utes :
  • 043 018, with ID 10548.
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  :)

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: How to get a classname from an ID
« Reply #1 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.
Xbox Rocks

Offline Nico [BOS]

  • Members
  • *
    • Communauté Francophone ArmA
Re: How to get a classname from an ID
« Reply #2 on: 12 Nov 2009, 11:58:31 »
Thank you but it doesn't work. Even if I am very close to the object.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: How to get a classname from an ID
« Reply #3 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.
Xbox Rocks

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: How to get a classname from an ID
« Reply #4 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
I know a little about a lot, and a lot about a little.

Offline Nico [BOS]

  • Members
  • *
    • Communauté Francophone ArmA
Re: How to get a classname from an ID
« Reply #5 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  :)

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: How to get a classname from an ID
« Reply #6 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];
Xbox Rocks