MrCrazyDude115 132 Posted February 2, 2020 Hey guys! I know I post a lot of questions here, hope I'm not bothering anyone! Basically, I'm using this script to add an ACE action to a specific classname. ["CUP_clutter_mochomurka", 0, ["ACE_MainActions"], _gatherMushrooms] call ace_interact_menu_fnc_addActionToClass; This works fine, but only if I manually place down or spawn the classname as an object. How can I create a loop which checks terrain objects for this classname, and adds the action to all of them? Any help will be greatly appreciated, thank you! Share this post Link to post Share on other sites
runy888 19 Posted February 2, 2020 Have you tried adding a regular (non-class specific) interaction to objects returned by the nearestTerrainObjects command? Don't have my PC here so I can't test it right now. Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted February 2, 2020 3 hours ago, runy888 said: Have you tried adding a regular (non-class specific) interaction to objects returned by the nearestTerrainObjects command? Don't have my PC here so I can't test it right now. How can I do that? Share this post Link to post Share on other sites
Vandeanson 1677 Posted February 2, 2020 Yo mate Look for model names of nearby terrain objects, not classnames. Most map objects dont have a classname https://community.bistudio.com/wiki/getModelInfo Cheers Vd 1 Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted February 2, 2020 10 minutes ago, Vandeanson said: Yo mate Look for model names of nearby terrain objects, not classnames. Most map objects dont have a classname https://community.bistudio.com/wiki/getModelInfo Cheers Vd Ahh! Lemme give it a try! Share this post Link to post Share on other sites
runy888 19 Posted February 2, 2020 5 hours ago, MrCrazyDude115 said: How can I do that? To elaborate on my suggestion, here is what I meant: Quote // First create your ACE interaction here private _gatherMushrooms = XYZ... // Now you make an array with ALL terrain objects on the map private _terrainObjects = nearestTerrainObjects [[worldSize / 2, worldSize /2, 0], [], worldsize / 2]; // Now go through every single entry in that array { // Only apply code if the object is of the type that you are looking for if (typeOf _x == "CUP_clutter_mochomurka") then { // Now you add the ACE interaction to the object [_x, 0, ["ACE_MainActions"], _gatherMushrooms] call ace_interact_menu_fnc_addActionToObject; }; }; Note that this code is untested and I guarantee no success or absence of harm when executing it 😛 1 Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted February 3, 2020 6 hours ago, runy888 said: To elaborate on my suggestion, here is what I meant: Note that this code is untested and I guarantee no success or absence of harm when executing it 😛 Gonna try this now! EDIT: NO luck. 😞 Share this post Link to post Share on other sites
runy888 19 Posted February 3, 2020 10 hours ago, MrCrazyDude115 said: Gonna try this now! EDIT: NO luck. 😞 Ehrm that's not exactly how you bugfix. Look at any error messages and try to cut down the code until you find the point that causes problems. At the very least, describe what exactly doesn't work. Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted February 3, 2020 4 hours ago, runy888 said: Ehrm that's not exactly how you bugfix. Look at any error messages and try to cut down the code until you find the point that causes problems. At the very least, describe what exactly doesn't work. No errors, just doesn't work. I tried also using getModelInfo and used the .p3d instead of the class but it didn't work either. Share this post Link to post Share on other sites
Freddo3000 74 Posted February 3, 2020 You could have a look at how ACE implemented it for their rations frameworkhttps://github.com/acemod/ACEX/blob/master/addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf 1 Share this post Link to post Share on other sites