alive: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "<code>$1$2$3</code>")
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 27: Line 27:


|descr= Check if given vehicle/person/building is alive (i.e. not dead or destroyed).
|descr= Check if given vehicle/person/building is alive (i.e. not dead or destroyed).
{{Feature|Informative|{{ic|[[alive]] [[objNull]] {{cc|returns [[false]]}}}}}}


|s1= [[alive]] object
|s1= [[alive]] object
Line 36: Line 35:


|x1= SQS:
|x1= SQS:
<code>?!(alive player) : exit</code>
<sqs>? not alive player : exit</sqs>


|x2= SQF:
|x2= SQF:
<code>if (!alive player) exitWith {};</code>
<sqf>if (!alive player) exitWith {};</sqf>


|seealso= [[setDamage]] [[damage]]
|x3= <sqf>alive objNull; // returns false</sqf>
 
|seealso= [[setDamage]] [[damage]] [[waterDamaged]]
}}
}}


<dl class="command_description">
{{Note
 
|user= Pierre MGI
<dt></dt>
|timestamp= 20151019234800
<dd class="notedate">Posted on October 19, 2015 - 23:48 (UTC)</dd>
|text= Alive or not could be the question! in multi-player, missions come with respawn module(s). When a player is dead shot, <sqf inline>alive player</sqf> will return false, then almost immediately true if the "revive" respawn template is enabled, then could turn to false again if time for assistance is elapsed or if the player activates the respawn menu before; and finally true after player respawns.
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
Just be aware that in that case (respawn + revive enabled), the status of the player is toggling: true &rarr; false &rarr; true &rarr; false &rarr; true. Then, alive status while player is waiting for being rescued could lead to some script errors as player is supposed to be alive but is in limbo and the dead entity "player" gets passed to server.
<dd class="note">
}}
Alive or not could be the question! in multi-player, missions come with respawn module(s). When a player is dead shot, (alive player) will return false, then almost immediately true if the "revive" respawn template is enabled, then could turn on false if time for assistance is elapsed or if the player activates the respawn menu before; and finally true after player respawns. Just be aware that in that case (respawn + revive enabled), the status of the player is toggling: true false true false true. Then, alive status while player is waiting for being rescued could lead to some error scripts as player is supposed to be alive but in limbo and the dead entity "player" passed to server.
</dd>
 
</dl>

Latest revision as of 16:50, 12 February 2023

Hover & click on the images for description

Description

Description:
Check if given vehicle/person/building is alive (i.e. not dead or destroyed).
Groups:
Object Manipulation

Syntax

Syntax:
alive object
Parameters:
object: Object
Return Value:
Boolean - true if alive, false if dead/destroyed

Examples

Example 1:
SQS:
? not alive player : exit
Example 2:
SQF:
if (!alive player) exitWith {};
Example 3:
alive objNull; // returns false

Additional Information

See also:
setDamage damage waterDamaged

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
Pierre MGI - c
Posted on Oct 19, 2015 - 23:48 (UTC)
Alive or not could be the question! in multi-player, missions come with respawn module(s). When a player is dead shot, alive player will return false, then almost immediately true if the "revive" respawn template is enabled, then could turn to false again if time for assistance is elapsed or if the player activates the respawn menu before; and finally true after player respawns. Just be aware that in that case (respawn + revive enabled), the status of the player is toggling: true → false → true → false → true. Then, alive status while player is waiting for being rescued could lead to some script errors as player is supposed to be alive but is in limbo and the dead entity "player" gets passed to server.