Jump to content

Hotkeys for IWD Spells in BGEE


Recommended Posts

If you know the spells you want to add to the list, you can do it manually.

1) Open up BGEE.LUA in Near Infinity and search for "keybindings =".

2) You should see a whole bunch of hotkey definitions. Scroll down until you see definitions containing "SPPR" or "SPWI", (based on if your spell is priest / mage).

3) Copy a line from the relevant category, and paste it at the top of that category's definition block. Your line should be something like this, (with the brackets being placeholders):

{ <id>, 6,  "<resref>",					<name_strref>,	"",		0,	0},

(the '6' in the above example is the hotkey type; 5 for priest spells, 6 for wizard spells)

4) Change the placeholders according to your spell:

  • <id> should be a number unique from the rest of the definitions. The unused id range for each game is currently:
    • BG:EE => 68-188
    • BG2:EE => 68-180
    • IWD:EE => 68-141
  • <resref> should be the spell's resref.
  • <name_strref> should be the spell-name's strref, located at +0x8 in the .SPL. And yes, this field is required for the hotkey to work.

 

After doing all that, the spell should appear in the game's hotkey list. It's definitely not convenient, but it does the trick if you are so inclined.

Link to comment
On 10/22/2019 at 7:37 PM, Bubb said:

 

  • <id> should be a number unique from the rest of the definitions. The unused id range for each game is currently:
    • BG:EE => 68-188
    • BG2:EE => 68-180
    • IWD:EE => 68-141
  • <resref> should be the spell's resref.
  • <name_strref> should be the spell-name's strref, located at +0x8 in the .SPL. And yes, this field is required for the hotkey to work.

You mention <id> in the file..

When doing all of this, I can get the .spl for the spell, and the Strref through the game by turning StrrefOn() ... (wasn't sure what you meant by finding it in the +0x8 area)
However.. the <id> part I don't get what you mean? 

In an EET install for example.. the range for it goes from 181-308 for priest spells, and 309-500 for mage spells. 
i.e.
{ 499, 6, 'SPWI918',                    63153,    '',        0,    0 }, 
{ 500, 6, 'SPWI919',                    63157,    '',        0,    0 }

If I try to add 501, with the proper class (5 for priest, 6 for mage), proper spell id, and proper strref, like...

{ 499, 6, 'SPWI918',                    63153,    '',        0,    0 }, 
{ 500, 6, 'SPWI919',                    63157,    '',        0,    0 },
{ 501, 6, 'random spell',               strref,    '',        0,    0 }

It won't accept '501' as a proper "id" ... now.. if I do this:

{ 499, 6, 'SPWI918',                    63153,    '',        0,    0 }, 
// { 500, 6, 'SPWI919',                    63157,    '',        0,    0 },
{ 500, 6, 'random spell',               strref,    '',        0,    0 }

This works.. but it obviously isn't a fix, as I lose the keybinding to that other spell.. of course non-used spells can be used, but that isn't an overall fix.

So could you explain on what exactly a spell 'id' is and how you can add new ones please?

Link to comment
53 minutes ago, Guest anon said:

When doing all of this, I can get the .spl for the spell, and the Strref through the game by turning StrrefOn() ... (wasn't sure what you meant by finding it in the +0x8 area)

I meant opening the spell's resref in a program like Near Infinity, and finding the name strref by looking at offset +0x8 from the start of the file, (that's where it is stored). The way you're doing it is easier, so that's all good.

53 minutes ago, Guest anon said:

So could you explain on what exactly a spell 'id' is and how you can add new ones please?

In the context of these hotkeys, a spell 'id' is the first number in the hotkey definition. The engine stores these definitions internally using an array of 500 allocated indices, with the spell 'id' being the position where the definition is stored.

The reason why <id> = 501 doesn't work is because it exceeds the valid maximum, (500). This is a hardcoded cap, you cannot expand the number of hotkeys the engine will keep track of. When adding a new hotkey you need to use an id, between 1-500, that isn't already used. It appears the unused range in EET is 68-180, so use a number in that range for your new hotkey. Note that even though the different hotkey types are defined with sequential id values, this isn't required. Using <id> = 68 for the spell in your example would work just fine.

Edited by Bubb
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...