setCaptive: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Add score/rating note)
 
(84 intermediate revisions by 20 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|S]]
{{RV|type=command
[[Category:Scripting Commands OFP 1.97|S]]
[[Category:Scripting Commands OFP 1.46|S]]
[[Category:Scripting Commands ArmA|S]]


back to [[Scripting_Reference#S|COMREF]]
|game1= ofp
|version1= 1.00


<h2 style="color:#000066">'''''person'' setCaptive ''status'''''</h2>
|game2= ofpe
|version2= 1.00


|game3= arma1
|version3= 1.00


'''Operand types:'''
|game4= arma2
|version4= 1.00


'''person:''' [[Object]]
|game5= arma2oa
|version5= 1.50


'''status:''' [[Boolean]]
|game6= tkoh
|version6= 1.00


'''Type of returned value:'''
|game7= arma3
|version7= 0.50


[[Nothing]]
|eff= global


'''Description:'''
|arg= local


Mark unit as captive.<br>
|gr1= Object Manipulation
If unit is a vehicle, commander is marked.<br>
A captive is neutral to everyone.<br>
'''Note:''' This function does not remove unit's weapons.<br>
'''Note:''' If you make a unit captive, that unit will still fire on the enemy, but the enemy will not fire back.


|gr2= Sides


'''Example:<br>'''
|descr= Mark a unit as captive. If unit is a vehicle, commander is marked. A captive unit:
* is seen as belonging to the [[civilian]] [[Side]]
* will not be fired upon
* will still shoot at its real side's enemies
* will make its killer earn/lose [[score]]/[[rating]] as usual
* will not get its weapons removed (see [[removeAllWeapons]])
* will not trigger "detected by" conditions for its original [[Side]].
{{Feature|informative|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).}}


soldier1 '''setCaptive''' [[true]]
|s1= unitName [[setCaptive]] status
 
|p1= unitName: [[Object]]
 
|p2= status: [[Boolean]] - [[true]] means [[captive]]
 
|r1= [[Nothing]]
 
|s2= unitName [[setCaptive]] statusNumber
 
|s2since= arma2 1.00
 
|p21= unitName: [[Object]]
 
|p22= statusNumber:  [[Number]] - zero means non-captive, a non-zero value means [[captive]]; see [[captiveNum]]
 
|r2= [[Nothing]]
 
|x1= <sqf>
_soldier1 setCaptive true;
side _soldier1; // returns civilian
side group _soldier1; // returns e.g blufor
</sqf>
 
|x2= <sqf>
_soldier1 setCaptive 1;
captive _soldier1; // returns true
 
_soldier1 setCaptive 42;
captive _soldier1; // returns true
 
_soldier1 setCaptive 0;
captive _soldier1; // returns false
</sqf>
 
|seealso= [[captive]] [[captiveNum]]
}}
 
{{Note
|user= Talkingtoaj
|timestamp= 20110101131100
|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.
 
However other enemy unit the unit later encounters will engage freely with full force.
}}
 
{{Note
|user= Lou Montana
|timestamp= 20171119105800
|text= '''[[User:Talkingtoaj|Talkingtoaj]]'''<nowiki/>'s note does not apply to {{arma3}} anymore (earlier than 1.76)<br>
A captive unit will immediately be shot (after a normal "human" reaction time from the AI)
}}
 
{{Note
|user= DreadedEntity
|timestamp= 20220426011528
|text= In '''A3 2.08.149102''', entering an empty vehicle with the same [[side]] as the player as defined in <sqf inline>configFile >> "CfgVehicles" >> _vehicleClassname >> "side"</sqf> 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 <sqf inline>player distance _vehicle > 100</sqf>. 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
}}

Latest revision as of 11:44, 24 March 2023

Hover & click on the images for description

Description

Description:
Mark a unit as captive. If unit is a vehicle, commander is marked. A captive unit:
  • is seen as belonging to the civilian Side
  • will not be fired upon
  • will still shoot at its real side's enemies
  • will make its killer earn/lose score/rating as usual
  • will not get its weapons removed (see removeAllWeapons)
  • will not trigger "detected by" conditions for its original Side.
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).
Groups:
Object ManipulationSides

Syntax

Syntax:
unitName setCaptive status
Parameters:
unitName: Object
status: Boolean - true means captive
Return Value:
Nothing

Alternative Syntax

Syntax:
unitName setCaptive statusNumber
Parameters:
unitName: Object
statusNumber: Number - zero means non-captive, a non-zero value means captive; see captiveNum
Return Value:
Nothing

Examples

Example 1:
_soldier1 setCaptive true; side _soldier1; // returns civilian side group _soldier1; // returns e.g blufor
Example 2:
_soldier1 setCaptive 1; captive _soldier1; // returns true _soldier1 setCaptive 42; captive _soldier1; // returns true _soldier1 setCaptive 0; captive _soldier1; // returns false

Additional Information

See also:
captive captiveNum

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Talkingtoaj - c
Posted on Jan 01, 2011 - 13:11 (UTC)
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. However other enemy unit the unit later encounters will engage freely with full force.
Lou Montana - c
Posted on Nov 19, 2017 - 10:58 (UTC)
Talkingtoaj's note does not apply to Arma 3 anymore (earlier than 1.76)
A captive unit will immediately be shot (after a normal "human" reaction time from the AI)
DreadedEntity - c
Posted on Apr 26, 2022 - 01:15 (UTC)
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