EEex Opcodes

Opcode

Name

Opcode #400

Set Temporary AI Script

Opcode #401

Set Extended Stat

Opcode #402

Invoke Lua

Opcode #403

Screen Effects

Opcode #400 (Set Temporary AI Script)

Summary

Works exactly like Opcode #82, except:

  • The original script is restored when the duration runs out or the effect otherwise ends.

  • An empty resref can null a script slot.

Warning

Any changes made to the script level after this opcode has taken effect will be lost when the effect expires.

Opcode Field

Name

Description

Parameter #2

Script Level

The script level to set.

Values correspond to SCRLEV.IDS:

  • 0 -> OVERRIDE

  • 1 -> AREA

  • 2 -> SPECIFICS

  • 4 -> CLASS

  • 5 -> RACE

  • 6 -> GENERAL

  • 7 -> DEFAULT

Resource

Script Resref

The resref to set the script level to.


Opcode #401 (Set Extended Stat)

Summary

Modifies the value of an extended stat. Extended stats are those with ids outside of the vanilla range in STATS.IDS.

Note

All operations are clamped such that results outside of the stat's range will resolve to the exceeded extrema.

Opcode Field

Name

Description

Parameter #1

Operand Value

The value used to modify the stat via the method defined by Operation Type.

Parameter #2

Operation Type

The method used to modify the stat:

  • 0 (Sum) -----> Stat = Stat + Operand Value

  • 1 (Set) -----> Stat = Operand Value

  • 2 (Percent) -> Stat = (Stat * Operand Value) / 100

Special

Extended Stat ID

The id of the extended stat to modify.

To register an extended stat:

  • Append STATS.IDS with a unique id greater than 202.

  • Define the stat's minimum, maximum, and default values by appending X-STATS.2DA.


Opcode #402 (Invoke Lua)

Summary

Invokes a global Lua function.

Note

The function name must be 8 characters or less, and be ALL UPPERCASE.

Opcode Field

Name

Description

Resource

Lua Callback Name

The all-uppercase name of the Lua function callback.

Function signature:

FUNC(op402: CGameEffect, sprite: CGameSprite)

Opcode #403 (Screen Effects)

Summary

Registers a global Lua function that is called whenever an effect is added to the target creature. If this function returns true the effect being added is blocked.

Note

The function name must be 8 characters or less, and be ALL UPPERCASE.

Opcode Field

Name

Description

Resource

Lua Callback Name

The all-uppercase name of the Lua function callback.

Function signature:

FUNC(op403: CGameEffect, effect: CGameEffect, sprite: CGameSprite) -> boolean