Garry's Mod Wiki

Entity:Alive

  boolean Entity:Alive()

Recently Added

This was recently added in version (2025.01.24). It might only be available on the Dev Branch right now.

Description

Checks if the entity is considered alive.

Checks entity's internal life state variable. Does not check health, but it is generally expected the health to be 0 or below at the point of an entity being considered dead. This internally looks up the save value m_lifeState

Returns

1 boolean
Whether the entity is considered alive.

Example

Sets the entity to return false for :Alive(), useful for npcs/nextbots that don't die at 0 health.

-- 0 is alive, 1 is "death animation", 2 is dead. ent:SetSaveValue("m_lifeState", 2) print(ent:Alive())