Arma 3 Scripting

Command in Object Manipulation

allowDamage

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

Description

Enables / disables an entity's ability to receive damage. This command does not prevent the entity from taking scripted damage from commands such as setDamage, setHit, setHitIndex or setHitPointDamage.

Note

This command only supports entities (Entity is a child class of Object, i.e. all entities are objects, but not all objects are entities). Consequently, there are objects that are not affected by this command, for example terrain vegetation such as trees.

Syntax

entity allowDamage allow

Parameters:

Returns: Nothing

Examples

Example 1

player allowDamage false;

Multiplayer

Important

This command has to be executed where the object is local. Its effect will only last as long as the object does not change locality. If the object changes locality, the command needs to be executed again on the new owner's machine to maintain the effect.

See also

isDamageAllowed · setDamage · setHit · setHitIndex · setHitPointDamage · damage

Community notes

AgentRev01
_object allowDamage false;

has the same effect as

_object addEventHandler ["HandleDamage", { 0 }];

except for buildings that are native to the map; for those, the effects of HandleDamage will not sync properly across all clients, even if added to the building on every client and the server.