Jump to content

Modifying Cre Spell Offsets and Counts in Weidu


Bill Bisco

Recommended Posts

How do you modify Cre Spell Offsets and Counts in Weidu?

 

I filled out the below for Weidu code based directly from the Vaues that Near Infinity gave me. Is there anything else that I need to do to get the proper spells Known and Memorized working when this CRE is viewed ingame?

 

WRITE_LONG 0x02a0 ~2d4 h~ // Known spells offset 4 (dword)
WRITE_LONG 0x02a4 19 // Known spells count 4 (dword)
WRITE_LONG 0x02a8 ~3b8 h~ // Spell memorization info offset 4 (dword)
WRITE_LONG 0x02ac 17 // Spell memorization info entries count 4 (dword)
WRITE_LONG 0x02b0 ~4c8 h~ // Memorized spells offset 4 (dword)
WRITE_LONG 0x02b4 9 // Memorized spells count 4 (dword)
EDIT:
I can't copy directly from NearInfinity. What do I need to do to get the above offsets working?
qIce3u.png
Thanks,
Bill
Link to comment

It's not working because 2f4 h represents the hex value 2f4. In WeiDU, you represent hex numbers with the 0x prefix, not the h suffix, so you would want 0x2f4 instead.

 

However, I'm not sure why you need to set any of these values. If you are copying a file that already has those values, nothing will change. And if you're copying a file that doesn't have those values, you're probably going to corrupt it if you aren't inserting/deleting bytes to match the changes.

Link to comment

Mike1072, Thank you very much for your reply. The original IWD Erevain is a Fighter and my mod will make him a Fighter/Mage/Thief by default. Later on, I'll add support to allow him to alternatively be a Fighter/Mage, Mage/Thief, Mage, Thief, and even his original Fighter class.

 

As such, I'll have to manage a lot of complexity. I would rather manage this via Weidu Code and the mod files only have with 1 CRE file rather than requiring the mod to have several CRE files pre-stored.

 

I will modify the code as you have suggested and try it out. I am only giving Erevain default BG2 spells. Is there anything else I need to be wary of?

 

Thanks,

 

Bill

Link to comment

Alright, I'm getting some errors. Help would be appreciated.

 

This link clearly says that 10 stands for Fighter/Mage/Thief

 

In my TP2 file here , I clearly write this in the code

 

WRITE_BYTE 0x0273 10 // Class (CLASS.IDS) 1 (byte)

 

The final file does not take my change:

 

sJiFBx.png

 

It takes all of the other Numbers I modified: Proficiencies, Str, Dex, Con, Int, Wis, Cha, etc.

 

 

None of the Spells Known and Memorization Info was copied correctly.

 

It should be

 

iSoFbV.png

 

but it ended up as:

 

LzpqwP.png

 

 

Any help would be very welcome,

 

Bill

Link to comment

Alright, I'm getting some errors. Help would be appreciated.

 

This link clearly says that 10 stands for Fighter/Mage/Thief

 

In my TP2 file here , I clearly write this in the code

 

WRITE_BYTE 0x0273 10 // Class (CLASS.IDS) 1 (byte)

 

The final file does not take my change:

 

sJiFBx.png

 

It takes all of the other Numbers I modified: Proficiencies, Str, Dex, Con, Int, Wis, Cha, etc.

 

 

None of the Spells Known and Memorization Info was copied correctly.

 

It should be

 

iSoFbV.png

 

but it ended up as:

 

LzpqwP.png

 

 

Any help would be very welcome,

 

Bill

WRITE_BYTE 0x0273 10

Link to comment

Are you trying to add spells to the .CRE? There are better ways:

COPY_EXISTING ~creature.cre~ ~override~
  ADD_KNOWN_SPELL ~spwi101~ #0 ~wizard~ // adds Grease to spellbook
  ADD_MEMORIZED_SPELL ~spwi101~ #0 ~wizard~ ( 2 ) // CRE now has 2 instances of Grease memorized
BUT_ONLY

The "#0" is important. It tells what spell level to add the spell at, with 0 being level 1 and 8 being level 9. If that differs from the spell's actual level then the spell will be non-functional.

Link to comment

The erevain.cre file you are copying over is a CRE V9.0 (IWD) file, not a CRE V1.0 (BG/BG2), so you weren't writing to the right offsets.

 

1) You should re-create Erevain in BG2 as a player character, then follow the steps to convert him to an NPC. Then you will have him as a CRE V1.0 file.

2) You should not be adjusting spell offsets or counts manually. If you need to change spells, use the WeiDU commands that will insert/delete the data and update the offsets and counts.

3) Unless you are planning on offering lots of customization for the player during installation, it would probably be a lot easier to create the X number of different versions of Erevain and then install whichever one the player chooses.

Link to comment

Thank you all, sincerely for the replies. I used subtledoctor's coding suggestion and that worked great. I changed CRE formats per Mike1072 and that worked.

 

There are apparently some minor color differences between the CRE file versions.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...