EEex

Author: Bubb
Contributors: fearless, OlvynChuru, CrevsDaak
0.5.0-alpha
Languages: ? Relevant?
Platforms: EEex will support MacOS and Linux on launch, however, the current alpha version only supports Windows.
GitHub: https://github.com/Bubb13/EEex

Table of Contents

Notes

  • DO NOT TOUCH X UNLESS YOU KNOW WHAT YOU ARE DOING (REVISE WITH DEETS)
  • Once EEex is installed, you will not be able to start the game by clicking on the Baldur.exe or the Icewind.exe icons. Rather, you must click on the EEex.exe. It can be found in your game folder, and it looks like this:

Overview

EEex is an executable extender for Beamdog's Enhanced Edition of the Infinity Engine. Its goal is to externalize certain parts of the engine to grant modders a greater degree of control over otherwise hardcoded mechanics. EEex does not make any gameplay changes itself - it merely enables other mods to do so.

Alpha versions of this project can be found here

What does it do?

EEex, when installed, directly modifies the game's executable in order to insert a loader. This loader is used to alter the game's code on startup; the modifications that are made depend on the version of EEex installed, and any installed mods that make use of EEex's capabilities.

Compatibility

BG2:EE v2.5.16.6 is the only supported game at the time of writing. However, at the time of launch, EEex should be compatible with all Enhanced Edition Games.

Bug Reporting

If you should encounter any bugs, please report them to the authors at the EEex forum. In addition, EEex is available on GitHub, so fixes and changes can be submitted by the community.

Installation

Special Note for Siege of Dragonspear from Steam/GOG

Good Old Games (GOG) and Steam both package the additional content for Siege of Dragonspear in a method that WeiDU, the tool used to install this mod, cannot access. You must run a program called Modmerge on your SoD installation before you can install this or any other WeiDU-based mod.


Enhanced Editions Note

The Enhanced Editions are actively supported games. Please note that every patch update will wipe your current mod setup! If in the middle of a modded game you might want to delay the patch update (if possible) as even after reinstalling the mods, you might not be able to continue with your old savegames. Alternatively, copy the whole game's folder into a new one that can be modded and will stay untouched by game patches. For BG:EE it is important that you install the mod to the language version you are playing the game in. Otherwise, the dialogues of the mod will not show but give error messages.

Windows

EEex for Windows is distributed as a self-extracting archive and includes a WeiDU installer. To install, extract the files to your game folder.

When properly extracted, your game directory will contain setup-EEex.exe and the folder EEex. To install, double-click setup-EEex.exe and follow the instructions on screen.

You can run setup-EEex.exe in your game folder to reinstall, uninstall or otherwise change components.

Mac OS X

TBD

Linux

TBD

Note for Complete Uninstallation

In addition to the methods above for removing individual components, you can completely uninstall the mod using setup-EEex --uninstall at the command line to remove all components without wading through prompts.

Contents

Main Component

The main component installs all DF:LEKDCH

Information for Modders:

Updated Opcodes

Opcode #42

Special: Force the slot modification

  • If Special parameter is non-zero, the slot modification ignores access to particular spell level requirement.

Opcode #62

Special: Force the slot modification

  • If Special parameter is non-zero, the slot modification ignores access to particular spell level requirement.

Opcode #218

Resource Key: Fire spell

  • Spell specified in resource key is fired when all layers are lost.

Opcode #280

Parameter #1: Surge Roll
Special: Show hardcoded graphical effects

  • 'Surge Roll' field allows to force particular wild surge roll to occur if it is set to non-zero.
  • If Special parameter is non-zero, all hardcoded wild surge graphical effects are suppressed.

Opcode #319:

Power: Mode
Parameter #1: IDS Entry / Value
Parameter #2: IDS File / Stat Type

  • Known values for 'Mode' are:
    0 item restricted if condition holds ('Not usable by' mode), parameters use IDS targets
    1 item restricted if condition fails ('Usable by' mode), parameters use IDS targets
    2 like 1 but parameters use splprot.2da
    3 like 0 but parameters use splprot.2da
  • If 'Mode' is set to 2 or 3, then the creature type specified by the 'Stat Type' field will be affected by this opcode. See opcode #324 for more information.

Opcode #324:

Special: Strref

  • Hardcoded enginest.2da strref can be optionally overridden by strref specified in Special field.


New Opcodes

Opcode #400: Set Temporary AI Script

Parameter #1: Irrelevant
Parameter #2: Type
Description:

  • Works exactly like Opcode #82 except:
    1) A null resref can null a script slot
    2) The original script is restored when the duration runs out or the effect otherwise ends.

Opcode #401: Set Extended Stat

Parameter #1: Statistic Modifier
Parameter #2: Type
Special: Stat
Description:

  • Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.
  • Known values for 'Type' are:
    0 Cumulative Modifier -> Stat = Stat+ 'Statistic Modifier' value
    1 Flat Value Modifier -> Stat= 'Statistic Modifier' value
    2 Percentage Modifier -> Stat = (Stat* 'Statistic Modifier' value) / 100
  • Values for 'Stat' are taken from stats.ids (Note: EEex expands number of usable stats.ids entries to 65737).

Opcode #402: Invoke Lua

Parameter #1: Lua Value 1
Parameter #2: Lua Value 2
Special: Lua Value 3
Description:

  • The targeted creature(s) calls a Lua function specified by the resource key. Maximum function name length is 8, and function names must be completely upper-case.
    Object that invoked the effect and values passed by the opcode can be used in the called Lua function.
  • Example: Click Here or see below

Opcode #403: ScreenEffects

Description:
The resref field in Opcode #403 defines a Lua function that is called whenever an effect is being added to the target creature. The Lua function's signature can be seen in the following example:
See below for use example, or click here

Opcode #404 (OverrideButton)

Parameter #1: Replaced Button
Parameter #2: Replacing Button
Description:
Param1 is the button type to replace, (ids match what is defined by EEex_ACTIONBAR_TYPE in M__EEex.lua). See Below
Param2 is the button type to replace with, (ids same as above).


Opcode #405 (OverrideButtonIndex)

Parameter #1: Index to Override
Parameter #2: Replacing Button
Special: Action Bar Config
Description:
Overrides a button based on index and actionbar configuration:
Param1 = Button index to override
Param2 = Button type to override with
Special = Actionbar config to match (-1 to match any class home)


Modules

These can be enabled in EEex_INI.lua by flipping the relevant entry to true.

B3_Hotke.lua

Allows the definition of more complex hotkeys. There is some documentation at the top of the file in the form of examples, though I don't know if this is sufficient.

B3_Invis

When enabled allows party-controlled creatures with Opcode #193 to see / attack invisible creatures. If "B3Invis_RenderAsInvisible" (at the top of the file) is set to true the detected invisible creatures will render as if under broken-improved invis.

B3_Portr

When enabled suppresses the action-overlay icons on party portraits.

B3_Timer

Will be the timer GUI overlays, but it currently is waiting on the BAMs to be finished.

B3_CuBar.lua

Enables customization of a character's actionbar ingame through a graphical interface. Simply hold shift with the character you want to alter selected, and change the buttons as you wish For an example of use in game, see here


Functions

EEex_ActionbarListener(config)

Use this function to change action bar buttons.
For example: This assigns the search button to bards in the fifth slot. Find more details, including config values below

EEex_CompileBCS(scriptString)

Compiles a script in the uncompiled BAF syntax and returns the internal AI script representation. Use in conjunction with EEex_RunBCSAsActor(). NOTE: Compiling scripts is slow - try to compile scripts sparingly and attempt to reuse scripts that are already compiled.

Example: See Here

Copy paste version Here

EEex_FetchBCS(resref)

Returns the internal representation of the given resref's AI script. Use in conjunction with EEex_RunBCSAsActor().

Example:
local shoutScript = EEex_FetchBCS("SHOUT")
^ Returns SHOUT.BCS's internal engine representation.

EEex_GetActorClass(actorID)

Detects class by class.ids value.
EEex_GetActorClass(actorID) == 0x6 returns true if a paladin has been selected

EEex_GetActorClassScript(actorID)

Returns the resref of the actor's class script.

EEex_GetActorCurrentAction(actorID)

Returns the ID of the actor's current action (from ACTION.IDS). For example, if the actor is moving to a location, it will return 23, the ACTION.IDS number for MoveToPoint().

EEex_GetActorDefaultScript(actorID)

Returns the resref of the actor's default script.

EEex_GetActorDialogue(actorID)

Returns the resref of the actor's DLG file.

EEex_GetActorGeneralScript(actorID)

Returns the resref of the actor's general script.

EEex_GetActorKit(actorID)

Detects kit by kit.ids value. E.g. EEex_GetActorKit(actorID) == 0x4005 returns true for the Inquisitor kit.

EEex_GetActorModalState(actorID)

Returns the modal state of the actor (from MODAL.IDS; e.g. Turn Undead = 4, no modal state = 0).

EEex_GetActorMovementRate(actorID, adjustForHaste)

Gets the actor's movement rate. If adjustForHaste is true, it returns double the number if the actor is hasted and half if the actor is slowed. For example, this would return 0 if the actor was entangled, and it would return double the value if the actor had Boots of Speed equipped. Both opcodes 126 and 176 affect the value this returns. If the actor doesn't have an effect that changes its movement speed, this returns the "move_scale" value from the actor's animation INI file.

EEex_GetActorOverrideScript(actorID)

Returns the resref of the actor's override script.

EEex_GetActorRaceScript(actorID)

Returns the resref of the actor's race script.

EEex_GetActorSpecificsScript(actorID)

Returns the resref of the actor's specifics script.


EEex_GetActorSpellRES(actorID)

Returns the resref of the spell the actor is either currently casting, cast most recently, or is about to cast (waiting for its aura to be cleansed). It works with both Spell and SpellRES - type actions.

EEex_GetImageMasterID(actorID)

If the actor is an image, this gets the actor ID of the image's master. Otherwise, it returns 0. This function works correctly even if the image was created before the game was loaded. It also lets you get the actor ID of the image's master even if the image doesn't have an opcode 237 effect on it.

EEex_GetSpellData(resref)

Returns offset 0x0 of the data for the spell. The data for a spell is the same data as in the SPL file. For example, offset EEex_GetSpellData("SPWI304") + 0x34 is 3, because the spell's level is stored at offset 0x34, and Fireball is a 3rd-level spell.

EEex_GetSummonerID(actorID)

If the actor is a summoned creature, this gets the actor ID of the creature's summoner. If it's not a summoned creature, or if it's an image (created by Mislead, Project Image or Simulacrum), it returns 0. It also returns 0 if the creature was summoned before the game was loaded, unfortunately.

EEex_HasState(actorID, state)

Returns true if the actor has the specified state. For example, EEex_HasState(EEex_GetActorIDCursor(), 0x8000) would return true if the actor was hasted (because STATE_HASTE is 0x8000 in STATES.IDS).

EEex_IsImmuneToOpcode(actorID, opcode)

Returns true if the actor is immune to the specified opcode. For example, EEex_IsImmuneToOpcode(EEex_GetActorIDCursor(), 128) would return true if the actor is immune to confusion (opcode 128).

EEex_IsImmuneToSpellLevel(actorID, level, includeSpellDeflection)

Returns true if the actor is protected from the specified spell level (e.g. by Minor Globe of Invulnerability). If includeSpellDeflection is true, it also returns true if the actor has Spell Deflection, Spell Turning, or Spell Trap for the specified level.

EEex_IterateActorEffects(actorID, func)

Applies the function to each effect on the actor. The function takes one parameter, which is automatically set to offset 0x0 of each effect. The offsets for each effect are the same as in an EFF file. Here's an example: Click Here or see below

EEex_IsImmuneToOpcode(actorID, opcode)

Returns true if the actor is immune to the specified opcode. For example, EEex_IsImmuneToOpcode(EEex_GetActorIDCursor(), 128) would return true if the actor is immune to confusion (opcode 128).

EEex_IsImmuneToSpellLevel(actorID, level, includeSpellDeflection)

Returns true if the actor is protected from the specified spell level (e.g. by Minor Globe of Invulnerability). If includeSpellDeflection is true, it also returns true if the actor has Spell Deflection, Spell Turning, or Spell Trap for the specified level.

EEex_GetSummonerID(actorID)

If the actor is a summoned creature, this gets the actor ID of the creature's summoner. If it's not a summoned creature, or if it's an image (created by Mislead, Project Image or Simulacrum), it returns 0. It also returns 0 if the creature was summoned before the game was loaded, unfortunately.

EEex_GetImageMasterID(actorID)

If the actor is an image, this gets the actor ID of the image's master. Otherwise, it returns 0. This function works correctly even if the image was created before the game was loaded.

EEex_SetAreaGlobal(areaResref, globalName, value)

Sets variable in ARE

EEex_SetGlobal(globalName, value)

Sets variable in GAM

EEex_SetActorLocal(actorID, localName, value)

Sets variable in CRE


## Other These are other random things that EEex allows you to do.

EEex_Brd.lua

You can use this file to enable bard thieving. See how to use it below or for copy/paste example, click here.


## DO NOT TOUCH This is the section that details the things that must not be touched (unless you really know what you are doing.)


Code Samples and other information:

Opcode #402 Sample

Credit: Swit

EEex_IterateActorEffects(actorID, func)


Credit: OlvynChuru
EEex_IterateActorEffects(EEex_GetActorIDCursor(), function(eData) local parameter1 = EEex_ReadDword(eData + 0x1C) Infinity_DisplayString(parameter1) end)

Opcode #403 Sample

Credit: Bubb

EEex_ActionbarListener(config)

Configs Values:

  • 0: Sorcerer and Mage
  • 1-17: CLASS.IDS - 1
  • 18: Monk
  • 19: Shaman
  • 20: Weapon Ability List ( Rclicking a weapon with multiple abilities or ammo(bow/xbow/sling))
  • 21: Spell List ( Lclicking 'Cast Spell' or Rclicking 'Quick Spell')
  • 22: Item Ability List ( Lclicking 'Use Item' or Rclicking 'Quick Item' with multiple abilities)
  • 23: Special Ability List (Normal and with Thieving button)
  • 26: Group Selected (regardless of formation buttons)
  • 28: Opcode 214 Spell List (regardless of list type/parameter2)
  • 29: All other CLASS.IDS values except WIZARD_EYE.
  • 30: Spell List with 'Jump to Priest/Wizard Spells' button (Cleric/Mage)

Action bar types:

  • BARD_SONG: Displays Bardsong button
  • CAST_SPELL:Displays Casting button
  • FIND_TRAPS: Displays Search button
  • TALK: Displays Talk button
  • GUARD: Displays Guard button
  • ATTACK: Displays Attack button
  • SPECIAL_ABILITIES: Displays Special Ability button
  • STEALTH: Displays Stealth button
  • THIEVING: Displays pick pocket/pick lock/disable traps^ buttons
  • TURN_UNDEAD: Displays Turn Undead button
  • USE_ITEM: Displays Use Item button
  • STOP: Displays Stop button (i.e. group selected)
  • QUICK_ITEM_1: Quick item slot 1
  • QUICK_ITEM_2: Quick item slot 2
  • QUICK_ITEM_3: Quick item slot 3
  • QUICK_SPELL_1: Quick Spell 1
  • QUICK_SPELL_2: Quick Spell 2
  • QUICK_SPELL_3: Quick Spell 3
  • QUICK_WEAPON_1: Quick Weapon slot 1
  • QUICK_WEAPON_2: Quick Weapon slot 2
  • QUICK_WEAPON_3: Quick Weapon slot 3
  • QUICK_WEAPON_4: Quick Weapon slot 4
  • NONE: Blanked out slot

^ Bards cannot use pick lock or disable traps functionality by default. See EEex_Brd.lua in Other section.

So, for example if you wanted bards to have the stealth button in the fifth slot, you would change this in the above code:

  • EEex_SetActionbarButton(0x5, EEex_ACTIONBAR_TYPE.FIND_TRAPS)

    to this:

  • EEex_SetActionbarButton(0x5, EEex_ACTIONBAR_TYPE.STEALTH)

Action Bar Locations

Each value lists the location, counted upwards from 0x0 (the farmost left) to **WHAAAAT???

;
1 / 12