{"name":"setCaptive","operator":null,"title":"setCaptive","type":"command","url":"https://community.bistudio.com/wiki/setCaptive","revid":338620,"updated":"2023-03-24T10:44:44Z","groups":["Object Manipulation","Sides"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Mark a unit as captive. If unit is a vehicle, commander is marked. A captive unit:\n- is seen as belonging to the civilian Side\n- will not be fired upon\n- will still shoot at its real side's enemies\n- will make its killer earn/lose score/rating as usual\n- will not get its weapons removed (see removeAllWeapons)\n- will not trigger \"detected by\" conditions for its original Side.\n\n> [!NOTE]\n> The number used as status can be retrieved by captiveNum to keep track of the captivity status at a finer resolution (e.g. handcuffed, grouped, etc).","syntaxes":[{"syntax":"unitName setCaptive status","since":null,"effect":null,"exec":null,"params":[{"name":"unitName","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unitName: Object"},{"name":"status","type":"Boolean","optional":false,"default":null,"description":"true means captive","types":["Boolean"],"since":null,"text":"status: Boolean - true means captive"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unitName","types":["Object"]},"right":{"text":"status","types":["Boolean"]}},{"syntax":"unitName setCaptive statusNumber","since":"arma2 1.00","effect":null,"exec":null,"params":[{"name":"unitName","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unitName: Object"},{"name":"statusNumber","type":"Number","optional":false,"default":null,"description":"zero means non-captive, a non-zero value means captive; see captiveNum","types":["Number"],"since":null,"text":"statusNumber:  Number - zero means non-captive, a non-zero value means captive; see captiveNum"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unitName","types":["Object"]},"right":{"text":"statusNumber","types":["Number"]}}],"examples":[{"text":"```sqf\n_soldier1 setCaptive true;\nside _soldier1;            // returns civilian\nside group _soldier1;    // returns e.g blufor\n```","code":["_soldier1 setCaptive true;\nside _soldier1;\t\t\t// returns civilian\nside group _soldier1;\t// returns e.g blufor"]},{"text":"```sqf\n_soldier1 setCaptive 1;\ncaptive _soldier1;        // returns true\n\n_soldier1 setCaptive 42;\ncaptive _soldier1;        // returns true\n\n_soldier1 setCaptive 0;\ncaptive _soldier1;        // returns false\n```","code":["_soldier1 setCaptive 1;\ncaptive _soldier1;\t\t// returns true\n\n_soldier1 setCaptive 42;\ncaptive _soldier1;\t\t// returns true\n\n_soldier1 setCaptive 0;\ncaptive _soldier1;\t\t// returns false"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["captive","captiveNum"],"notes":[{"user":"Talkingtoaj","date":"2011-01-01T13:11:00Z","text":"If you change a unit from captive to no longer captive (for example, to \"reveal\" an undercover unit), enemy units that already have prior knowledge of the unit as a captive will only partially engage, making it very easy for the undercover unit. This seems to be a bug.\n\nHowever other enemy unit the unit later encounters will engage freely with full force."},{"user":"Lou Montana","date":"2017-11-19T10:58:00Z","text":"**Talkingtoaj**'s note does not apply to Arma 3 anymore (earlier than 1.76)\n\nA captive unit will immediately be shot (after a normal \"human\" reaction time from the AI)"},{"user":"DreadedEntity","date":"2022-04-26T01:15:28Z","text":"In **A3 2.08.149102**, entering an empty vehicle with the same side as the player as defined in `configFile >> \"CfgVehicles\" >> _vehicleClassname >> \"side\"` will briefly switch the side of the vehicle to the side of the player soldier (specifically, while the get in animation is playing), even if captive. Once exiting the vehicle, it will retain that side until the player enters a new vehicle or, seemingly arbitrarily, moves more than 100 meters away from the vehicle `player distance _vehicle > 100`. If the player gets within 100 meters of the vehicle without entering a new vehicle, it will again switch to the players side. This is probably a bug, in my opinion"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Command Group: Sides","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}