{"name":"BIN_fnc_setTargetWeight","title":"BIN fnc setTargetWeight","type":"function","url":"https://community.bistudio.com/wiki/BIN_fnc_setTargetWeight","revid":379543,"updated":"2026-10-31T13:38:55Z","groups":["Behavior"],"status":"ok","games":{"arma3":"1.94"},"since":"arma3 1.94","arma3_since":"1.94","locality":{"effect":"local"},"description":"Sets the target priority (weight) of a unit, vehicle, group or side for the weapons of the alien drone. The weight is stored in the object variable \"#bTargetPrio\" (default 1 when not set) and is later read by:\n\n- BIN_fnc_findTargetWeight, which picks the drone's target among nearby entities with selectRandomWeighted; entities with weight 0 are excluded\n- BIN_fnc_missileSwarm, which picks missile targets among allUnits within 200 m; units with weight 0 or lower are excluded\n\nThe higher the weight, the more likely the target is to be selected. Objects initialised with BIN_fnc_behaviorInit and the drone module (BIN_fnc_initDroneModule) get weight 0.\n\nNothing in the Contact functions calls this function; it is meant to be used in mission scripts.\n\n> [!IMPORTANT]\n> - A vehicle passed as *target* gets the weight on the vehicle object only, not on its crew. BIN_fnc_findTargetWeight uses this value for the vehicle, but BIN_fnc_missileSwarm reads the weight of the units.\n> - For a unit that is inside a vehicle, the code runs `crew _x` where `_x` is not defined by the function, so the weight is not set on that unit.\n> - A Side only affects units that exist at the moment of the call.\n\n> [!NOTE]\n> This content is exclusive to the Arma 3 Contact Expansion.","syntaxes":[{"syntax":"[target, weight] call BIN_fnc_setTargetWeight","params":[{"name":"target","type":"Object, Group or Side","optional":true,"default":"objNull","description":"Object - a unit on foot or a vehicle; the weight is set on that object\n- Group - the weight is set on every unit of the group\n- Side - the weight is set on every unit of allUnits that belongs to this side","type_expr":"Object | Group | Side","text":"target: Object, Group or Side - (Optional, default objNull)\n\n- Object - a unit on foot or a vehicle; the weight is set on that object\n- Group - the weight is set on every unit of the group\n- Side - the weight is set on every unit of allUnits that belongs to this side"},{"name":"weight","type":"Number","optional":true,"default":"1","description":"target weight; 0 excludes the target from selection","type_expr":"Number","text":"weight: Number - (Optional, default 1) target weight; 0 excludes the target from selection"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[west, 0] call BIN_fnc_setTargetWeight; // all current BLUFOR units are ignored by the drone's weapons"]},{"code":["[player, 10] call BIN_fnc_setTargetWeight; // the player is much more likely to be targeted"]},{"code":["[group player, 0] call BIN_fnc_setTargetWeight; // the player's group is ignored"]}],"see_also":["BIN_fnc_findTargetWeight","selectRandomWeighted"]}