allowDamage: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<dd class="note">([^}]*)<code>([^<]*)<\/code>" to "<dd class="note">$1<sqf>$2</sqf>")
(Command only supports entities (source: Killzone_Kid))
Line 19: Line 19:
|gr1= Object Manipulation
|gr1= Object Manipulation


|descr= Allow or prevent an object being damaged (or injured, or killed). The command does not prevent object from taking scripted damage such as [[setHit]], [[setHitIndex]], [[setHitPointDamage]] or [[setDamage]]. To check if damage is allowed at current locality, see [[isDamageAllowed]].
|descr= 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]].
{{Feature|informative|This command only supports entities ({{hl|Entity}} is a [[Class Inheritance|child class]] of {{hl|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.}}


|mp= {{Feature | important | The command has to be executed where the object is [[Multiplayer Scripting#Locality|local]] and will be effective as long as the object does not change locality.
|mp= {{Feature | important | This command has to be executed where the object is [[Multiplayer Scripting#Locality|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.}}
If the object changes locality, the command needs to be executed again on the new [[owner]]'s machine to maintain the effect.}}


|alias= [[allowDammage]]
|alias= [[allowDammage]]


|s1= object [[allowDamage]] allow
|s1= entity [[allowDamage]] allow


|p1= object: [[Object]]
|p1= entity: [[Object]]


|p2= allow: [[Boolean]]
|p2= allow: [[Boolean]]
Line 36: Line 36:
|x1= <sqf>player allowDamage false;</sqf>
|x1= <sqf>player allowDamage false;</sqf>


|seealso= [[isDamageAllowed]] [[setDamage]] [[setHit]] [[setHitIndex]] [[setHitPointDamage]]
|seealso= [[isDamageAllowed]] [[setDamage]] [[setHit]] [[setHitIndex]] [[setHitPointDamage]] [[damage]]
}}
}}



Revision as of 11:39, 5 August 2022

Hover & click on the images for description

Description

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.
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.
Multiplayer:
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.
Alias:
allowDammage
Groups:
Object Manipulation

Syntax

Syntax:
entity allowDamage allow
Parameters:
entity: Object
allow: Boolean
Return Value:
Nothing

Examples

Example 1:
player allowDamage false;

Additional Information

See also:
isDamageAllowed setDamage setHit setHitIndex setHitPointDamage damage

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on September 2, 2013
AgentRev
_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.