OnPlayerSpellCastStart

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

onPlayerSpellCastStart

Triggered when the server accepts the start of a spell cast.

Availability

This event is available in server-side scripts.

Callback signature

onPlayerSpellCastStart(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("onPlayerSpellCastStart", root, function(playerId, spellKey, spellId, castId, phase, result, rejectReason, targetPlayerId, phaseStartTimeMs, phaseDurationMs, manaAfter)
    outputDebugString("onPlayerSpellCastStart: " .. spellKey .. " cast=" .. castId .. " phase=" .. phase)
end)

Notes

  • Use castId to correlate all phases, projectiles, impacts, and cleanup for one cast.