{"name":"setUnitTrait","operator":null,"title":"setUnitTrait","type":"command","url":"https://community.bistudio.com/wiki/setUnitTrait","revid":379077,"updated":"2026-09-26T23:03:38Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.58"}],"since":{"game":"arma3","name":"Arma 3","version":"1.58"},"arma3_since":"1.58","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Enables or disables a trait or alters a trait of the given unit. Unit traits consist of unit abilities, which are Booleans and modifiers, which are Numbers. Custom trait can only be a bool.\n\n> [!NOTE]\n> The command can also be used on vehicles (and drones), and it will get applied to the effectiveCommander of the vehicle. In addition, if the effectiveCommander has a trait, it will get applied to the entire vehicle (for example, the vehicle can become harder to spot due to low **camouflageCoef**)\n\nAbilities:\n- Boolean **engineer** - Ability to partially repair vehicles with toolkit, equivalent to  in CfgVehicles\n- Boolean **explosiveSpecialist** - Ability to defuse mines with toolkit, equivalent to  in CfgVehicles\n- Boolean **medic** - Ability to treat self and others with medikit, equivalent to  in CfgVehicles\n- Boolean **UAVHacker** - Ability to hack enemy and friendly drones, equivalent to  in CfgVehicles\nModifiers:\n- Number **audibleCoef** - A lower value means the unit is harder to hear\n- Number **camouflageCoef** - A lower value means the unit is harder to spot\n- Number **loadCoef** - Equipment weight multiplier affecting stamina regeneration and max stamina\n- Number **staminaDrainCoef** - Since Arma 3 v2.22, Influences how quickly stamina is drained. **Do not set negative values!**","syntaxes":[{"syntax":"unit setUnitTrait [skillName, value, isCustom]","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":"the unit whose trait should be set","types":["Object"],"since":null,"text":"unit: Object - the unit whose trait should be set"},{"name":"skillName","type":"String","optional":false,"default":null,"description":"name of the skill","types":["String"],"since":null,"text":"skillName: String - name of the skill"},{"name":"value","type":"Boolean or Number","optional":false,"default":null,"description":"value (see above)","types":["Boolean","Number"],"since":null,"text":"value: Boolean or Number - value (see above)"},{"name":"isCustom","type":"Boolean","optional":true,"default":null,"description":"Must be set to true in case of custom","types":["Boolean"],"since":null,"text":"isCustom: Boolean - (Optional) Must be set to true in case of custom"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unit","types":["Object"]},"right":{"text":"[skillName, value, isCustom]","types":["Array"]}}],"examples":[{"text":"```sqf\nplayer setUnitTrait [\"Medic\", true];\n```","code":["player setUnitTrait [\"Medic\", true];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["getUnitTrait","getAllUnitTraits"],"notes":[{"user":"R3vo","date":"2016-04-27T18:12:00Z","text":"The higher the value for the loadCoef the less stamina a unit has. Negative values will dramatically increase the stamina actually to a point where it extends the stamina bar."},{"user":"Midnight","date":"2017-10-20T05:49:00Z","text":"The `explosiveSpecialist` trait can defuse mines (i.e. satchel charges), whilst the engineer trait alone cannot."},{"user":"Honger","date":"2026-09-26T23:03:38Z","text":"Setting **staminaDrainCoef** to a negative value will gradually replenish stamina/reduce fatigue when running/sprinting. Walking or standing will not be affected."}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Arma 3 version 1.58","Scripting Commands","Scripting Commands: Global Effect"]}