[Scripting Q] nearestObjects, doesnt return all objects

Sandbird

Valued Member!
I am trying to add weed grass to the server, but the function that harvest_plants doesnt recognize fiberplants,



This part:

Code:
// allowed trees list move this later
_trees = ["pumpkin.p3d","p_helianthus.p3d","p_fiberplant_ep1.p3d"];
_treesOutput = ["FoodPumpkin","FoodSunFlowerSeed","ItemKiloHemp"];

//_item = _this;
call gear_ui_init;

_countOut = 0;

_findNearestTree = [];
{
    if("" == typeOf _x) then {
        diag_log format["DEBUG TREES: %1", _x];   
        if (alive _x) then {
               
            _objName = _x call DZE_getModelName;

            // Exit since we found a tree
            if (_objName in _trees) exitWith {
                _findNearestTree set [(count _findNearestTree),_x];

                _index = _trees find _objName;

                _itemOut = _treesOutput select _index;

                _countOut = 1;

            };
        };
    };

} foreach nearestObjects [getPos player, [], 10];


returns always empty. As you can see i am diag_logging all the objects around me....while it works for trees etc, its not showing anything when i am next to a "p_fiberplant_ep1.p3d" (fiberplant).

Anyone knows why ?

I am spawning trees in the mission.sqf file in the dayz_server.pbo....not the client files.
 
Why are u trying to use the getModelName function for objects that have proper Class Names defined?
 
Yeah, cause the sqf for harvesting plants was like that....I fixed that after 15 min....i realized that its not needed.
This was messing it up :
if("" == typeOf _x) then {
 
Back
Top