{"name":"forceHitPointsDamageSync","title":"forceHitPointsDamageSync","type":"command","url":"https://community.bistudio.com/wiki/forceHitPointsDamageSync","revid":370215,"updated":"2024-11-09T23:07:51Z","groups":["Object Manipulation"],"status":"ok","games":{"arma3":"2.18"},"since":"arma3 2.18","arma3_since":"2.18","locality":{"argument":"local","effect":"global"},"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","params":[{"name":"entity","type":"Object","description":"entity","type_expr":"Object"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"true if sync was attempted"},"form":"unary","right":{"text":"entity"}}],"examples":[{"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.","see_also":["getHit","getHitPointDamage","setHitPointDamage","damage","setDamage","setFuel","setAmmo","getHitIndex","setHitIndex"]}