Jump to content
Sign in to follow this  
zonekiller

can you get a buildings objectID via a script

Recommended Posts

is there a way to get a buildings objectID via a script or command ?

Share this post


Link to post
Share on other sites

Why would you need that? Just open up the editor and look at the map. There you go.

Share this post


Link to post
Share on other sites

There's probably a way to hint format the nearObject ID. Your best bet is to find it in the editor though. Just compare maps.

Share this post


Link to post
Share on other sites
Theres a script called vehinfo.intro that would work. I tried to upload it but it wont let me

FYI... vehinfo.intro is a mission....not a script!

Scripts end in ".sqf" or ".sqs" not ".intro".... The intro part is the island. So it's a mission called vehinfo on the island intro!

Share this post


Link to post
Share on other sites

You can get the object id using nearObjects or a related command, but, it will be contained within a string like this:

26a6c800# 154058: trafostanica_velka.p3d

In the above 154058 is the object id. If you need to find it and use it in game you would have to do some string manipulation to strip it out.

What do you need the id for?

Share this post


Link to post
Share on other sites
you would have to do some string manipulation to strip it out.

If only we had more string functions!

Share this post


Link to post
Share on other sites

Here's mine that I just made.... will return the ID's of buildings. Not everyone uses CBA. I don't because I enjoy making my own stuff for what I need.

This is a first pass....very simple and probably can be done better...but it works well.

In your init.sqf:-

fnc_getBuildID = compile preprocessFile "fnc_getBuildID.sqf";

Create a file in your missions folder called "fnc_getBuildID.sqf";

fnc_getBuildID.sqf:-

/*

fnc_getBuildID.sqf - Twirly 22 Sept 2011
Function for returning building ID's

In your init.sqf:-

	fnc_getBuildID = compile preprocessFile "fnc_getBuildID.sqf";

Call with:-

	_id = [building] call fnc_getBuildID;

*/

private ["_build","_sn","_sf","_ef","_na","_id","_i","_item"];

_build = _this select 0;

_sn = toArray (str (_build));

_sf = false;_ef = false;_na = [];_id = 0;

for "_i" from 0 to (count _sn)-1  do {
_item = _sn select _i;
if (_sf and (not (_ef))) then {
	_na set [count _na,_item];
};
if (_item == 35) then {
	_sf = true;
};
if (_item == 58) then {
	_ef = true;
};
};

if ((count _na) >=3) then {
_na set [((count _na)-1) ,"delete"];
_na = _na - ["delete"];
_na set [0 ,"delete"];
_na = _na - ["delete"];
_id = toString (_na);
};

_id

Use like this:-

_id = [_build] call fnc_getBuildID;

Hope it helps.

Not really needed but....demo here.

Edited by twirly
Fixed errors & clarity

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  

×