# EEex
##### Author: [Bubb](https://forums.beamdog.com/profile/Bubb) ##### Contributors: fearless, OlvynChuru, CrevsDaak ##### 0.7.1-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
\page
##### Table Of Contents
\page # 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. ### Just give me the link! Alpha versions of this project can be found [here](https://github.com/Bubb13/EEex/releases) ### 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](https://forums.beamdog.com/discussion/71798/mod-eeex-v0-5-0-alpha/p1) forum. In addition, EEex is available on [GitHub](https://github.com/Bubb13/EEex), 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](https://forums.beamdog.com/discussion/50441/modmerge-merge-your-steam-gog-zip-based-dlc-into-something-weidu-nearinfinity-dltcep-can-use/p1) 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. \page
# Contents ## Component Overview: Main Component The main component installs the enirity of the mod, allowing users to access all new functionality (either as a modder or player).
\page
# 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.
\page
## 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](https://github.com/Grammarsalad/readmes/issues/4) or [see below](#p11) ### 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](p11) for use example, or [click here](https://github.com/Grammarsalad/readmes/issues/8)
\page
### 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](#p12) 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)
\page
## 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](https://github.com/Grammarsalad/readmes/blob/master/images/EEex/oqagw1v8ugkl.gif)
\page
## Functions: ## New 2DA Files ### EEex_2DAGetAtStrings.2da Returns a string from a 2D array based on the specified column and row **Parameters** - **C2DArray** - the 2D array C2DArray structure that stores the data - **columnString** - the text of the column name to lookup and fetch string for - **rowString** - the text of the row name to lookup and fetch string for **Return** Returns a string from the specified column and row in the 2D array **Example**: Copy paste version [Here](https://github.com/Grammarsalad/readmes/issues/14) **See Also**: - EEex_2DALoad - [C2DArray](https://github.com/Grammarsalad/readmes/issues/15) ### EEex_2DALoad.2da Loads a two dimensional (2D) resource - a .2da text based file that stores game data (typically rules etc) in columns and rows - into a C2DArray structure **Parameters** - **_2DAResref** - resource reference of the 2da file to load into a C2DArray structure **Return** Returns a [C2DArray](https://github.com/Grammarsalad/readmes/issues/15) **Example**: Copy paste version [Here](https://github.com/Grammarsalad/readmes/issues/18) **See Also**: - EEex_2DAGetAtStrings - [C2DArray](https://github.com/Grammarsalad/readmes/issues/15)
\page
## Actions ### EEex_AddActionHook(func) Add a function to an ActionHook **Parameters** - func **Return** None **Example**: The following function is an example of how a modder could use this file’s hook to dynamically transform an actor-targeted spell into a point-targeted one instead. (Put the following function either in UI.MENU or a M_*.lua): Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/19). (Second Post) **See Also**: - EEex_InstallActionHook - EEex_HookAction ### EEex_EvalActionsAsActor(CAIScriptFile, actorID) Executes compiled actions returned by EEex_ParseActionsString. Results practically identical to using C:Eval(), though note that executing compiled actions is significantly faster than parsing the actions string every call. **Parameters**: - CAIScriptFile - compiled script object to evaluate - actorID - id of actor that evaluation applies to **Return**: None **Example**: Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/20) **See Also**: - EEex_ParseActionsString - EEex_EvalActionsStringAsActor ### EEex_EvalActionsAsActorResume(CAIScriptFile, actorID) Executes compiled actions returned by EEex_ParseActionsString. Note that due to intentional design, the following function attempts to resume the currently executing action after forcing the passed actions. ** ONLY WORKS CORRECTLY FOR ACTIONS DEFINED IN INSTANT.IDS ** **Parameters** CAIScriptFile - compiled script object to evaluate actorID - id of actor that evaluation applies to **Return** None **Example**: Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/21) **See Also** - EEex_ParseActionsString - EEex_EvalActionsAsActor - EEex_EvalActionsStringAsActor - EEex_EvalActionsStringAsActorResume
\page
### EEex_EvalActionsStringAsActor(string, actorID) Same as EEex_EvalActionsAsActor, though intead of passing a compiled script object, this function compiles the script from the given string and frees the resulting script object for you. Use this function sparingly, as compiling scripts takes a good amount of time. **Parameters** - string - string containing script actions to evaluate - actorID - id of actor that evaluation applies to **Return** None **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/22) **See Also** - EEex_EvalActionsAsActor - EEex_EvalActionsStringAsActorResume ### EEex_EvalActionsStringAsActorResume(string, actorID) Same as EEex_EvalActionsAsActorResume, though intead of passing a compiled script object, this function compiles the script from the given string and frees the resulting script object for you. Use this function sparingly, as compiling scripts takes a good amount of time. **Parameters** - string - string containing script actions to evaluate - actorID - id of actor that evaluation applies to **Return** ? None? **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/23) **See Also** - EEex_EvalActionsAsActor - EEex_EvalActionsStringAsActor - EEex_EvalActionsAsActorResume ### EEex_FreeActions(CAIScriptFile) Frees the compiled scripts returned by EEex_ParseActionsString. Ensure that the freed actions are never used again, as attempting to reference freed actions will result in a crash. **Parameters** - CAIScriptFile - compiled script object to free **Return** None **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/24) **See Also** - EEex_ParseActionsString - EEex_EvalActionsAsActor - EEex_EvalActionsStringAsActor - EEex_EvalActionsStringAsActorResume
\page
### EEex_GetActionID(actionData) Get id of action data **Parameters** - actionData - action data to return id for **Return** Returns action id of action data **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/25) **See Also** - EEex_SetActionID - EEex_GetActionTarget - EEex_SetActionTarget ### EEex_GetActionPointX(actionData) Get x coordinate for action data Parameters actionData - action data to return x coordinate for Return Returns x coordinate of action data **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/26) **See Also** - EEex_GetActionPointY - EEex_SetActionPointX - EEex_SetActionPointY ### EEex_GetActionPointY(actionData) Get y coordinate for action data **Parameters** - actionData - action data to return y coordinate for **Return** Returns y coordinate of action data **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/27) **See Also** - EEex_GetActionPointX - EEex_SetActionPointX - EEex_SetActionPointY ### EEex_GetActionString1(actionData) Get action string for action data **Parameters** - actionData - action data to return action string for **Return** Returns action string of action data **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/28) **See Also** - EEex_SetActionString1
\page
### EEex_GetActionTarget(actionData) Get target for action data **Parameters** - actionData - action data to return target for **Return** Returns target of action data **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/29) **See Also** - EEex_GetActionID - EEex_SetActionID - EEex_SetActionTarget ### EEex_GetActorCurrentAction(actorID) Returns the ID of the action the actor is currently doing, based on ACTION.IDS **Parameters** - actorID - the actor’s id to return the ID of the action the actor is currently doing **Return** Returns a WORD value indicating the action id based on ACTION.IDS **Notes** if the actor is currently moving to a point, it will return 23 because MoveToPoint() is action 23 in ACTION.IDS. If the actor isn’t doing anything, it will return 0. **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/30) ### EEex_ParseActionsString(string) Parses the given string as if it was fed through C:Eval() and returns the compiled script object, (only filled with actions). Use in conjunction with one of the EEex_EvalActions* functions. Free compiled scripts by using EEex_FreeActions **Parameters** - string - string containing script actions to evaluate and compile **Return** Returns a compiled script object CAIScriptFile **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/31) **See Also** - EEex_EvalActionsAsActor - EEex_EvalActionsAsActorResume - EEex_EvalActionsStringAsActor - EEex_EvalActionsStringAsActorResume - EEex_FreeActions
\page
### EEex_SetActionID(actionData, newID) Set new id of action data **Parameters** - actionData - action data to set id for - newID - new action id to set **Return** Returns new action id of action data **Example** Copy Paste Version [Here](https://github.com/Grammarsalad/readmes/issues/32) **See Also**: - EEex_GetActionID - EEex_GetActionTarget - EEex_SetActionTarget ### EEex_SetActionPointX(actionData, newX) Set x coordinate of action data **Parameters** - actionData - action data to set x coordinate for - newX - new x coordinate to set **Return** Returns new x coordinate of action data **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/33) **See Also** - EEex_GetActionPointX - EEex_GetActionPointY - EEex_SetActionPointY ### EEex_SetActionPointY(actionData, newY) Set y coordinate of action data **Parameters** - actionData - action data to set y coordinate for - newY - new y coordinate to set **Return** Returns new y coordinate of action data **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/34) **See Also** - EEex_GetActionPointX - EEex_GetActionPointY - EEex_SetActionPointX ### EEex_SetActionString1(actionData, newString1) Set action string of action data **Parameters** - actionData - action data to set action string for - newString1 - new action string to set **Return** Returns new action string of action data **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/35) **See Also** - EEex_GetActionString1
\page
### EEex_SetActionTarget(actionData, newTarget) Set target of action data **Parameters** - actionData - action data to set target for - newTarget - new target to set **Return** Returns new target of action data **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/36) **See Also** - EEex_GetActionID - EEex_SetActionID - EEex_GetActionTarget
\page
## Action Bar ### EEex_ActionbarListener(func) Add a listener function to the action bar. Use this function to change action bar buttons. **Parameters** - func - the Lua function to add as a listener for the actionbar **Return** None **Example** The following assigns the search button to bards in the fifth slot: [Here](https://github.com/Grammarsalad/B_Kits/blob/master/B_Kits/lib/M_B_BRD.lua) is a copy/paste version. Find more details, including config values, see [below](#p12) **See Also** - EEex_InstallActionbarHook - EEex_HookActionbar ### EEex_GetActionbarButton(buttonIndex) Retrieves the button type of a specific button on the actionbar. **Parameters** - buttonIndex - the index of the button on the actionbar **Return** Returns the type of the button, see Actionbar button types for details **Actionbar button types**: See [Here](https://github.com/Grammarsalad/readmes/issues/37) **Note**: other button types not listed may be available, but typically are used internally for spell buttons and other dynamic buttons for the game engine. **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/38) **See Also** - EEex_SetActionbarButton ### EEex_GetActionbarButtonFrame(buttonIndex) Returns the current frame of the actionbar button at buttonIndex, taking into account the click status. **Parameters** - buttonIndex - the index of the button on the actionbar **Return** Returns the current frame **Example** Copy Paste [Here](https://github.com/Grammarsalad/readmes/issues/39) **See Also** - EEex_GetActionbarButton - EEex_SetActionbarButton
\page
### EEex_GetActionbarState() Gets the state of the actionbar **Parameters** None **Return** Returns the action bar state which can be one of the following: See [Here](https://github.com/Grammarsalad/readmes/issues/40) **Notes** See [Here](https://github.com/Grammarsalad/readmes/issues/41) **See Also** - EEex_SetActionbarState ### EEex_GetLastActionbarState() Gets the last state of the actionbar **Parameters** None **Return** Returns the action bar state which can be one of the following: See [Here](https://github.com/Grammarsalad/readmes/issues/40) **See Also** - EEex_SetActionbarState - EEex_GetActionbarState ### EEex_GetQuickButtons(m_CGameSprite, buttonType, existenceCheck) Returns a list of quick slot buttons **Parameters** - m_CGameSprite - pointer to game sprite object - buttonType - type of button, see notes - existenceCheck - boolean true or false **Returns** Returns a list of quick buttons **Notes** buttonType values can be one of the following: See [here](https://github.com/Grammarsalad/readmes/issues/37) **See Also** - EEex_UseCGameButtonList ### EEex_IsActionbarButtonDown(buttonIndex) Determines whether a specific button in the actionbar is in the down state (being clicked) **Parameters** - buttonIndex - the index of the button on the actionbar **Return** Returns true if the actionbar button is being clicked, otherwise returns false **Example** [Here](https://github.com/Grammarsalad/readmes/issues/42) **See Also** - EEex_SetActionbarState - EEex_SetActionbarButton
\page
### EEex_SetActionbarButton(buttonIndex, buttonType) Sets the button type of a specific button on the actionbar **Parameters** - buttonIndex - the index of the button on the actionbar - buttonType - the type of the button to set, see Actionbar button types for details **Return** None **Actionbar button types**: See [Here](https://github.com/Grammarsalad/readmes/issues/37) **Example** [Here](https://github.com/Grammarsalad/readmes/issues/43) **See Also** - EEex_GetActionbarButton ### EEex_SetActionbarState(actionbarConfig) Sets the state of the actionbar **Parameters** - actionbarConfig **Return** None **Example** [Here](https://github.com/Grammarsalad/readmes/issues/44) **See Also** - EEex_GetActionbarState ### EEex_UpdateActionbar() Forces the actionbar to refresh its state. Use if making changes with EEex_SetActionbarButton outside of an actionbar listener. **Parameters** None **Return** None **Example** [Here](https://github.com/Grammarsalad/readmes/issues/45) **See Also** - EEex_SetActionbarButton - EEex_GetActionbarButton ### EEex_UseCGameButtonList(m_CGameSprite, m_CGameButtonList, resref, action) Return the specified button’s action data EEex_UseCGameButtonList(m_CGameSprite, m_CGameButtonList, resref, action) Parameters - m_CGameSprite - pointer to game sprite object - m_CGameButtonList - pointer to button list data from EEex_GetQuickButtons - resref - an existing button’s resource reference to return button action data for - action - return button action data **Returns** None **Notes** Returns button action data via the action parameter **Example** See [Here](https://github.com/Grammarsalad/readmes/issues/46) **See Also** - EEex_GetQuickButtons - EEex_ReadySpell
\page
## Retrieving actor IDs ### EEex_GetActorIDArea(actorID) Returns an array of actor id’s in an area based on the area that the specified actorID is currently in **Parameters** - actorID - the id of the actor to use **Return** Returns array of actor ids **Notes** Offset 0x14 of CGameObject is m_pArea. Iterates through the actors in m_pArea via EEex_IterateActorIDs **Example** [Here](https://github.com/Grammarsalad/readmes/issues/47) **See Also** - EEex_GetActorIDShare - EEex_IterateActorIDs ### EEex_GetActorIDCursor() Returns actor id that is currently under the cursor (mouse pointer) **Parameters** None **Return** Returns a DWORD value representing actor id or 0 if no actor is under the cursor **Notes** Reads - CBaldurChitin.m_pObjectGame (m_pObjectGame is CInfGame*) - CInfGame.m_visibleArea (offset 0x3DA0). Uses m_visibleArea to read array index of CInfGame.m_gameAreas[12] (offset 0x3DA4). CInfGame.m_gameAreas[12] is an array of pointers to CGameArea structures. Reads offset 0x21C of CGameArea and reads the value. If the value is -1 it will return 0, otherwise returns the value read. **Example** [Here](https://github.com/Grammarsalad/readmes/issues/48) **See Also** - EEex_GetActorIDShare - EEex_IterateActorIDs ### EEex_GetActorIDLoaded() Returns an array of actor id’s loaded in the current area **Parameters** None **Return** Returns array of actor ids **Example** [Here](https://github.com/Grammarsalad/readmes/issues/49) **See Also** - EEex_GetActorIDShare - EEex_IterateActorIDs
\page
### EEex_GetActorIDPortrait(slot) Returns the actor id for the specified portrait slot **Parameters** - slot - slot id to return actor id for **Return** Returns the actor id for the specified portrait slot **Notes** Internally calls the CInfGame Class method: long CInfGame::GetCharacterId(short nPortrait) **Example** [Here](https://github.com/Grammarsalad/readmes/issues/50) **See Also** - EEex_GetActorIDShare - EEex_IterateActorIDs - CInfGame Class - CInfGame::GetCharacterId ### EEex_GetActorIDSelected() Returns actor id of currently selected character **Parameters** None **Return** Returns the actor id of currently selected character or 0 **Notes** Reads: - CBaldurChitin.m_pObjectGame (m_pObjectGame is CInfGame*) - CInfGame.m_group (m_group is CAIGroup*) - CAIGroup.m_memberList (m_memberList is CTypedPtrList*) - CTypedPtrList.m_cPtrList (m_cPtrList is CPtrList*) - CPtrList.m_pNodeHead (m_pNodeHead is CPtrList::CNode) If m_pNodeHead is not 0 then reads CPtrList::CNode.data and returns the value as actor id otherwise returns 0 **Example** [Here](https://github.com/Grammarsalad/readmes/issues/51) **See Also** - EEex_GetAllActorIDSelected - EEex_GetActorIDShare - EEex_IterateActorIDs ### EEex_GetActorIDShare(share) Returns the actorID for the given share creatureData. **Parameters** - share - pointer to the share (CGameObject) **Return** Returns a DWORD value from CGameObject.m_id **Notes** Similar to using this CAIObjectType Class method: CGameObject* CAIObjectType::GetShare(CGameAIBase* caller, int checkBackList) and reading offset 0x34 of the returned CGameObject **Example** [Here](https://github.com/Grammarsalad/readmes/issues/52) **See Also** - EEex_IterateActorIDs - CGameObject - CAIObjectType Class - CAIObjectType::GetShare
\page
### EEex_GetAllActorIDSelected() Returns an array of actor id’s that are selected **Parameters** None **Return** Returns array of actor ids **Example** [Here](https://github.com/Grammarsalad/readmes/issues/53) **See Also** - EEex_GetActorIDSelected - EEex_GetActorIDShare - EEex_IterateActorIDs ### EEex_IterateActorIDs(m_gameArea, func) Iterates through all actors in an area **Parameters** - m_gameArea - CGameArea - func - **Return** Special **Example** [Here](https://github.com/Grammarsalad/readmes/issues/54) **See Also** - EEex_GetActorIDShare
\page
## Actor ### EEex_AlterActorEffect(actorID, match_table, set_table, multi_match) This is basically like the WeiDU ALTER_EFFECT function, except that it alters effects in the middle of the game **Parameters** - actorID - actor id - match_table - match table - set_table - set table - multi_match - no of matches **Return** None **Example** [Here](https://github.com/Grammarsalad/readmes/issues/55) ### EEex_ApplyEffectToActor(actorID, args) Directly applies an effect to an actor based on the args table **Parameters** - actorID - the actor id to apply effect to - args - args table **Return** None **Example** [Here](https://github.com/Grammarsalad/readmes/issues/56) ### EEex_GetActorAlignment(actorID) Return alignment of actor **Parameters** - actorID - actor id to return alignment for **Return** Returns a BYTE value indicating alignment **Example** [Here](https://github.com/Grammarsalad/readmes/issues/57) **See Also** - EEex_GetActorAlignment - EEex_GetActorAllegiance - EEex_GetActorClass - EEex_GetActorGender - EEex_GetActorKit - EEex_GetActorName - EEex_GetActorRace ### EEex_GetActorAllegiance(actorID) Returns the actor’s allegiance **Parameters** - actorID - actor id to return allegiance for **Return** Returns a BYTE value indicating allegiance **Example** [Here](https://github.com/Grammarsalad/readmes/issues/58) **See Also** - EEex_GetActorAlignment - EEex_GetActorClass - EEex_GetActorGender - EEex_GetActorKit - EEex_GetActorName - EEex_GetActorRace
\page
### EEex_GetActorAnimation(actorID) Returns the actor’s animation, (as defined in ANIMATE.IDS; stored at offset 0x28 of the .CRE, or optionally overriden by the actor structure at offset 0x30) **Parameters** - actorID - the actor id to return the animation for **Return** **Example** [Here](https://github.com/Grammarsalad/readmes/issues/59) ### EEex_GetActorAreaRes(actorID) Returns the actor’s current area resref as a string. If the game was just loaded, sometimes the actor doesn’t know what area they’re in yet, so it’ll return “” in that case. **Parameters** - actorID - the actor’s id to get the current area for **Return** Returns a string indicating the area for the current actor **Example** [Here](https://github.com/Grammarsalad/readmes/issues/60) **See Also** - EEex_GetActorAreaSize ### EEex_GetActorAreaSize(actorID) Gets the maximum X and Y coordinates of the area the actor is in (for outside areas the numbers are usually in the thousands). If the game was just loaded, sometimes it will return 0 for both coordinates because the actor doesn’t have a pointer to the area yet. **Parameters** - actorID - the actor’s id to get the current max area coordinates for **Return** Returns an x and y value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/61) **See Also** - EEex_GetActorAreaRes ### EEex_GetActorBaseCharisma(actorID) Returns the actor’s base charisma, (defined at offset 0x23E of the .CRE) **Parameters** - actorID - the actor id to return the base charisma for **Return** Returns the base charisma as a byte value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/62) **See Also** - EEex_GetActorBaseConstitution - EEex_GetActorBaseDexterity - EEex_GetActorBaseIntelligence - EEex_GetActorBaseStrength - EEex_GetActorBaseWisdom
\page
### EEex_GetActorBaseConstitution(actorID) Returns the actor’s base constitution, (defined at offset 0x23D of the .CRE) **Parameters** - actorID - the actor id to return the base constitution for **Return** Returns the base constitution as a byte value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/63) **See Also** - EEex_GetActorBaseCharisma - EEex_GetActorBaseDexterity - EEex_GetActorBaseIntelligence - EEex_GetActorBaseStrength - EEex_GetActorBaseWisdom ### EEex_GetActorBaseDexterity(actorID) Returns the actor’s base dexterity, (defined at offset 0x23C of the .CRE) **Parameters** - actorID - the actor id to return the base dexterity for **Return** Returns the base dexterity as a byte value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/64) **See Also** - EEex_GetActorBaseConstitution - EEex_GetActorBaseCharasma - EEex_GetActorBaseIntelligence - EEex_GetActorBaseStrength - EEex_GetActorBaseWisdom ### EEex_GetActorBaseIntelligence(actorID) Returns the actor’s base intelligence, (defined at offset 0x23A of the .CRE) **Parameters** - actorID - the actor id to return the base intelligence for **Return** Returns the base intelligence as a byte value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/65) **See Also** - EEex_GetActorBaseConstitution - EEex_GetActorBaseCharasma - EEex_GetActorBaseDexterity - EEex_GetActorBaseStrength - EEex_GetActorBaseWisdom
\page
### EEex_GetActorBaseStrength(actorID) Returns the actor’s base strength, (defined at offset 0x238 of the .CRE) **Parameters** - actorID - the actor id to return the base strength for **Return** Returns the base strength as a byte value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/66) **See Also** - EEex_GetActorBaseConstitution - EEex_GetActorBaseCharasma - EEex_GetActorBaseDexterity - EEex_GetActorBaseIntelligence - EEex_GetActorBaseWisdom ### EEex_GetActorBaseWisdom(actorID) Returns the actor’s base wisdom, (defined at offset 0x23B of the .CRE) **Parameters** - actorID - the actor id to return the base wisdom for **Return** Returns the base wisdom as a byte value **Example** [Here](https://github.com/Grammarsalad/readmes/issues/67) **See Also** - EEex_GetActorBaseConstitution - EEex_GetActorBaseCharasma - EEex_GetActorBaseDexterity - EEex_GetActorBaseIntelligence - EEex_GetActorBaseStrength ### EEex_GetActorCastTimer(actorID) Returns cast counter value for the specified actor **Parameters** - actorID - actor id to return cast counter value for **Return** Returns a value between 0 and 100 **Example** [Here](https://github.com/Grammarsalad/readmes/issues/68) #### EEex_GetActorClass(actorID) Detects class by class.ids value. EEex_GetActorClass(actorID) == 0x6 returns true if a paladin has been selected **Parameters** - actorID - actor id to return class for **Return** Returns a BYTE value indicating class **Example** [Here](https://github.com/Grammarsalad/readmes/issues/69) **See Also** - EEex_GetActorAlignment - EEex_GetActorAllegiance - EEex_GetActorGender - EEex_GetActorKit - EEex_GetActorName - EEex_GetActorRace
\page
#### EEex_GetActorClassScript(actorID) Returns the actor’s class script, (defined at offset 0x250 of the .CRE, or optionally overriden by the actor structure at offset 0x60) **Parameters** - actorID - the actor’s id **Return** Returns the resref of the actor's class script. **Example** [Here](https://github.com/Grammarsalad/readmes/issues/70) **See Also** - EEex_GetActorDefaultScript - EEex_GetActorGeneralScript - EEex_GetActorOverrideScript - EEex_GetActorRaceScript - EEex_GetActorSpecificsScript #### EEex_GetActorClassString(actorID) Returns actor class as a string **Parameters** - actorID - actor id to return class string for **Return** Returns actor class as a string **Example** [Here](https://github.com/Grammarsalad/readmes/issues/71) **See Also** - EEex_GetActorClass - EEex_GetActorKit #### 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(). **Parameters** - actorID - the actor's id to return the current action for **Return** **Example** [Here](https://github.com/Grammarsalad/readmes/issues/73) **See Also** #### EEex_GetActorCurrentDest(actorID) Returns actor current destination as an x, y point coordinate **Parameters** - actorID - the actor’s id to return the current destination for **Return** Returns an x, y point coordinate **Example** [Here](https://github.com/Grammarsalad/readmes/issues/72) **See Also** - EEex_GetActorPosDest - EEex_GetActorMovementRate - EEex_GetActorDirection - EEex_GetActorLocation
\page
#### EEex_GetActorCurrentHP(actorID) Returns the actor’s current hit points (HP), (defined at offset 0x24 of the .CRE) **Parameters** - actorID - actor id to return current hit points for **Return** A WORD value indicating the current hit points of the actor **Example** [Here](https://github.com/Grammarsalad/readmes/issues/74) **See Also** - EEex_GetActorAlignment - EEex_GetActorAllegiance - EEex_GetActorClass - EEex_GetActorGender - EEex_GetActorName - EEex_GetActorKit - EEex_GetActorRace #### EEex_GetActorDefaultScript(actorID) Returns the actor’s default script resref as a string, (defined at offset 0x268 of the .CRE, or optionally overriden by the actor structure at offset 0x70). **Parameters** - actorID - the actor’s id **Return** Returns a string **Example** [Here](https://github.com/Grammarsalad/readmes/issues/75) **See Also** - EEex_GetActorClassScript - EEex_GetActorGeneralScript - EEex_GetActorOverrideScript - EEex_GetActorRaceScript - EEex_GetActorSpecificsScript
# CONTINUE #### 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. \page #### 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](https://raw.githubusercontent.com/Grammarsalad/readmes/master/images/EEex/codesamp5.png) Copy paste version [Here](https://github.com/Grammarsalad/readmes/issues/13) #### 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_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](https://github.com/Grammarsalad/readmes/issues/5) or [see below](#p11) \page #### 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 \page
## 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](#p11) or for copy/paste example, [click here](https://github.com/Grammarsalad/readmes/issues/7). \page
## DO NOT TOUCH This is the section that details the things that must not be touched (unless you *really* know what you are doing.)
\page
# 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
\page
## 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???