OnActorBlocked
An actor’s swing met a player’s block.
The player’s game blocked the actor’s swing - with perfect true a perfect block or a master strike. Once per swing; a
blow that landed comes to OnActorAttack instead, a dodge or a miss to neither. The actor’s stagger follows this call
(SetActorBlockRules: by default a perfect block costs the actor its next swing for 1.5 seconds and a plain block nothing);
a mode that keeps its own stamina for its fighters spends it here, and may stagger the actor itself with StaggerActor.
Syntax
Section titled “Syntax”function OnActorBlocked(id, pid, perfect) -- ...end| Parameter | Type | |
|---|---|---|
id |
number | the actor |
pid |
number | the player who blocked |
perfect |
boolean | true for a perfect block or a master strike |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”-- bandits tire: every block costs them, a perfect block more; worn out, they staggerlocal stamina = {}function OnActorBlocked(id, pid, perfect) stamina[id] = (stamina[id] or 100) - (perfect and 30 or 10) if stamina[id] <= 0 then StaggerActor(id, 2.5) stamina[id] = 100 endendSee also
Section titled “See also”OnPlayerBlockedByActor · StaggerActor · SetActorBlockRules · OnActorAttack · the NPC actors group of the index
