Skip to content

Creature proxy (self.creature)

Bound on script tables as self.creature. Only these members are available; unknown names are rejected.

Source: Utils/Lua/LuaCreatureApi.cs.

Properties

Name Lua type Access Notes
CurGlobalCenter Vector2 Read-only Current center in world pixels. Returns a Vector2 value copy, or (0, 0) when the creature is absent.
Dying boolean Read-only Whether the creature is dying. Reads false when the creature is absent.
Health number Read/write Current health in damage points. Reads 0 and ignores writes when the creature is absent.
Height number Read-only Creature height in pixels, or 0 when the creature is absent.
Id string or nil Read-only Read a stable key for this runtime creature across different Lua views. Opaque ID, or nil when absent. Suitable for Lua table keys; changes when the object is recreated and is not a save or network identifier.
IsDead boolean Read-only Read the engine's completed-death flag. True when the creature is marked dead; false when absent. Dying is exposed separately.
IsFlipped boolean Read/write Whether the creature is horizontally flipped. Reads false and ignores writes when the creature is absent.
IsOnGround boolean Read-only Whether the creature is on the ground. Reads false when the creature is absent.
IsPlayer boolean Read-only Distinguish players from pack creatures. Always false for a pack creature.
IsValid boolean Read-only Check whether this creature remains present in the current Lua world. False before insertion, after removal or death, and in another world. A dying creature may still be present; check health and Dying when choosing combat targets.
MaxHealth number Read/write Maximum health in damage points. Reads 0 and ignores writes when the creature is absent.
MeleeDamage number Read/write Default melee damage in damage points. Reads 0 and ignores writes when the creature is absent.
TypeId string or nil Read-only Read the creature's registered content identity. Namespaced pack creature ID, or nil when absent or unregistered. Matches the ID accepted by World.spawnCreature.
ViewRange number Read/write Target-view range in pixels. Reads 0 and ignores writes when the creature is absent.
Width number Read-only Creature width in pixels, or 0 when the creature is absent.
X number Read/write Horizontal position in world pixels. Reads 0 and ignores writes when the creature is absent.
Y number Read/write Vertical position in world pixels. Reads 0 and ignores writes when the creature is absent.

Methods

Lua call Arguments Returns Notes
self.creature:DealMeleeDamage(target, damage) target: Player or EntityView or Creature or nil — Living Player, EntityView, or Creature. Nil does nothing; non-living values are ignored.
damage: number — Damage in damage points.
no return value Deal melee damage to a living target. Damage at or below 0 uses the creature default MeleeDamage. Nil and non-living values do nothing, as does an absent host.
self.creature:FindTarget(range) range: number — Range in pixels. EntityView or nil — EntityView for the found living target, or nil when no target or host is available. Find a living target within the supplied pixel range.
self.creature:FindTarget(range, targetKind, typeId, tag, ignoreEntity) range: number — Finite, nonnegative search radius in pixels.
targetKind: string or nil — all (or nil), players, or mobs. Players means actual players; mobs includes human NPCs. Unknown kinds raise an error.
typeId: string or nil (optional); default nil — Exact TypeId to require, or nil for any content type.
tag: string or nil (optional); default nil — Exact authored tag to require, or nil for any tag.
ignoreEntity: Player or EntityView or Creature or nil (optional); default nil — Additional player or mob to exclude, such as the summon owner.
EntityView or nil — Nearest matching living view, or nil without a valid source or matching target. Find the nearest valid living target with explicit filters and line of sight. Unlike the one-argument legacy search, this overload has no player priority or same-species exclusion. Always excludes this creature.
self.creature:GetCurrentAnimationName() None string or nil — Current animation name, or nil when unavailable. Read the current pack creature animation name.
self.creature:HasTag(tag) tag: string — Authored or engine-assigned tag. boolean — True when the creature has the tag; false when absent or unmatched. Check an exact, case-sensitive entity tag.
self.creature:PerformAction(actionName) actionName: string — Authored creature action name. no return value Perform an authored pack creature action by name. Does nothing when the creature is absent.
self.creature:PlayAnimation(animationName) animationName: string — Authored animation name. no return value Start a pack creature animation immediately. Empty animation names and absent hosts do nothing.
self.creature:SetFacing(faceRight) faceRight: boolean — True for right; false for left. no return value Face right when true, or left when false. Does nothing when the creature is absent.
self.creature:TransitionToAnimation(animationName, transitionTime) animationName: string — Authored animation name.
transitionTime: number — Transition duration in seconds.
no return value Transition a pack creature animation. Empty animation names and absent hosts do nothing. Use durations below 10 seconds for consistent hosts: Spriter treats positive values below 10 as seconds and values at least 10 as legacy milliseconds, while Demina uses seconds.
CLR declaration reference

These names identify the backing engine source declarations.

  • Vector2 CurGlobalCenter
  • Boolean Dying
  • float Health
  • float Height
  • string Id
  • bool IsDead
  • Boolean IsFlipped
  • Boolean IsOnGround
  • bool IsPlayer
  • bool IsValid
  • float MaxHealth
  • float MeleeDamage
  • string TypeId
  • float ViewRange
  • float Width
  • float X
  • float Y
  • void DealMeleeDamage(object target, float damage)
  • LuaEntityView FindTarget(float range)
  • LuaEntityView FindTarget(float range, object targetKind, object typeId = null, object tag = null, object ignoreEntity = null)
  • String GetCurrentAnimationName()
  • bool HasTag(string tag)
  • void PerformAction(String actionName)
  • void PlayAnimation(String animationName)
  • void SetFacing(Boolean faceRight)
  • void TransitionToAnimation(String animationName, float transitionTime)

Generated 2026-10-02T21:05:27.5090099Z · b8c9ae78 · 26 members.

Official modding overview · Signs of Life on Steam