Jump to content

.cre modification question


erebusant

Recommended Posts

While modifying a .cre to change the Thac0 I'm typically just using WRITE_BYTE and the integer that corresponds with the Thac0 level I desire.

How do I write the integer to reflect a negative Thac0 (ie;-2) or something like that? I keep getting the WeiDU error that it can't convert the integer.

Thanks in advance.

Link to comment

WRITE_BYTE 0x52 ~-2~ doesn't work?

 

According to the IESDP, the valid values for THAC0 are 1-25 and it's a byte, not a signed byte. I'm pretty sure zero is also valid too though.

 

Obviously, the engine can handle negative values here, or at least interpret them as such with modifiers and what not. So if nothing else works, you can give your CRE a THAC0 of zero and add a THAC0 modifier effect to lower it further.

 

I guess you could also try writing a value of 129 254, which I think for an unsigned byte, should be equivalent to -2. Though math isn't my strong point.

 

Edit: Out of curiosity, I did some exploratory coding and found out that both ~-2~ and 254 will write to the byte as -2. Hmm... I wonder if it would make a difference if I used the unsigned value for my failed PnP THAC0 table...

Link to comment
WRITE_BYTE 0x52 ~-2~ doesn't work?

 

According to the IESDP, the valid values for THAC0 are 1-25 and it's a byte, not a signed byte. I'm pretty sure zero is also valid too though.

 

Obviously, the engine can handle negative values here, or at least interpret them as such with modifiers and what not. So if nothing else works, you can give your CRE a THAC0 of zero and add a THAC0 modifier effect to lower it further.

 

I guess you could also try writing a value of 129 254, which I think for an unsigned byte, should be equivalent to -2. Though math isn't my strong point.

 

Edit: Out of curiosity, I did some exploratory coding and found out that both ~-2~ and 254 will write to the byte as -2. Hmm... I wonder if it would make a difference if I used the unsigned value for my failed PnP THAC0 table...

Putting the ~ on both sides of the -2 did the trick. Another funky thing I ran across was when assigning an item to a quick slot. For Quick Item 1 it went just fine using a WRITE_BYTE command for the appropriate offset, but for any other Quick Item slot when I used WRITE_BYTE it wrote it as a negative integer like -255 and I was forced to use WRITE_SHORT for Quick Item 2 & 3 slots to get the correct item # assigned to the correct Quick Slot.

 

One last question - When using ADD_CRE_ITEM, what is the abreviation used for the Quick Slots? When the designation of placement is wrong it defaults to INV15 for placement, but I'd really like to place a new item where I want it to go when I add it to the .cre file.

Link to comment
For Quick Item 1 it went just fine using a WRITE_BYTE command for the appropriate offset, but for any other Quick Item slot when I used WRITE_BYTE it wrote it as a negative integer like -255 and I was forced to use WRITE_SHORT for Quick Item 2 & 3 slots to get the correct item # assigned to the correct Quick Slot.
Item slots are SHORT (two-byte) values, so you probably just got lucky on using the WRITE_BYTE for the first one. It's easier to use ADD|REPLACE_CRE_ITEM where you can, anyway.
One last question - When using ADD_CRE_ITEM, what is the abreviation used for the Quick Slots?
QITEM1...QITEM3, though you can even just use QITEM as a shortcut (see here).
Link to comment

In general you shouldn't assume that the program will understand what you mean by a negative number.

 

If it's easier to remember, you can write the "negative" numbers with BNOT

 

BNOT 0 = 0xff = 255 = -1 (if it's a byte)

BNOT 1 = 0xfe = 254 = -2

(` 2) = 0xfd = 253 = -3

 

and so forth.

Link to comment

Archived

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

×
×
  • Create New...