OnPlayerSpellCastState
Jump to navigation
Jump to search
onPlayerSpellCastState
Triggered for every authoritative spell-cast phase transition.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerSpellCastState(playerId, spellKey, spellId, castId, phase, result, rejectReason, targetPlayerId, phaseStartTimeMs, phaseDurationMs, manaAfter)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The casting player ID. |
spellKey |
string |
The stable spell definition key. |
spellId |
int |
The numeric spell ID. |
castId |
int |
The unique cast sequence ID for this player. |
phase |
string |
The authoritative cast phase. |
result |
string |
The authoritative phase result. |
rejectReason |
string |
The rejection reason, or an empty value when accepted. |
targetPlayerId |
int |
The selected target player ID, if any. |
phaseStartTimeMs |
int |
Server time at which the phase began. |
phaseDurationMs |
int |
Expected duration of the phase in milliseconds. |
manaAfter |
number |
Authoritative mana after this transition. |
Examples
Handle the event:
addEventHandler("onPlayerSpellCastState", root, function(playerId, spellKey, spellId, castId, phase, result, rejectReason, targetPlayerId, phaseStartTimeMs, phaseDurationMs, manaAfter)
outputDebugString("onPlayerSpellCastState: " .. spellKey .. " cast=" .. castId .. " phase=" .. phase)
end)
Notes
- Use
castIdto correlate all phases, projectiles, impacts, and cleanup for one cast.