HealthChange
record in OpalScript
Immutable result of a Health command. HP commits before events drain.
Properties
| Member | Description |
|---|---|
| HealthChange.Applied | True when this command committed an HP change. |
| HealthChange.Amount | The actual HP delta after capping against current health or healing room. |
| HealthChange.PreviousHp | HP before this command. |
| HealthChange.RemainingHp | HP after this command. A later heal during Damaged does not rewrite this. |
| HealthChange.Killed | True when this command moved HP from above zero to zero. |
| HealthChange.Reason | Empty when Applied. Otherwise invulnerable, dead, no-change, event-budget, or removed. |
| HealthChange.OperationId | Identity of this command. |
| HealthChange.SourceId | The caller. Script-native calls carry their caller identity. |
| HealthChange.TargetId | The 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.
}