{"name":"forceHitPointsDamageSync","operator":null,"title":"forceHitPointsDamageSync","type":"command","url":"https://community.bistudio.com/wiki/forceHitPointsDamageSync","revid":370215,"updated":"2024-11-09T23:07:51Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.18"}],"since":{"game":"arma3","name":"Arma 3","version":"2.18"},"arma3_since":"2.18","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Synchronises hitpoints values and total damage across current network clients as well as JIP.\nPossible uses after executing script commands such as setHit, setHitIndex, setHitPointDamage or in conjunction with HandleDamage event handler (see #Example 2).","syntaxes":[{"syntax":"forceHitPointsDamageSync entity","since":null,"effect":null,"exec":null,"params":[{"name":"entity","type":"Object","optional":false,"default":null,"description":"entity","types":["Object"],"since":null,"text":"entity: Object - entity"}],"returns":{"type":"Boolean","types":["Boolean"],"description":"true if sync was attempted","text":"Boolean - true if sync was attempted"},"form":"unary","operator":null,"left":null,"right":{"text":"entity","types":["Object"]}}],"examples":[{"text":"```sqf\nforceHitPointsDamageSync house1;\n```","code":["forceHitPointsDamageSync house1;"]},{"text":"```sqf\nhouse1 addEventHandler [\"HandleDamage\", \n{\n    if (isServer && { _this select 9 == 2 }) then { (_this select 0) spawn { forceHitPointsDamageSync _this; } };\n    if (_this select 7 find \"glass\" >= 0) then { _this select 2 } else { 0 };\n}];\n```","code":["house1 addEventHandler [\"HandleDamage\", \n{\n\tif (isServer && { _this select 9 == 2 }) then { (_this select 0) spawn { forceHitPointsDamageSync _this; } };\n\tif (_this select 7 find \"glass\" >= 0) then { _this select 2 } else { 0 };\n}];"]}],"multiplayer":"Static buildings synchronisation should be executed on the server as the server is the authority in building damage and you would want every client in MP to have the same level of damage as the server has.","problems":null,"aliases":[],"see_also":["getHit","getHitPointDamage","setHitPointDamage","damage","setDamage","setFuel","setAmmo","getHitIndex","setHitIndex"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Arma 3 version 2.18","Scripting Commands","Scripting Commands: Global Effect"]}