dragonsyr 21 Posted June 6, 2016 i need help i have this working. {{ _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach ((_x select 0) nearObjects [ "Land_LampDecor_F", (_x select 1)]); sleep .001;} forEach _zones; and i need to add all lamp types.. {{ _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach ((_x select 0) nearObjects [ "Lamps_Base_F","Land_LampAirport_F","Land_LampSolar_F","Land_LampStreet_F","Land_LampStreet_small_F", "PowerLines_base_F","Land_LampDecor_F","Land_LampHalogen_F","Land_LampHarbour_F","Land_LampShabby_F", "Land_PowerPoleWooden_L_F","Land_NavigLight","Land_runway_edgelight","Land_runway_edgelight_blue_F","Land_Flush_Light_green_F", "Land_Flush_Light_red_F","Land_Flush_Light_yellow_F","Land_Runway_PAPI","Land_Runway_PAPI_2","Land_Runway_PAPI_3","Land_Runway_PAPI_4", "Land_fs_roof_F","Land_PowLines_WoodL", "Land_PowLines_ConcL", "Land_lampa_ind_zebr", "Land_lampa_sidl_3", "Land_lampa_vysoka", "Land_lampa_ind", "Land_lampa_ind_b", "Land_lampa_sidl","StreetLamp", (_x select 1)]); sleep .001;} forEach _zones; but i get Error 32 elements provided, 2 expected Share this post Link to post Share on other sites
Grumpy Old Man 3548 Posted June 6, 2016 I doubt nearObjects accepts an array (you're missing the brackets for that) as typeName parameter, no alternative syntax for that. Could replace it with nearEntities: {{ _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach (_yourPositionParameter nearEntities [ ["Lamps_Base_F","Land_LampAirport_F","Land_LampSolar_F","Land_LampStreet_F","Land_LampStreet_small_F", "PowerLines_base_F","Land_LampDecor_F","Land_LampHalogen_F","Land_LampHarbour_F","Land_LampShabby_F", "Land_PowerPoleWooden_L_F","Land_NavigLight","Land_runway_edgelight","Land_runway_edgelight_blue_F","Land_Flush_Light_green_F", "Land_Flush_Light_red_F","Land_Flush_Light_yellow_F","Land_Runway_PAPI","Land_Runway_PAPI_2","Land_Runway_PAPI_3","Land_Runway_PAPI_4", "Land_fs_roof_F","Land_PowLines_WoodL", "Land_PowLines_ConcL", "Land_lampa_ind_zebr", "Land_lampa_sidl_3", "Land_lampa_vysoka", "Land_lampa_ind", "Land_lampa_ind_b", "Land_lampa_sidl","StreetLamp"], _radius]); sleep .001;} forEach _zones; replace the position and radius parameters with your own values, should do the trick. Cheers Share this post Link to post Share on other sites
sarogahtyp 1109 Posted June 6, 2016 u cant give an array of classnames to nearObject. read the wiki page! this should work: _lamps = ["Lamps_Base_F", "Land_LampAirport_F", "Land_LampSolar_F", "Land_LampStreet_F", "Land_LampStreet_small_F", "PowerLines_base_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_NavigLight", "Land_runway_edgelight", "Land_runway_edgelight_blue_F", "Land_Flush_Light_green_F", "Land_Flush_Light_red_F", "Land_Flush_Light_yellow_F", "Land_Runway_PAPI", "Land_Runway_PAPI_2", "Land_Runway_PAPI_3", "Land_Runway_PAPI_4", "Land_fs_roof_F", "Land_PowLines_WoodL", "Land_PowLines_ConcL", "Land_lampa_ind_zebr", "Land_lampa_sidl_3", "Land_lampa_vysoka", "Land_lampa_ind", "Land_lampa_ind_b", "Land_lampa_sidl", "StreetLamp"]; { _pos = _x select 0; _radius = _x select 1; { { _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach (_pos nearObjects [ _x, _radius]); } forEach _lamps; } forEach _zones; Share this post Link to post Share on other sites
dragonsyr 21 Posted June 7, 2016 thanks a lot ! working like a charm Share this post Link to post Share on other sites