subtledoctor Posted January 17, 2020 Author Posted January 17, 2020 (edited) Cool. Unfortunately more stuff is hard-coded here than I had hoped. Apparently the identify-by-item in the inventory screen is linked to the RES of the item - it only seems to work with MISC3P.itm and SCRL75.itm. I don't want to mess with the Glasses of Identification, so it looks like it will be necessary to: copy the custom Identify spell in as something other than SPWI75.spl scrub all instances of SPWI75.spl and replace it with the new one (I think this just means NPC memorization lists and adding it to HIDESPL) have SCRL75.itm point to the new spell duplicate SCRL75.itm to another filename, like IDENT.itm copy the custom glyph parchment thingy in as SCRL75.itm, overwriting the original scrub all existing instances of SCRL75.itm and replace with the new one (I think this means NPC inventories, stores, and random loot lists...?) It's that last one that gives me pause. Modding that stuff is not really in my wheelhouse... Edited January 17, 2020 by subtledoctor Quote
kjeron Posted January 17, 2020 Posted January 17, 2020 Item-RES's for identification are listed in "ITEMSPEC.2DA", you can add others. Quote
subtledoctor Posted January 17, 2020 Author Posted January 17, 2020 1 hour ago, kjeron said: Item-RES's for identification are listed in "ITEMSPEC.2DA", you can add others. IIIINteresting. That should make this a lot easier. Quote
jastey Posted January 18, 2020 Posted January 18, 2020 14 hours ago, kjeron said: Item-RES's for identification are listed in "ITEMSPEC.2DA", you can add others. Would this be a solution for Finch's glasses for a BGT/EET game? (Sorry to keep on about this, I don't even know whether it is really a problem any more, but the last thing I read about it it was.) Quote
subtledoctor Posted January 18, 2020 Author Posted January 18, 2020 6 hours ago, jastey said: Would this be a solution for Finch's glasses for a BGT/EET game? (Sorry to keep on about this, I don't even know whether it is really a problem any more, but the last thing I read about it it was.) Itemspec.2da is EE only. (That’s okay for my purposes because all the affected kits are also EE-only.) Quote
Bubb Posted January 18, 2020 Posted January 18, 2020 (edited) What about a fully UI implementation? I found out it's possible to hijack the contingency opcode & menu to open whatever interface you want on spell completion. Additionally, the function the engine uses to identify a spell, Infinity_OnSpellIdentify, doesn't actually care if SPWI110 is memorized - it'll decrement the memorization count if it is, but it still functions if not. Check out this mockup, made in vanilla BG2:EE, (no EEex here): Spoiler identify.mp4 That interface instantly runs the lore check on every slot in the casters inventory, (instantly identifying spells that can already be identified), and allows you to identify an item by left clicking on its slot. It also supports variable identification uses, if you want a spell that can identify more than one item at a time. Edited January 18, 2020 by Bubb Quote
subtledoctor Posted January 18, 2020 Author Posted January 18, 2020 (edited) Uuh... that is very cool... Can it be weiduized? Edited January 19, 2020 by subtledoctor Quote
Bubb Posted January 20, 2020 Posted January 20, 2020 (edited) I'm by no means good at WeiDU, but here's a tph that I've thrown together that installs all the necessary code: B3Identify.tph B3_IDENTIFY_INSTALL performs the necessary UI patches - make sure to run this before subsequent tasks. A new identify spell that uses the menu has to be registered using a Lua function: B3Identify_RegisterResref("<resref no extension>", <use count>) You can use WeiDU to register spells by appending lines to a M_*.lua file, or you can use B3_IDENTIFY_REGISTER to throw the same definitions into the interface's main file, like so: LAF B3_IDENTIFY_REGISTER INT_VAR uses = 4 STR_VAR resref = ~B3IDEN~ END Once the spell is registered, any Opcode #234 originating from the resref will trigger the interface. Note that the Opcode has to originate from a *spell*, however, you can use the mechanism from an item by first passing it through an Opcode #326. (if you attempt to directly call from an item, the engine crashes) This is the small test tp2 I was using to install, as an example: INCLUDE ~bubb_test/B3Identify.tph~ LAF B3_IDENTIFY_INSTALL END COPY ~bubb_test\copy\B3IDEN.SPL~ ~override~ SAY 0x8 ~Bubb Test Identify~ BUT_ONLY LAF B3_IDENTIFY_REGISTER INT_VAR uses = 4 STR_VAR resref = ~B3IDEN~ END Edit: The above should work for vanilla BG:EE, BG2:EE, and IWD:EE. UI Overhauls will probably break the pattern matching. Edited January 20, 2020 by Bubb Quote
jastey Posted January 20, 2020 Posted January 20, 2020 Bubb wielding IE magic again! I didn't understand 80% of your post. Quote
subtledoctor Posted January 20, 2020 Author Posted January 20, 2020 Witchcraft! That's my attitude about much of this new UI stuff. When I can make use of it, thought, it's amazing. (Which, I guess, is also how I would feel about actual witchcraft.) 14 hours ago, Bubb said: You can use WeiDU to register spells by appending lines to a M_*.lua file, or you can use B3_IDENTIFY_REGISTER to throw the same definitions into the interface's main file, like so: LAF B3_IDENTIFY_REGISTER INT_VAR uses = 4 STR_VAR resref = ~B3IDEN~ END Would it not be safer/more compatible/something if the B3_Identify_Register function itself used an M_*.lua file, instead of writing to the main UI? Or would it not make a difference? Quote
Bubb Posted January 20, 2020 Posted January 20, 2020 4 hours ago, subtledoctor said: Would it not be safer/more compatible/something if the B3_Identify_Register function itself used an M_*.lua file, instead of writing to the main UI? Or would it not make a difference? It writes out to M_B3IDEN.lua, which is the main file I use to hold the menu's functions, (my wording was bad here). Using your own M_*.lua when applicable is always preferable - keeps things organized and is a bit better with uninstalls, (nothing major, though). As for the original talk of UI.MENU, it's best to not touch the file unless you absolutely have to. Quote
Grammarsalad Posted January 22, 2020 Posted January 22, 2020 (edited) On 1/19/2020 at 8:29 PM, Bubb said: I'm by no means good at WeiDU, but here's a tph that I've thrown together that installs all the necessary code: B3Identify.tph 15.77 kB · 5 downloads B3_IDENTIFY_INSTALL performs the necessary UI patches - make sure to run this before subsequent tasks. A new identify spell that uses the menu has to be registered using a Lua function: B3Identify_RegisterResref("<resref no extension>", <use count>) You can use WeiDU to register spells by appending lines to a M_*.lua file, or you can use B3_IDENTIFY_REGISTER to throw the same definitions into the interface's main file, like so: LAF B3_IDENTIFY_REGISTER INT_VAR uses = 4 STR_VAR resref = ~B3IDEN~ END Once the spell is registered, any Opcode #234 originating from the resref will trigger the interface. Note that the Opcode has to originate from a *spell*, however, you can use the mechanism from an item by first passing it through an Opcode #326. (if you attempt to directly call from an item, the engine crashes) This is the small test tp2 I was using to install, as an example: INCLUDE ~bubb_test/B3Identify.tph~ LAF B3_IDENTIFY_INSTALL END COPY ~bubb_test\copy\B3IDEN.SPL~ ~override~ SAY 0x8 ~Bubb Test Identify~ BUT_ONLY LAF B3_IDENTIFY_REGISTER INT_VAR uses = 4 STR_VAR resref = ~B3IDEN~ END Edit: The above should work for vanilla BG:EE, BG2:EE, and IWD:EE. UI Overhauls will probably break the pattern matching. Oh, this is sooo awesome! I just made a priest version of Identify. No big deal. @Bubb Quote Edit: The above should work for vanilla BG:EE, BG2:EE, and IWD:EE. UI Overhauls will probably break the pattern matching. What about EET? So, when you talk about this 'pattern matching'. What sort of thing should we look for? Edit: Please feel free to talk to me like I'm five... in fact, I'd prefer it! Edit2: Quote I found out it's possible to hijack the contingency opcode & menu to open whatever interface you want on spell completion This sounds REALLY intriguing.... Like, could it open the HLA menu? Edited January 22, 2020 by Grammarsalad Quote
subtledoctor Posted January 22, 2020 Author Posted January 22, 2020 14 hours ago, Grammarsalad said: Oh, this is sooo awesome! I just made a priest version of Identify. No big deal. Pretty sure FnP v0.79 already has a priest version of Identify. But yeah, this is still quite cool. I think it's better than the vanilla version because 1) it involves actually casting a spell, which matches how every other spell in existence works; and 2) the vanilla version is limited to wizard and priest spells, this one can be innate as well, or used from items - triggered any way that a spell can be cast, because, see 1). 14 hours ago, Grammarsalad said: So, when you talk about this 'pattern matching'. What sort of thing should we look for? Glancing at the code, it uses REPLACE_TEXTUALLY and/with a custom "REPLACE_MULTILINE" text replacement function, to make edits to UI.menu. If the player has installed mods that alter the relevant portion of UI.menu before installing this spell, then the REPLACE_ might fail during installation. If a player installs mods that alter or overwrite the relevant portion of UI.menu after installing this spell, then the spell itself might fail in-game. Hard to control for that circumstance... 14 hours ago, Grammarsalad said: This sounds REALLY intriguing.... Like, could it open the HLA menu? That is a VERY good question! Quote
Lauriel Posted January 23, 2020 Posted January 23, 2020 This is one of the coolest things I've ever seen. "It's a thing of beauty, boss!" (sorry, couldn't resist the Buffy reference - yes, I'm a nerd) I wish I knew what to do with that TPH file but I'm such a newb at this, even that throws me. So I'm with @Grammarsalad, please talk to me as if I were 5, please. Maybe make that 3.... Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.