Jump to content

why isn't this working?


phordicus

Recommended Posts

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. :thumbsup:

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
[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
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

Archived

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

×
×
  • Create New...