{"name":"damage","operator":null,"title":"damage","type":"command","url":"https://community.bistudio.com/wiki/damage","revid":364153,"updated":"2024-05-05T10:44:17Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":null},{"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":null},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"description":"Return the damage value of an object.","syntaxes":[{"syntax":"damage object","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"object: Object"}],"returns":{"type":"Number","types":["Number"],"description":"the returned number in range (healthy) 0..1 (dead).","text":"Number - the returned number in range (healthy) 0..1 (dead)."},"form":"unary","operator":null,"left":null,"right":{"text":"object","types":["Object"]}}],"examples":[{"text":"```sqs\n? damage player > 0.1 : player groupChat \"I'm hurt! Medic!\"\n```","code":["? damage player > 0.1 : player groupChat \"I'm hurt! Medic!\""]},{"text":"```sqf\nif (damage player > 0.1) then\n{\n    player groupChat \"I'm hurt! Medic!\";\n};\n```","code":["if (damage player > 0.1) then\n{\n\tplayer groupChat \"I'm hurt! Medic!\";\n};"]},{"text":"```sqf\nprivate _health = (1 - damage player) * 100; // health in % from 0 to 100\n```","code":["private _health = (1 - damage player) * 100; // health in % from 0 to 100"]}],"multiplayer":null,"problems":null,"aliases":["getDammage"],"see_also":["setDamage","setHit","getHit","getHitIndex","setHitIndex","getHitPointDamage","setHitPointDamage","waterDamaged","Arma 3: Event Handlers"],"notes":[{"user":"Pierre MGI","date":"2015-02-13T20:20:00Z","text":"The returned value depends on the couple target/ammo fired. This value has no correlation with the sum of all hitpoints damage status and the effective status of the object.\nFiring bullets on cars often lead to weird results. For example: damage returns zero while a Hunter is fired at will with an .50 HMG! Hunter can be almost destroyed with zero damage for this function.\nIf you script, use instead the getHitPointDamage command."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Operation Flashpoint version","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}