Skip to content

HealthChange ​

record in OpalScript

Immutable result of a Health command. HP commits before events drain.

Properties ​

MemberDescription
HealthChange.AppliedTrue when this command committed an HP change.
HealthChange.AmountThe actual HP delta after capping against current health or healing room.
HealthChange.PreviousHpHP before this command.
HealthChange.RemainingHpHP after this command. A later heal during Damaged does not rewrite this.
HealthChange.KilledTrue when this command moved HP from above zero to zero.
HealthChange.ReasonEmpty when Applied. Otherwise invulnerable, dead, no-change, event-budget, or removed.
HealthChange.OperationIdIdentity of this command.
HealthChange.SourceIdThe caller. Script-native calls carry their caller identity.
HealthChange.TargetIdThe object that owns this Health.

Example ​

csharp
HealthChange hit = target.GetComponent<Health>().TakeDamageResult(20);
if (hit.Applied && hit.Killed) {
    // The hit committed a living-to-zero transition.
}

See also ​