Jump to content

WRITE_ASCIIing over something long...


Andyr

Recommended Posts

In an effort to become more efficient like Cam and Idobek, I'm making some creatures for a quest using COPY_EXISTING rather than making a new one myself. Here's my code:

 

COPY_EXISTING ~CHEVIL07.CRE~ ~override/X#VIC2PRI.CRE~
SAY NAME1 ~Threlambia~
SAY NAME2 ~Threlambia~
WRITE_LONG 0x14 400                                  //XP value
WRITE_ASCII 0x246 ~PRIET12A~                         //Override script
WRITE_ASCII 0x280 ~X#VIC2PRI~                        //Death Variable
WRITE_ASCII 0x77c ~_CHAN02~
WRITE_ASCII 0x790 ~_SHLD14~

 

Offsets 0x77c and 0x790 are items, though the items the original creature had were longer, so I'm ending up instead with _CHAN021 and _SHLD141... How can I over-write this spillover? :)

Link to comment

I'd like to know the answer, as well. Once upon a time, someone suggested adding a hard return to the .tp2 for each space that was needed, but I can't recall if that fixed the problem I was having at the time or not.

Link to comment

You can use one of the flavors of WRITE_BYTE to "zero" the extra spaces. So you could use:

 

WRITE_ASCII 0x246 ~PRIET12A~                         //Override script
WRITE_ASCII 0x280 ~X#VIC2PRI~                        //Death Variable
WRITE_ASCII 0x77c ~_CHAN02~
WRITE_BYTE 0x783 0
WRITE_ASCII 0x790 ~_SHLD14~
WRITE_BYTE 0x797 0

 

Alternatively, you could always 0 the entire field before using WRITE_ASCII with a pair of WRITE_LONGs. In general,

 

WRITE_LONG offset 0
WRITE_LONG (offset + 0x04) 0
WRITE_ASCII offset ~whatever~

 

This is typically overkill, but will definitely work in all situations. :)

Link to comment

When you WRITE_LONG in this situation you need to use 4 zeros.

WRITE_LONG offset 0000

Otherwise it will act like a WRITE_BYTE and only clear the first byte. WRITE_BYTE needs 1 zero and WRITE_SHORT needs 2.

 

EDIT: The above is apparently wrong. I tend to use hex values and thought the same principles applied. The following is how hex values should be written:

WRITE_BYTE offset 0x00
WRITE_SHORT offset 0x0000
WRITE_LONG offset 0x00000000

Link to comment

Archived

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

×
×
  • Create New...