thursday_0451 1 Posted February 8, 2020 (edited) Hello! I am a total noob to Arma 3 scripting, but have experience programming in javascript, python, lua, etc as both a hobbyist and a professional. I'm attempting to make my own game mode where one of the features will be ambient civillian AI will populate Tanoa to add a sense of life to the game. I want to be able to have the civillian AI interact with as many objects as possible, but for starters, it would be nice if I could get them to sit in benches and chairs. So, two real questions: 1) Is it possible via sqf scripting to tell an AI civillian to sit in a chair or bench? 2) What function would I use to say, make an array of all nearby sittable chairs and benches? I have tried nearObjects and nearestObjects and allSimpleObjects, but none of them return anything like benches or chairs. I am either unaware of how to use the syntax properly ("EMPTY" doesn't work "empty" doesn't work) or there is maybe another function I haven't found yet? I was succesful in using nearestTerrainObjects to return all buildings and some other objects and classify them for the purpose of spawning appropriately clothed civillians according to building type, but I cannot figure out how to reference... would you call them props?... such as benches and chairs. Any help would be appreciated. If someone has already made a script that does something like this, I could probably reverse engineer it / use the same method they did. Edited February 8, 2020 by thursday_0451 Share this post Link to post Share on other sites
RCA3 581 Posted February 8, 2020 (edited) Hey, welcome to the forums. Just a little help from my part: Quote hint str (nearestObjects [player, [], 5]); nearestObjects returns me a bench from world objects: Quote [60615: bench_01_f.p3d] ACE3 has a whole system for sitting but it's player only: fnc_sit.sqf sitting.md sitting-framework.md Edited February 11, 2020 by RCA3 1 Share this post Link to post Share on other sites
thursday_0451 1 Posted February 10, 2020 Thanks for the help RCA3! I was overloading nearestObjects with too many arguments, apparently. I had two false on the end after the distance, got rid of both of those and it works... but... It grabs literally every object if you leave the category array empty. Is there a way to grab only benches and things like that, without grabbing things that nearestTerrainObjects grabs? I've already sorted through all the buildings, calling every object again is redundant, and I think there are so many trees that its overloading something, as attempting to make an array of object and making a map marker for them is taking over an hour for my computer to do. I thought that nearestObjects [player, ["EMPTY"], 100]; is supposed to work... but it just grabs nothing. 1 Share this post Link to post Share on other sites
RCA3 581 Posted February 11, 2020 Adapted from @killzone_kid note at nearestObjects: Quote private _benchs = []; private _chairs = []; { if (str _x find ": bench_" > -1) then { _benchs pushBack _x; //you can use _benchs pushBack (getPos _x) here for positions. }; if (str _x find ": chair" > -1) then { _chairs pushBack _x; //you can use _chairs pushBack (getPos _x) here for positions. }; } forEach nearestObjects [player, [], 100]; hint str [_benchs, _chairs]; 1 Share this post Link to post Share on other sites
thursday_0451 1 Posted February 19, 2020 Quote Quote for [{_i = 0}, {_i < 10}, {_i = _i + 1}] do { { if ( (str _x find "bench" > -1) ) then { _allSittable pushBack _x; //you can use _benchs pushBack (getPos _x) here for positions. }; } forEach nearestObjects [[worldSize / 2, worldsize / 2, 0], [], worldsize*2]; }; { if (_debugObjects) then { [str _x, getPos _x, "mil_triangle", "ColorPink", str ((getModelInfo _x) select 0)] call SetDebugMarkerAllClients; }; } forEach _allSittable; In case anyone else is trying to do the same thing I'm doing, this is what ended up working for me. I had to put the whole thing in a for loop because for some reason it wouldn't grab everything with just one pass. Share this post Link to post Share on other sites
Dedmen 2588 Posted February 19, 2020 4 hours ago, thursday_0451 said: for [{_i = 0}, {_i < 10}, {_i = _i + 1}] do I don't see any sense in calling nearestObjects on the whole terrain 10 times in rapid succession.... private _allSittable = (nearestObjects [[worldSize / 2, worldsize / 2, 0], [], worldsize*2]) select {"bench" in str _x}; Better, but still pretty terrible. 2 Share this post Link to post Share on other sites