OnPlayerSpellCastRejected

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:32, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onPlayerSpellCastRejected

Triggered when the server rejects a requested spell-cast transition.

Availability

This event is available in server-side scripts.

Callback signature

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

Notes

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