Skip to content

[MOD] EEex (v0.10.2-alpha)

1333436383949

Comments

  • fortysevenfortyseven Member Posts: 96
    @Bubb I have a question regarding opcode 214 (Select Spell).

    Would it be possible for EEex to make the opcode check both a custom 2da spell list and then cross-reference “known spells” before it presents the list you can select spells from?

    I’m trying to make a number of specific select spell abilities that are limited both by the spells known in your spell book and by certain characteristics e.g. spell level, aoe damage, utility spells, damage type, etc.
    At the moment it looks like the opcode lets you cast all spells on a 2da list or forces you to memorise those spells in a spell slot so they can be cast. Essentially, I’m looking for a middle ground between those two options.

    Many thanks!
    47
  • BubbBubb Member Posts: 1,005
    @fortyseven: Something like this would work when invoked from op402 (InvokeLua):
    • B3LIST is a normal op214 2DA. This is hardcoded for the function.
    • B3FILT is the Lua Function you invoke with op402.
    • You can EEex_AddTail() to add any CButtonData you like - see how to construct a CButtonData below. There are no requirements on this spell; if you add it to the internal list, it'll be castable. The 2DA cross-reference is more rigid than what the function can theoretically do, (think iterating the player's known spells, and only adding the Necromancy spells).
    if test2DA then test2DA:free() end
    test2DA = EEex_Wrap2DA("B3LIST")
    
    function B3FILT(effectData, creatureData)
    
        local actorID = EEex_GetActorIDShare(creatureData)
        if not EEex_IsSprite(actorID) then return end
    
        local selectedActors = EEex_GetAllActorIDSelected()
        if #selectedActors ~= 1 or selectedActors[1] ~= actorID then return end
    
        local internalList = EEex_GetClearInternalList(creatureData)
    
        local knownSpells = {}
        EEex_ProcessKnownWizardSpells(actorID, function(resrefLocation)
            local resref = EEex_ReadString(resrefLocation)
            knownSpells[resref] = true
        end)
    
        local typeColumn = test2DA:findColumnLabel("Type")
        test2DA:iterateColumnLabel("ResRef", function(y, resref)
    
            if not knownSpells[resref] then return end
            local type = test2DA:getAtPoint(typeColumn, y)
    
            local spellData = EEex_GetSpellData(resref)
            local spellAbility = EEex_GetSpellAbilityData(creatureData, resref)
            local CButtonData = EEex_ConstructButtonData(resref, spellData, spellAbility, type)
            EEex_AddTail(internalList, CButtonData)
        end)
    
        EEex_SetActionbarState(0x6F)
    
    end
    

    Most of the above is new functionality introduced in master. Also, make sure your spell ability is set up to be Target=7, so the InvokeLua is executed instantly and while the game is paused like normal op214 spells.
  • AndreaColomboAndreaColombo Member Posts: 5,533
    @Bubb Perhaps this has been asked before, but can EEex be made to include an option to disable the grey Stoneskin graphic effect? ToBEx has a similar component for vanilla games and it would be quite handy.
  • fortysevenfortyseven Member Posts: 96
    Bubb wrote: »
    @fortyseven: Something like this would work when invoked from op402 (InvokeLua):
    • B3LIST is a normal op214 2DA. This is hardcoded for the function.
    • B3FILT is the Lua Function you invoke with op402.
    • You can EEex_AddTail() to add any CButtonData you like - see how to construct a CButtonData below. There are no requirements on this spell; if you add it to the internal list, it'll be castable. The 2DA cross-reference is more rigid than what the function can theoretically do, (think iterating the player's known spells, and only adding the Necromancy spells).
    if test2DA then test2DA:free() end
    test2DA = EEex_Wrap2DA("B3LIST")
    
    function B3FILT(effectData, creatureData)
    
        local actorID = EEex_GetActorIDShare(creatureData)
        if not EEex_IsSprite(actorID) then return end
    
        local selectedActors = EEex_GetAllActorIDSelected()
        if #selectedActors ~= 1 or selectedActors[1] ~= actorID then return end
    
        local internalList = EEex_GetClearInternalList(creatureData)
    
        local knownSpells = {}
        EEex_ProcessKnownWizardSpells(actorID, function(resrefLocation)
            local resref = EEex_ReadString(resrefLocation)
            knownSpells[resref] = true
        end)
    
        local typeColumn = test2DA:findColumnLabel("Type")
        test2DA:iterateColumnLabel("ResRef", function(y, resref)
    
            if not knownSpells[resref] then return end
            local type = test2DA:getAtPoint(typeColumn, y)
    
            local spellData = EEex_GetSpellData(resref)
            local spellAbility = EEex_GetSpellAbilityData(creatureData, resref)
            local CButtonData = EEex_ConstructButtonData(resref, spellData, spellAbility, type)
            EEex_AddTail(internalList, CButtonData)
        end)
    
        EEex_SetActionbarState(0x6F)
    
    end
    

    Most of the above is new functionality introduced in master. Also, make sure your spell ability is set up to be Target=7, so the InvokeLua is executed instantly and while the game is paused like normal op214 spells.


    This looks really cool, although I don't think I fully grasp all it can do. I have not been able to process it properly and will be busy with work for the next several days. Would it be possible to get a worked example? Such as a spell selection spell for "all known wiz spells" and "all level 1 spells" for arguments sake?

    You say this is mostly new functionality. I have a master from June which you kindly provided. Would I need an update to that?

    Many thanks @Bupp once again!
  • fortysevenfortyseven Member Posts: 96
    edited April 2021
    @Bupp
    I have tried to implement what you have posted and haven't had any success.
    This might be because I don't have the up-to-date master. However, I also have a feeling I'm not doing it correctly.

    First I created a 2DA file named B3LIST with a custom spell list in the 214 format.
    Then I copied your lua code into a new file named B3FILT.lua
    Then I created a SPL file in Nearinfinity with ability calling opcode 402.
    I set target to 7 (which comes up as "target group" in NI).
    Then in the unused field I entered B3FILT (as string).
    I put all of these files in the override folder and added the prefix M_ to B3FILT.lua

    Unfortunately, I get this error code:
    [string "M_B3FILT.lua"]:2 attempt to call global 'EEex_Wrap2DA' (a nil value)
  • BubbBubb Member Posts: 1,005
    @fortyseven: Don't know who Bupp is, I'm Bubb ;)

    Your steps look mostly right. Only one correction:
    • The Target=7 I mentioned would be the spell ability target, not the effect target. The effect should be targeting Self (1). I've attached an example spell that shows you how it's set up.

    Also, new versions of Near Infinity have EEex field support built in, (thanks argent!), so you don't have to deal with the unused field nonsense. You can find that here.

    And yes, you are getting that error because you aren't using the latest master version of EEex. Download from here and you should have the necessary EEex code for things to work.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Bubb wrote: »
    @fortyseven: Don't know who Bupp is, I'm Bubb ;)

    Your steps look mostly right. Only one correction:
    • The Target=7 I mentioned would be the spell ability target, not the effect target. The effect should be targeting Self (1). I've attached an example spell that shows you how it's set up.

    Also, new versions of Near Infinity have EEex field support built in, (thanks argent!), so you don't have to deal with the unused field nonsense. You can find that here.

    And yes, you are getting that error because you aren't using the latest master version of EEex. Download from here and you should have the necessary EEex code for things to work.

    @Bubb Does EEex work with version 2.6? I have been holding off on reinstalling eeex as I just assumed it wouldn't be compatible
  • GrammarsaladGrammarsalad Member Posts: 2,582
    edited April 2021
    Bubb wrote: »
    @Grammarsalad: It does not. v2.6 compatibility requires a complete rewrite, and I will most likely be taking this time to work on the cross-platform aspirations of EEex, (and as @suy has proposed here, Frida looks like a good framework to build the next version on top of). A working v2.6 version is at least months away, and it might be significantly reworked.

    Makes perfect sense. Thanks for the update (I’ll just keep a pre2.6 version of bgee on my pc until it’s updated)
  • fortysevenfortyseven Member Posts: 96
    edited April 2021
    Sorry for misspelling your name @Bubb. I'm dyslexic and names like yours are pure kryptonite! I had a good run though, took me all these years to get it wrong!

    With the new master the lua code is working fine for one iteration of B3LIST. I cannot get it to recognise different lua variations for different SPL files. In your intial reply you mention that B3LIST is hardcoded. Does that mean I can't make multilple variations where one selection spell uses a lua refering to a 2DA for necromancy spells and another uses a different lua refering to a 2DA for evocation spells?

    Many thanks for all your help!
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Here's an updated pdf readme for EEex. I haven't worked on this in a while, but this version is still more updated than the last time I shared it:

    https://homebrewery.naturalcrit.com/share/rJZOF-sOCV
  • Ludwig_IILudwig_II Member Posts: 379
    I’ll also keep using v2.5 until I can use EEex with it. I think v2.5 is good enough, EEex by itself adds much more than v2.6. I would keep it even just for Bubb’s Spell Menu mod which is much more important than v2.6 in my eyes.
  • GiovanskiGiovanski Member Posts: 13
    edited July 2021
    I had the idea to overwrite 2.6's Baldur.exe with 2.5's .exe to see if EEex would install successfully and to my surprise, it worked. I have been using Bubb's extended spell menu (which is absolutely essential to me) with no issues. I doubt other EEex dependent mods like Olvyn's spells/epic thieving would work as intended though. However, I don't know the consequences of overwriting the .exe with the old version. What exactly am I gaining/missing by doing this?

    Edit: Some components of the aforementioned mods by Olvyn are EEex dependent (really powerful spells option, new Use Poison thief skill).
    Post edited by Giovanski on
  • BubbBubb Member Posts: 1,005
    Overriding the v2.6 exe with the v2.5 exe gives you all of the fixes done to the game files, but reverts the changes / fixes done to the engine. I don't think I'd recommend doing this though, as certain spells were updated alongside new opcode functionality in v2.6, and reverting the exe would cause these spells to break, (as they are expecting engine functionality that isn't there).

    I would either stick with (completely) reverting to v2.5 for now, or heading to v2.6 without EEex if you really want the version bump.
  • GiovanskiGiovanski Member Posts: 13
    Thanks, Bubb. I understand now.
  • fortysevenfortyseven Member Posts: 96
    Bubb wrote: »
    • B3LIST is a normal op214 2DA. This is hardcoded for the function.
    • B3FILT is the Lua Function you invoke with op402.
    • You can EEex_AddTail() to add any CButtonData you like - see how to construct a CButtonData below. There are no requirements on this spell; if you add it to the internal list, it'll be castable.
    if test2DA then test2DA:free() end
    test2DA = EEex_Wrap2DA("B3LIST")
    
    function B3FILT(effectData, creatureData)
    
        local actorID = EEex_GetActorIDShare(creatureData)
        if not EEex_IsSprite(actorID) then return end
    
        local selectedActors = EEex_GetAllActorIDSelected()
        if #selectedActors ~= 1 or selectedActors[1] ~= actorID then return end
    
        local internalList = EEex_GetClearInternalList(creatureData)
    
        local knownSpells = {}
        EEex_ProcessKnownWizardSpells(actorID, function(resrefLocation)
            local resref = EEex_ReadString(resrefLocation)
            knownSpells[resref] = true
        end)
    
        local typeColumn = test2DA:findColumnLabel("Type")
        test2DA:iterateColumnLabel("ResRef", function(y, resref)
    
            if not knownSpells[resref] then return end
            local type = test2DA:getAtPoint(typeColumn, y)
    
            local spellData = EEex_GetSpellData(resref)
            local spellAbility = EEex_GetSpellAbilityData(creatureData, resref)
            local CButtonData = EEex_ConstructButtonData(resref, spellData, spellAbility, type)
            EEex_AddTail(internalList, CButtonData)
        end)
    
        EEex_SetActionbarState(0x6F)
    
    end
    

    I have been trying to create a version of this that lets me use multiple select spell lists for invoke lua spells simultaneously. Unfortnately, this set up appears to remember only one list, the last one that is read by EEex (read in alphanumerical order, as far as I can tell). This list is then used for all spells that use this lua script for invoke lua, irrespective what has been defined inplace of "B3LIST" and "B3FILT". Is this related to how the spell is added to the internal list through EEex_AddTail() and CButton Data? Is there any revision of this code that could be made to let multiple cross-referenced select spells exist along side each other?

    @Bubb or maybe @OlvynChuru (I know you are really good with EEex code as well!) have you got any tips for me?
  • compostercomposter Member Posts: 25
    How to downgrade steam version to BG:EE v2.5.17.0, BG2:EE v2.5.16.6 ?
  • Dan_PDan_P Member Posts: 131
    @Bubb, I made a post about this in the IWDEE forum, with a patch for nymph.BCS. Basically, the game crashes when using Call Woodland Beings and letting the nymph's AI script run. Tested on IWDEE v2.5.17.0 with EEex v0.8.7-alpha. Note that v2.6.6 has an identical nymph.BCS as v2.5.

    The issue is caused by the line in the script that tries to cast "3704" (SPIN704.SPL), which doesn't exist in IWDEE. Without EEex, the spell is skipped and the rest of the script runs. With EEex installed, the game crashes. I've attached the .dmp file from a test crash with only EEex installed.

    Patching the line in nymph.BCS fixes the issue, but I thought I'd mention this in case you wanted to look into it.
  • shadowlichshadowlich Member Posts: 60
    Logiteks wrote: »
    about this timer visualization feature that was not implemented after all:
    xwshsmby22uq.gif
    Could anyone please point to offsets (structure and names used in EEex docs) where this timer data is stored? (round, modal actions, spell intervals, spell cooldown, possibly attacks, although these were not mentioned in Bubb's post)
    Logiteks wrote: »
    Flashburn wrote: »
    @Logiteks
    My best guess is to look at M__EEex.lua, B3_Timer.lua, and B3_Timer.menu.

    Thanks. Indeed, there are even dedicated functions to read this data already:
    EEex_GetActorModalTimer
    EEex_GetActorSpellTimer
    EEex_GetActorCastTimer


    I use these 3 timers too, BUT each character has its own timers, not global party timers. In the sreenshot you see Imoen detect timer (in blue) and casting timer (pink) as well as Garrick casting timer...

    40wn5dszupfh.jpg

  • EndarireEndarire Member Posts: 1,519
    edited November 2021
    @Bubb
    I got this install error log from the latest EEex with this mod wad. This was likely due to installing new thieving skills. (I had all the EEex install options enabled, and I installed DLCMerger and EET Core before this mod list.)

    Thankee for fixing!

    //Installing [EEex] [0.8.7]
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Appending to files ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying 1 file ...
    //Copying 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Adding projectile file override/exlinefr.pro ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Appending to files ...
    //Appending to files ...
    //Copying 1 file ...
    //Added projectile file override/exlinefr.pro
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //[.\lang\en_us\dialog.tlk] created, 271501 string entries
    //SUCCESSFULLY INSTALLED EEex
    //[C:\a\PI\Tools\WeiDU\247.00\weidu.exe] WeiDU version 24700
    //Using .\lang\en_us\dialog.tlk
    //Installing [Make it possible to add new thieving skills to the game (only install if you're going to install a mod that adds new thieving skills)] [0.8.7]
    //Copying and patching 1 file ...
    //WARNING ui.menu - pattern not found:
    //helpTextString = characters\[currentID\]\.proficiencies\.details
    //Patching ui.menu - pattern replaced 1 time(s):
    //for k, v in ipairs(characters\[currentID\]\.proficiencies\.class_skills) do
    //Patching ui.menu - pattern replaced 1 time(s):
    //--reload language
    //Patching ui.menu - pattern replaced 1 time(s):
    //name [\'\"]CHARGEN_PROFICIENCIES[\'\"]\([^`]*\)[oO]n[oO]pen\([^\"]*\)\"
    //WARNING ui.menu - pattern not found:
    //createCharScreen:OnProficiencyPlusMinusButtonClick(chargen\.proficiency\[currentChargenProficiency\]\.id, %plusminustruestring%)
    //WARNING ui.menu - pattern not found:
    //createCharScreen:OnProficiencyPlusMinusButtonClick(chargen\.proficiency\[currentChargenProficiency\]\.id, %plusminusfalsestring%)
    //Patching ui.menu - pattern replaced 2 time(s):
    //if createCharScreen:IsThiefSkillPlusMinusButtonClickable() then
    //Patching ui.menu - pattern replaced 2 time(s):
    //createCharScreen:OnThiefSkillPlusMinusButtonClick(chargen\.thief_skill\[currentChargenThiefSkill\]\.id, %plusminustruestring%)
    //Patching ui.menu - pattern replaced 2 time(s):
    //createCharScreen:OnThiefSkillPlusMinusButtonClick(chargen\.thief_skill\[currentChargenThiefSkill\]\.id, %plusminusfalsestring%)
    //Patching ui.menu - pattern replaced 1 time(s):
    //name [\'\"]CHARGEN_PROFICIENCIES[\'\"]\([^`]*\)createCharScreen:OnDoneButtonClick()
    //INSTALLED WITH WARNINGS Make it possible to add new thieving skills to the game (only install if you're going to install a mod that adds new thieving skills)
    //
    //WARNING: EEex : 1 has encounter errors durring installation, exited with ExitCode = 3
    //WARNING: unpausing installation will continue from next component.
  • SardukeSarduke Member Posts: 3
    Hellow eveyone was wondering how i can use EEex (v0.8.7-alpha) in BG EE 2.6 THIS MOD DOESNT SEEM TO WORK WITH VERSION 2.6 ANY HELP WOULD BE APPRICIATED
  • fortysevenfortyseven Member Posts: 96
    Sarduke wrote: »
    Hellow eveyone was wondering how i can use EEex (v0.8.7-alpha) in BG EE 2.6 THIS MOD DOESNT SEEM TO WORK WITH VERSION 2.6 ANY HELP WOULD BE APPRICIATED
    From what I understand, you can't use any EEex version before 0.9 with 2.6. If you check out Bubb's github page you can track the progress towards implementing functionality of 0.8.7 in the >0.9 versions. From what I understand all previous mods have been broken and will need to be adapted, but don't forget we are speaking of the jump from 32-bit to 64-bit that occurred between 0.8.7 and 0.9.

    @Bubb Just wanted to thank you for your ongoing work on EEex. Looks like you are making great progress in catching up to 2.6. Can't wait to see what it will look like when it's all put back together again.
  • v1ldv1ld Member Posts: 22
    edited December 2021
    Wanted to echo the thanks to @Bubb for the ongoing EEex port to 2.6. I've been using 0.9.x and both the spell menu and the shift-mouse effects menu have been hugely useful. The effects menu in particular is a game-changer with SCS.

    Are any of the timer visualizations in this thread available for the 0.9 series? The stealth cooldown timer would be especially nice to see, though all of those timers would be useful, especially if implemented as per-character cooldown bars as in the pics from @shadowlich above.
  • BubbBubb Member Posts: 1,005
    Thanks for the encouragement guys ^^

    Catching up with v2.6 is going faster now that I have the foundation down. The major features that connect the engine to Lua are reimplemented, (EEex_LuaAction, EEex_LuaTrigger, EEex_LuaObject, InvokeLua).

    The new Lua Bindings system is also in place which should allow modders to easily interface with the engine, (and prevent another v2.6-breakage situation). Most of the engine's internal state can be read / written to using the source-level names as documented here. These structures aren't updated to EE v2.6 yet, but the changes were minor and almost all of them should still be valid.

    I'll try to get proper documentation up so things aren't so confusing and look into finishing a timer visualization module.
  • EndarireEndarire Member Posts: 1,519
    edited January 2022
    @Bubb
    <cheerleads with pom-poms for Bubb!>

    Thankee for making EEex! Our family eagerly anticipates your combining your EEex mods like your spell menu, auto loot, and creature info into EEex as install time options as well as updating EEex compatibility to work with 2.6 and all EEex-dependent mods!

    We'd also like an option for all player-creatures (even those beyond the normal 8ish unit limit) to be able to set off traps and reveal the FoW/fog of war/darkness. We'd also like for all party members to be able to summon a separate familiar instead of the main character only.

    Thankee!
  • XcfX-RelayXcfX-Relay Member Posts: 2
    Is there any chance we could create an opcode that actually protects from thief detect illusions ability? Or barring that, change the ability itself to give the character see invisibility script instead of its current form?

    I just don't like that it completely negates the need to interact with interesting invisibility/protections systems like from the spell revisions mod.
  • Ludwig_IILudwig_II Member Posts: 379
    Thank you so much Bubb for making this compatible with 2.6. Now that I can use your Spell Menu mod, I can safely play the 2.6 patch. Cheers
  • FlashburnFlashburn Member Posts: 1,847
    Endarire wrote: »
    We'd also like an option for all player-creatures (even those beyond the normal 8ish unit limit) to be able to set off traps...

    I know Ding0 Tweaks can do this part.
  • EndarireEndarire Member Posts: 1,519
    @Flashburn
    I know of that but it isn't EET compatible which is why I asked.
  • FlashburnFlashburn Member Posts: 1,847
    Endarire wrote: »
    @Flashburn
    I know of that but it isn't EET compatible which is why I asked.
    Yes it is. I'm using both EET and D0Tweaks, and traps can be set off by both hostiles and friendlies in the entire tetralogy.
Sign In or Register to comment.