Skip to content

[MOD] EEex (v0.10.2-alpha)

1262729313248

Comments

  • GrammarsaladGrammarsalad Member Posts: 2,582
    edited January 2020
    I cannot for the life of me get extended skills to work. I figured that I was doing something wrong--I'm sure that I was--but it looks like there is even something odd with @OlvynChuru 's Epic Thieving mod. I installed just EEex and epic thieving

    When I just call the ADD_EXTENDED_SKILL function in BGEE version 2.5.16, I can add skill points during character creation. However, when I look at the character sheet, all the points are gone! I remember having this issue before, but I think it was fixed such that, iirc, something like the code below worked both during character creation and when viewing the character sheet. But, no more:

    LAF ADD_EXTENDED_SKILL
    INT_VAR
    	stat = 2001 //
    	name = RESOLVE_STR_REF(@501002)         //USe Scroll
    	description = RESOLVE_STR_REF(@501003)  //US description
    	opcode = 401 //Modify stat
    	visibility = 1 //appears
    STR_VAR
    	class_include = ~{4}~ //Usable by thief
    	kit_include = ~{}~ //Usable by stalker as well
    	kit_exclude = ~{}~ //Not usable by swashbuckler or shadowdancer
    	stat_exclude = ~{}~ //
    END
    
    
    APPEND ~STATS.ids~ ~2001%TAB%READ_SCROLLS~         //Read Scrolls
    
    

    But, still, I assumed that I was doing something dumb, so uninstalled everything, and verified that UI.menu was not in the override in case I gunked it up somehow. I then reinstalled EEex (including the extend skill component), and then installed just Epic Thieving's use poison skill. No other mods are installed.

    But, there are still issues. The use poison skill is not reset to zero when viewing it on the character sheet, but it shows values that are inconsistent with the number of points put into the skill. I've tried it numerous times with the assassin, and added all 40 points to the skill, and when I look at the char sheet, I see a different value each time I create a new character (e.g. 20, 16, 8, 44...) Screenshots of my most recent attempt attached...
    1.PNG 333.8K
    2.PNG 564.1K
  • BubbBubb Member Posts: 1,005
    edited January 2020
    @Grammarsalad: Ok, looked through it and here's what I found:

    Everything is working engine-side, and most games don't have the issue. It appears the old blue-stone BG:EE, (without SoD), is what's causing the issue. This UI.MENU patch pattern is failing during install:
    WARNING ui.menu - pattern not found:
    area 762 704 230 40\([^`]*\)createCharScreen:OnDoneButtonClick()
    

    Pinging @OlvynChuru to look at the above warning.
    BTW @OlvynChuru, while you're here, I noticed that the following line in UI.MENU, (line appears twice), prevents extended skills from being decremented while in initial chargen:
    if chargen.levelingUp and chargen.thief_skill[currentChargenThiefSkill].value > extendedSkills[exIndex].base then
    

    Removing the following portion of that line restores the decrementing functionality:
    chargen.levelingUp and
    

    Is there a reason this bit of logic is included?

    Edit: Oops, forgot to mention this bit. The incorrect values for the Use Poison skill are actually intentional, being tied to an int-bonus to the skill that occurs after chargen. The points not being applied at all, however, is a bug.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Awesome! Okay, that puts ~10 components back on the table!

    So, how do I detect the component that allows skills to be added?

    I've been detecting M__EEex.lua, which was fine in the 'old days', so to speak, but now it is possible for that file to be present without the component. Is there a marker?
  • OlvynChuruOlvynChuru Member Posts: 3,079
    Bubb wrote: »

    BTW @OlvynChuru, while you're here, I noticed that the following line in UI.MENU, (line appears twice), prevents extended skills from being decremented while in initial chargen:
    if chargen.levelingUp and chargen.thief_skill[currentChargenThiefSkill].value > extendedSkills[exIndex].base then
    

    Removing the following portion of that line restores the decrementing functionality:
    chargen.levelingUp and
    

    Is there a reason this bit of logic is included?

    The reason is to prevent an even worse bug. For some reason (and I couldn't figure out why), decrementing an extended skill at character creation did not refund skill points. It would decrease the total amount of points you had available. That was the most I could do to solve this issue.

    I'll see if I can make it work in BG:EE minus SoD.

    @Grammarsalad

    In newer versions of EEex, the code that allows new skills is part of a separate component. Try this:
    REQUIRE_COMPONENT ~EEex.tp2~ ~1~ ~~
    
    MOD_IS_INSTALLED ~EEex.tp2~ ~1~
    
  • Ludwig_IILudwig_II Member Posts: 379
    edited January 2020
    Bubb wrote: »
    Everything is working engine-side, and most games don't have the issue. It appears the old blue-stone BG:EE, (without SoD), is what's causing the issue.

    Hey Bubb, are you sure it's actually related to BGEE without SOD only?
    I cannot for the life of me get extended skills to work. I figured that I was doing something wrong--I'm sure that I was--but it looks like there is even something odd with @OlvynChuru 's Epic Thieving mod. I installed just EEex and epic thieving

    When I just call the ADD_EXTENDED_SKILL function in BGEE version 2.5.16, I can add skill points during character creation. However, when I look at the character sheet, all the points are gone!

    I'm having this exact same problem as Grammarsalad, with Use Poison skill. I just installed the current master branch of EEex(including extended skills option of course) and EpicThieving just to be sure, and I tested it on both BG1 and SOD. I created a new thief character in SOD, assigned 80 points to Use Poison, but when I open character sheet, it only shows the 24 points coming from 16 intelligence my character has. Nothing else. Works the same way in both games for me.
  • fortysevenfortyseven Member Posts: 96
    I know I have asked this before but I don't think it was addressed at the time, which is understandable given how busy things have been for the development of EEex. However, would it be possible to get a spell opcode that can disarm traps, similar to the Knock opcode or unlocking doors? Thanks!
  • GrammarsaladGrammarsalad Member Posts: 2,582
    ALIEN wrote: »
    The EEex is now available from PI. This opens a possibility for modders: define EEex as pre-install requirements. It would be downloaded and installed if the player install want's to install for eg: OlvynChuru Epic Thieving.

    @OlvynChuru @Grammarsalad and others, let me know if you are interested to be able to set EEex as pre-install requirements. We can cook something together.

    I'm totally interested! Lol, its looking like I'm going to be creating tens, maybe hundreds of EEex required components (once I'm done with current commitments).

    ...And, er, I feel dumb, but I don't know what PI is, exactly. I know that you have been doing good work in the compatibility compartment, but I've been in my own world. I'm sure it's something I've seen, but ...
  • ALIENALIEN Member Posts: 1,271
    @Grammarsalad Perfecto :smiley:
    PI is a shortcut for Project Infinity, my mod manager.
  • EndarireEndarire Member Posts: 1,519
    @Bubb
    Request: Add ToEE-style hyperlinked text as an option or/and the ability to display a text box on mouseover, like showing the contents of a post on the Gibberlings3 forum.
  • fearlessfearless Member Posts: 40
    For Windows builds of EE games (currently only x86 versions are shipped) that use the Windows EEex loader, they use the pattern matching technique to locate addresses for functions and variables (from the PDB symbols)

    For Mac OS builds of EE games that use @Crevdaak's Mac OS X EEex loader, there is no need to use the pattern matching technique, as addresses for functions and variables (from the DWARF symbols) can be obtained and referenced directly.

    I think that any Linux OS loader would be more similar to the Mac OS one.

    Currently there is a Lua EEex function called EEex_AddressList that is used to return and array of all the functions and variables that where found via pattern matching in the exe memory (Windows only). Likely the function would be abstracted across loaders and then the EEex framework would call this Lua function early on to get function and global variable addresses.

    There is still a lot of work in progress related to the abstraction of EEex low level functions that would be supported by other loaders and implemented in Lua.

    So that pattern matching database is just for the windows build

  • suysuy Member Posts: 30
    fearless wrote: »
    I think that any Linux OS loader would be more similar to the Mac OS one.

    Thank you. That was indeed my hunch, but I appreciate a lot having a confirmation. I've also found a previous comment where you gave advice on where to start, and you said:
    For Mac and other OS's I think the initial steps to porting this over would be
    to:

    - How to load the EE game and inject or hook certain functions

    Do you have any advice on an easy function to start with?

    I thought some logging function would be useful, like, I would like to have the combat log both in the UI and redirected to a file for easy searching. I don't know which function might that be (searching for "messagebox" seems promising).

    But maybe something even less ambitious, like CChitin::GetVersionString, might be easier?

    Thank you!
  • fearlessfearless Member Posts: 40
    I think @CrevsDaak mentioned using dlsym to obtain the address of symbols. I think @CrevsDaak also initially started with log redirection if I remember correctly, so he might have some suggestions on where to start with that.
  • CrevsDaakCrevsDaak Member Posts: 7,155
    suy wrote: »
    fearless wrote: »
    I think that any Linux OS loader would be more similar to the Mac OS one.

    Thank you. That was indeed my hunch, but I appreciate a lot having a confirmation. I've also found a previous comment where you gave advice on where to start, and you said:
    For Mac and other OS's I think the initial steps to porting this over would be
    to:

    - How to load the EE game and inject or hook certain functions

    Do you have any advice on an easy function to start with?

    I thought some logging function would be useful, like, I would like to have the combat log both in the UI and redirected to a file for easy searching. I don't know which function might that be (searching for "messagebox" seems promising).

    But maybe something even less ambitious, like CChitin::GetVersionString, might be easier?

    Thank you!

    You should look at what the Mac loader is doing since most of it is just patching on specific offsets (determined by looking at the executable on a debugger, lldb in this case but I'm certain gdb can do it too) based off dlsym. There's Mach bits that you'll have to supplant the functionality of with what's available on Linux (use mprotect and do the reading/writing with pointers).

    Other than that, all the advice I can give you is: look at the gdb source. I did that to get an idea of what to do. It's complex, kind of all over the place and sometimes very badly documented but it has a LOT of information and it does pretty much the same you want to do (among other things).

    If you want to use my code and modify it to work on both platforms, I'd say go for it, since it'll make things a lot easier (much more if the game is 64bits on Linux like it is on OSX)

    Also, binaries in Unix-like systems can never be fully stripped (unless you do it purposefully with the intent to obfuscate the binary and prevent anyone from finding out what it's doing, but I don't consider that to be good practice and I doubt anyone writing compilers does), so the Linux executables should have the function names too (C++ ones are mangled, but you can get around that (manually) since the dwarf debugging objects keep both names linked), which enables you to just use dlsym and patch your own function calls instead of the game's, and then to call the game's function so that you don't break anything.

    For logging the combat log you can see it on the EEex_Init.c file; first you patch in the game's call to the function that prints the text, and put in your own instead. On your function all you have to do is to generate a copy of the text and save it or do whatever you want with it, and the call the game's function to print it.

    On patter matching: unless your system doesn't have memory address randomization, this is pretty much impossible. I've been trying to find a way around it but didn't progress a single bit. If we could do this, patching would be trivial since all you would need to patch a function is two calls to dlsym and to overwrite four bytes.
  • GreenerGreener Member Posts: 430
    @Bubb

    As a result of this project and the new features within would it be possible to edit/create kit specific experience tables instead of by class and/or would it we possible to add additional weapon proficiencies upon levelling up?
  • The user and all related content has been deleted.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Greener wrote: »
    As a result of this project and the new features within would it be possible to ... add additional weapon proficiencies upon levelling up?

    I have a function that converts the weapon proficiency system (the limits in profs.2da and weapprof.2da) into a dialogue. It’s fairly portable... not quite ‘drop-in’ ready, because the .tra references are not in their own file using WITH_TRA or whatever. But you can still copy the tra refs manually (the @2000 range, I think) and copy the .tpa file and 2.5 folder. Then the function lets you add two kinds of innate ability. One lets you add extra proficiencies at 1st level, going from 0 stars to 1 star. The other lets you increase any proficiency by one star, while staying within the limits of profsmax.2da.

    I think you could do some of this, maybe all of it, without dialog (using 326)
  • The user and all related content has been deleted.
  • ShinShin Member Posts: 2,344
    Here's two requests for EEx, one of which I believe hasn't been doable in the past:

    1) Is it possible to change the roughly six-second pause between the start of casting and/or item usage beyond the current binary limit? Currently with opcode 188 you can remove the casting pause altogether, but assume you'd e.g. want to be able to cast twice or thrice every round instead.

    2) Is it possible to mimic/expand the old ToBEx functionality of creatures dropping their inventory on frozen death, petrification and imprisonment?
  • OlvynChuruOlvynChuru Member Posts: 3,079
    @Shin Your first request should already be possible without EEex (at least for spells; not for items). You would give each spell two new "when begin casting" effects. One would instantly apply another spell that grants aura cleansing after 3 seconds (or whatever you want the new delay to be). The other effect (which would come first) would remove the aura cleansing spell.

    The patches would be something like this:
    COPY_EXISTING_REGEXP ~.*\.spl~ ~override~
    	LPF ADD_SPELL_CFEFFECT INT_VAR insert_point=0 opcode=321 target=1 timing=1 STR_VAR resource= EVAL ~%aura_cleansing_spell%~ END
    	LPF ADD_SPELL_CFEFFECT INT_VAR insert_point=1 opcode=326 target=1 timing=1 STR_VAR resource= EVAL ~%aura_cleansing_spell%~ END
    
    COPY_EXISTING ~%aura_cleansing_spell%.spl~ ~override~
    	LPF ADD_SPELL_EFFECT INT_VAR opcode=188 target=1 timing=4 duration=new_casting_delay parameter2=1 END
    

    This doesn't cause an infinite loop; opcode 326 doesn't trigger casting effects on the applied spell.

    If you wanted the delay to be shortened only for a specific creature, you could give them a new spell state and have the aura cleansing spell only be applied to creatures with that spell state.
  • The user and all related content has been deleted.
  • ShinShin Member Posts: 2,344
    @OlvynChuru Hm, I see.. that would make for a decent workaround, but also somewhat unwieldy as it would also seemingly require patching of every spell you'd want to include. I was originally after a more straightforward method that could be applied easily to individual items or characters, ideally *like* opcode 188 but with a parameter that governs delay until next cast, e.g. with 0 equaling the current function of 188 and 10 equaling normal casting.
  • The user and all related content has been deleted.
  • ShinShin Member Posts: 2,344
    @subtledoctor Fair enough. I do in no way intend to put any kind of pressure on Bubb or OlvynChuru to deliver updates, certainly not less necessary ones that would require a lot of work. That said, since several features in this thread ended up being created, sometimes very quickly, once someone got around to asking, 'hey, could this be done?', I figure there's no harm in bringing it up.
  • razaraza Member Posts: 24
    Hello guys!

    I am a programmist but I am not very strong with LUA. I want to make a very small modification and asking you to help me a bit with this.

    Currently, I am using EEex from master brunch (not sure what version it is), was need to install it for the spell menu.

    So, everything that I need right now is some function that will display selected NPC (not party member) inventory state, in other words, items that he is holding. By "selected" I mean NPC under the mouse cursor. Probably the game engine already has something like this? Or maybe you have something like this in EEex?
  • repusrepus Member Posts: 5
    edited February 2020
    Good day. Cannot add action SetScriptName? Like in Icewind Dale 2. Or Is it possible to change Override creature data (342) opcode so that changes the ScriptName. Sorry for my English.
    Post edited by repus on
  • ArjukKagrimArjukKagrim Member Posts: 44
    Hello, is EEex compatible with SoD content? It worked fine for me in whole BG1-part of an EET installation (with occasional crashed, about once per hour) but now in SoD it rendered my game unplayable, crashing about every 5 minutes :/
  • BubbBubb Member Posts: 1,005
    As you can all tell, the new semester has started up, and my time is limited. I'll try to stay somewhat active, but I can't promise anything.


    Greener wrote: »
    As a result of this project and the new features within would it be possible to edit/create kit specific experience tables instead of by class and/or would it we possible to add additional weapon proficiencies upon levelling up?

    Unique experience tables might be possible. New proficiencies would be difficult, since they are pretty hardcoded and spread all over the place.


    Shin wrote: »
    1) Is it possible to change the roughly six-second pause between the start of casting and/or item usage beyond the current binary limit? Currently with opcode 188 you can remove the casting pause altogether, but assume you'd e.g. want to be able to cast twice or thrice every round instead.

    Probably? It's just a timer internally, I assume I could change what value it is set to using an opcode + stat combo.
    Shin wrote: »
    2) Is it possible to mimic/expand the old ToBEx functionality of creatures dropping their inventory on frozen death, petrification and imprisonment?

    If it was just preserving the inventory, it's probably doable. What "expansion" to the ToBEx functionality would you want?


    raza wrote: »
    So, everything that I need right now is some function that will display selected NPC (not party member) inventory state, in other words, items that he is holding. By "selected" I mean NPC under the mouse cursor. Probably the game engine already has something like this? Or maybe you have something like this in EEex?

    You could use EEex_GetActorIDCursor() to get the character under the cursor, but direct inventory access hasn't been implemented. Should be a simple function though; what information do you need about the character's inventory, exactly?


    repus wrote: »
    Good day. Cannot add action SetScriptName? Like in Icewind Dale 2. Or Is it possible to change Override creature data (342) opcode so that changes the ScriptName.

    Opcode #342 doesn't appear to touch the creature's scriptname. Though the implementation of the action is easy enough - I'll have it done within a week.


    Hello, is EEex compatible with SoD content? It worked fine for me in whole BG1-part of an EET installation (with occasional crashed, about once per hour) but now in SoD it rendered my game unplayable, crashing about every 5 minutes :/

    EEex shouldn't care what campaign you are in; though, I've never specifically tested SoD with EEex installed. When your game crashed it should have generated some .dmp files, could you please zip those up and upload them here? Also, if you are using any mods other than EET please upload your WeiDU.log.
Sign In or Register to comment.