Jump to content

Photo
- - - - -

Classname for fence?


  • Please log in to reply
8 replies to this topic
Thread Starter
JacobJ
JacobJ

    Staff Sergeant

  • Members
  • 307 posts

Posted 23 February 2012 - 10:47 #1

Hey all

I am trying to find a classname for fence or walls. I already know "building" and "house", but can't seem to find anything coming close to fence or walls. Is there such a classname?

/Jacob
21vb.dk ftw!

PELHAM
PELHAM

    I shall not insult moderators

  • Banned
  • 1576 posts

Posted 23 February 2012 - 11:45 #2

This might help you. It spits out class names for objects not in the editor too (Not written by me, found it somewhere):

//Identify closest object
while {true} do
{	
	//get all objects within a 5 metre radius
	_all_objects = [];
	_all_objects = nearestObjects [player, ["All"], 5]; 
	
	if ((count _all_objects) > 1) then
	{	
		//identify the closest object to player
		_closest_object = _all_objects select 1; 
	
		//find out its type 
		_object_type = typeOf _closest_object;
	
		//hint type
		hint format ["%1", _object_type];
	};
	sleep 2;
};


Thread Starter
JacobJ
JacobJ

    Staff Sergeant

  • Members
  • 307 posts

Posted 23 February 2012 - 13:28 #3

Okay thank you very much. Ill have a go with this.
21vb.dk ftw!

PELHAM
PELHAM

    I shall not insult moderators

  • Banned
  • 1576 posts

Posted 24 February 2012 - 03:50 #4

Okay thank you very much. Ill have a go with this.

That first script is for objects, this will work for buildings and some associated walls.:

house = nearestBuilding player;
m=0;
while { format ["%1", (house) buildingPos m] != "[0,0,0]" } do {m=m+1}; 
m=m-1; 
player globalchat format["%1 \npositions: %2", typeof house, m+1];
sleep 2;
copytoclipboard str([typeof house, m+1]);

You call it from a radio trigger.
This will give you some wall class names but NOT fences. Fences do not have a config entry as it's something you can only place when editing islands. I thought it might work as it returns walls but tested some fences and then worked out why I it returned nothing. The object script in post 2 will give you class names for fences placed in editor.

Edited by PELHAM, 24 February 2012 - 14:09.
additional info


Engima
Engima

    Sergeant

  • Members
  • 151 posts

Posted 24 February 2012 - 09:36 #5

How I do it:

1. Start editor.
2. Create a new mission from scratch.
3. Insert unit with the unknown class name.
4. Save mission.
5. Open the mission file (mission.sqm) in Notepad and read the class name.
Engima spells E-n-G-I-m-a

PELHAM
PELHAM

    I shall not insult moderators

  • Banned
  • 1576 posts

Posted 24 February 2012 - 14:17 #6

Had a go with the object script on editor placed things and got these with editor placed objects:
"Fence_corrugated_plate"
"Fence_Ind_long"
"Fence_Ind"
"Fort_RazorWire"
"Land_BagFenceLong"
"Concrete_Wall_EP1"
"Fort_StoneWall_EP1"
"Base_WarfareBBarrier10xTall"
"Base_WarfareBBarrier10x"

Changed the script to make it more user friendly - if you run this from a 'radio alpha' trigger, repeatedly, on act: nul = [] execVM "objfinder.sqf"; keys 0-0-1
It will copy the nearest object to the clipboard, just Alt-Tab and paste it into notepad.

//Identify closest object

private ["_closest_object","_object_type","_all_objects"];

	//get all objects within a 5 metre radius
	_all_objects = [];
	_all_objects = nearestObjects [player, ["All"], 5]; 
	
	if ((count _all_objects) > 1) then
	{	
		//identify the closest object to player
		_closest_object = _all_objects select 1; 
	
		//find out its type 
		_object_type = typeOf _closest_object;
	
		//hint type
		player sidechat format ["%1", _object_type];
		copytoclipboard str([_object_type]);
	};


Thread Starter
JacobJ
JacobJ

    Staff Sergeant

  • Members
  • 307 posts

Posted 24 February 2012 - 15:09 #7

Okay thank you all very much, this is some very easy ways to do it. I will give them a go and check out how they work.
21vb.dk ftw!

gammadust
gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

Posted 24 February 2012 - 16:37 #8

Yet another alternative: pointing to object to get class instead of nearest objects.

Add this to "init.sqf":
player addAction ["Check object class (cursor)", "checkclass.sqf"];

Create a "checkclass.sqf" with:
_object_type = typeOf cursorTarget;
hintSilent format ["%1", _object_type];
copytoclipboard str(_object_type); // also copies to clipboard but as a simple string you won't get a list of objects with this method

may get handy if the object is not reachable.

PELHAM
PELHAM

    I shall not insult moderators

  • Banned
  • 1576 posts

Posted 25 February 2012 - 01:18 #9

Yet another alternative: pointing to object to get class instead of nearest objects.
Add this to "init.sqf":


That's a good one, saves HALOing onto things lol.