phordicus Posted January 19, 2011 Share Posted January 19, 2011 i want to change all cleric/druid spells to a casting time of 1. it's modifying the correct spells but is adding NI-crashing stuff instead of just changing the casting time. COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN READ_SHORT 0x1C caster // spell type PATCH_IF (caster = 2) BEGIN READ_LONG 0x64 aboff // abilities offset READ_SHORT 0x68 abnum // number of abilities FOR (i=0; i < abnum; i=i+1) BEGIN // loop through abilities READ_BYTE (aboff + (i * 0x12)) time // read casting time PATCH_IF (time > 1) BEGIN // patch if > 1 WRITE_LONG (aboff + (i * 0x12)) 1 // write to what we just read END END END END BUT_ONLY_IF_IT_CHANGES is there a more up-to-date tut than this? Link to comment
DavidW Posted January 19, 2011 Share Posted January 19, 2011 Your maths has gone a bit wrong. aboff + (i * 0x12) should read aboff + (i * 0x28) + 0x12 Link to comment
phordicus Posted January 19, 2011 Author Share Posted January 19, 2011 [PHORD/SETUP-PHORD.TP2] PARSE ERROR at line 284 column 1-5 Near Text: aboff GLR parse error [PHORD/SETUP-PHORD.TP2] ERROR at line 284 column 1-5 Near Text: aboff Parsing.Parse_error where's the 0x28 coming from? edit: fixed the parse by changing the loop read_long to read_byte. the whole thing works now. thanks! still wondering where/what that 0x28 is. Link to comment
Jarno Mikkola Posted January 19, 2011 Share Posted January 19, 2011 where's the 0x28 coming from? It's from the file format... each of the extended headers count as 0x28 bits. So the thing is: PATCH_IF (SOURCE_SIZE > 0x71) BEGIN READ_SHORT 0x1C caster // spell type PATCH_IF (caster = 2) BEGIN READ_LONG 0x64 aboff // abilities offset READ_SHORT 0x68 abnum // number of abilities FOR (i=0; i < abnum; i=i+1) BEGIN // loop through abilities READ_BYTE (aboff + (i * 0x28) + 0x12) time // read casting time PATCH_IF (time > 1) BEGIN // patch if > 1 WRITE_LONG (aboff + (i * 0x28) + 0x12)) 1 // write to what we just read END END END END BUT_ONLY_IF_IT_CHANGES Link to comment
phordicus Posted January 19, 2011 Author Share Posted January 19, 2011 where's the 0x28 coming from? It's from the file format... each of the extended headers count as 28 bits. ah right. 0 to 26 therefore each header is 28 in size so skip 28 per loop. Link to comment
Jarno Mikkola Posted January 19, 2011 Share Posted January 19, 2011 ah right. 0x0 to 0x26 therefore each header is 0x28 in size so skip 0x28 per loop. Yep, except I corrected my mistake, now. Link to comment
phordicus Posted January 20, 2011 Author Share Posted January 20, 2011 you post too fast and edit while i respond! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.