dimon 32 Posted March 14, 2015 (edited) In order not to interfere with fallen trees wrote the script. 1. find an array of all objects for example, in a radius of 100 m from the player obj = nearestObjects [player,[],100]; 2.switch from an array of trees, check them for damage and raised (recoverable). trees=obj call ffa_fnc_tree; KK_fnc_inString = { /* Author: Killzone_Kid Description: Find a string within a string (case insensitive) Parameter(s): _this select 0: <string> string to be found _this select 1: <string> string to search in Returns: Boolean (true when string is found) How to use: _found = ["needle", "Needle in Haystack"] call KK_fnc_inString; */ private ["_needle","_haystack","_needleLen","_hay","_found"]; _needle = _this select 0; _haystack = toArray (_this select 1); _needleLen = count toArray _needle; _hay = +_haystack; _hay resize _needleLen; _found = false; for "_i" from _needleLen to count _haystack do { if (toString _hay == _needle) exitWith {_found = true}; _hay set [_needleLen, _haystack select _i]; _hay set [0, "x"]; _hay = _hay - ["x"] }; _found }; // ==========================================================// private ["_trees"]; _trees = []; { if (([": t_",str _x] call KK_fnc_inString) || {(["palm",str _x] call KK_fnc_inString)} || {([": str",str _x] call KK_fnc_inString)}) then { _trees set [count _trees,_x]; }; } forEach _this; _trees Returns: Array - arrays trees { if ((damage _x) > 0) then { _x setdamage 0; }; } foreach trees; #Update 1: Fixed: -Returns: Array -new class tree (Sahrani) #Update 2: Fixed: - code optimization Edited March 18, 2015 by Dimon Share this post Link to post Share on other sites
dimon 32 Posted March 17, 2015 #Update 1: Fixed: -Returns: Array -new class tree (Sahrani) Share this post Link to post Share on other sites
dimon 32 Posted March 18, 2015 #Update 2: Fixed: - code optimization Share this post Link to post Share on other sites