Jump to content
Darce

How do I get Classnames that aren't showing in the config?

Recommended Posts

I'm trying to find the classnames of objects in game which are not listed in the CfgVehicles for a map.
 
For example, in the Zargabad map I want to find the classname for the adobe walls which surround the smaller buildings.  After much messing around I came up with the following script which copies the classnames of all objects within a 50m radius.
 

private ["_pos","_radius","_objects","_startingInt","_c","_output"];
_pos = param [0, (position player)];
_radius = 50;
_objects = nearestObjects [_pos, [], _radius];
if (count _objects > 0) then {
	_c = 0;
	_output = "";
	_br = toString [13,10];
	{
		_obj = _x;
		_class = typeOf _obj;
		_output = _output + _br + _class;
		_c = _c + 1;
	} forEach _objects;
	copyToClipboard _output;
	hint "Copied to Clipboard";
};

 
Standing beside one of the walled compounds I get the following objects;
 

rhsusf_army_ocp_rifleman_1stcav
#mark
ButterFly_random
HouseFly
Mosquito
HouseFly
Land_Wall_L_2m5_gate_EP1

In addition there are stacks and stacks of blank lines, indicating objects which don't appear to have a name.  After much mucking about I think I've found that one section of the compound could be "Wall_L_2m5_EP1".  when I place that in the editor it appears identical, however that returns a name once the script is run.
 
So, how would I find out what the unnamed objects are?

Share this post


Link to post
Share on other sites

Here is a little utility function to use from the debug console.

EH = addMissionEventHandler ["Draw3D",{
	_objs = lineIntersectsObjs [ATLToASL positionCameraToWorld [0,0,0], ATLToASL positionCameraToWorld[0,0,100], objNull, objNull, true, 32];
	if ( count _objs > 0 ) then {
		_obj = _objs select (( count _objs ) -1 );
		currentObj = _obj;
		if ( typeOf _obj isEqualTo "" ) then {
			hintSilent str _obj;
		}else{
			hintSilent typeOf _obj;
		};
	}else{
		hintSilent "";
	};
}];

player addAction [ "Paste to clipboard", {
	if ( typeOf currentObj isEqualTo "" ) then {
		_stripIndex = (( str currentObj ) find " " ) + 1;
		_modelName = toLower( ( str currentObj ) select [ _stripIndex, ( count ( str currentObj )) - _stripIndex ] );
		_cfgs = [];
		"
			_model = getText( _x >> 'model');
		 	_cfgModel = toLower( _model select [ count _model - count _modelName, count _modelName ] );
		 	if ( _cfgModel isEqualTo _modelName ) then {
		 		_cfgs pushback configname _x;
		 	};
		"configClasses ( configFile >> "CfgVehicles" ); 
		systemChat format ["Object classes pasted to clipboard - %1", str _cfgs ];
		copyToClipboard str _cfgs;
	}else{
		systemChat format ["Object class pasted to clipboard - %1", str typeOf currentObj ];
		copyToClipboard str typeOf currentObj;
	};
}];
Run it once from the console and then look around and it will tell you in a hint what you are looking at, either a className like "Land_i_Shop_02_V1_F" or an ID:model like 69885: sacks_goods_f.p3d.

Whilst looking at the object, if you use the action menu there is an option called "Paste to clipboard" which will paste the objects className to the clipboard.

If the current object you are looking at does not show a className in the hint but instead shows ID:model the action will look through CfgVehicles and paste any classNames that use that model.

  • Like 4

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

×