Skip to content

New Engine Feature: Tweak op138#4

Open
4Luke4 wants to merge 1 commit into
Bubb13:masterfrom
4Luke4:op138
Open

New Engine Feature: Tweak op138#4
4Luke4 wants to merge 1 commit into
Bubb13:masterfrom
4Luke4:op138

Conversation

@4Luke4
Copy link
Copy Markdown

@4Luke4 4Luke4 commented Mar 17, 2026

Description:
param2 in {0, 8, 11, 12, 13} and (param1 & 1) ~= 0 -> perform a real attack and call the Lua function in resource before the attack roll / damage is finalized.

Callback signature:

FUNC(op138: CGameEffect, sprite: CGameSprite, baseAttackRoll: number, baseDamageRoll: number) -> newBaseAttackRoll: number, newBaseDamageRoll: number[, boolean]

Notes:

  • The callback name must be 8 characters or less, and be ALL UPPERCASE.
  • The returned base attack roll is clamped to the engine's natural d20 range [1, 20].
  • The returned base damage roll is clamped to >= 0.
  • The returned base damage roll replaces only the engine's raw Roll:X basis;
    • later damage modifiers still apply normally unless the optional third return forces final damage to 0.
  • If the optional third return is true and the returned base damage roll clamps to 0, final damage is forced to 0 too, ignoring later damage modifiers.

Addendum:
See also: Bubb13/EEex#114.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant