Arma 3 Scripting

Command in Object Manipulation

forceHitPointsDamageSync

Also available as Markdown and JSON, or read the original wiki page.

Description

Synchronises hitpoints values and total damage across current network clients as well as JIP. Possible uses after executing script commands such as setHit, setHitIndex, setHitPointDamage or in conjunction with HandleDamage event handler (see #Example 2).

Syntax

forceHitPointsDamageSync entity

Parameters:

Returns: Boolean - true if sync was attempted

Examples

Example 1

forceHitPointsDamageSync house1;

Example 2

house1 addEventHandler ["HandleDamage", 
{
    if (isServer && { _this select 9 == 2 }) then { (_this select 0) spawn { forceHitPointsDamageSync _this; } };
    if (_this select 7 find "glass" >= 0) then { _this select 2 } else { 0 };
}];

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