Jump to content

Changing Mage Type


Recommended Posts

I've been inspired to create a tweak to make him a generalist mage, thanks to Kulyok's Xan mods. :D

 

What I currently have:

COPY_EXISTING_REGEXP GLOB ~^_?xan[0-9]*.*\.cre$~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
WRITE_BYTE 0x246 16384 // change mage type to generalist mage
 END
 BUT_ONLY_IF_IT_CHANGES

What I get:

Installing [Make Xan a Generalist Mage (grogerson)]

...

Copying 1 file ...

[./override/sw1h01.itm] loaded, 314 bytes

Copied [sw1h01.itm] to [override/cdb04090.g3]

Copying and patching 3 files ...

[./override/XAN.CRE] loaded, 1100 bytes

ERROR: [XAN.CRE] -> [override/XAN.CRE] Patching Failed (COPY) (Invalid_argument("Char.chr"))

Stopping installation because of error.

 

ERROR Installing [Make Xan a Generalist Mage (grogerson)], rolling back to previous state...

Any guidance would be appreciated.

Link to comment

What DavidW said, plus maybe this, too:

 

COPY_EXISTING ~xan.cre~  ~override~
		  ~xan4.cre~ ~override~
		  ~xan6.cre~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
WRITE_SHORT 0x246 16384 // change mage type to generalist mage

// fix spell memorisation info
READ_BYTE 0x234 level
READ_LONG 0x2a8 mem_info_off
READ_LONG 0x2ac num_mem_info
FOR (i = 0; i < num_mem_info; i += 1) BEGIN
  READ_SHORT (mem_info_off + 0x10*i) spell_level
  READ_SHORT (mem_info_off + 0x10*i + 0x06) spell_type
  PATCH_IF (level == 2) BEGIN // xan.cre
	PATCH_IF (spell_type == 1 && spell_level == 0) BEGIN // wizard, level 1 spells
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x02) 2
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x04) 2
	END
  END ELSE
  PATCH_IF (level == 4) BEGIN // xan4.cre
	PATCH_IF (spell_type == 1 && spell_level == 0) BEGIN // wizard, level 1 spells
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x02) 3
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x04) 3
	END ELSE
	PATCH_IF (spell_type == 1 && spell_level == 1) BEGIN // wizard, level 2 spells
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x02) 2
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x04) 2
	END
  END ELSE
  PATCH_IF (level == 6) BEGIN // xan6.cre
	PATCH_IF (spell_type == 1 && spell_level == 0) BEGIN // wizard, level 1 spells
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x02) 4
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x04) 4
	END ELSE
	PATCH_IF (spell_type == 1 && spell_level == 1) BEGIN // wizard, level 2 spells
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x02) 2
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x04) 2
	END ELSE
	PATCH_IF (spell_type == 1 && spell_level == 2) BEGIN // wizard, level 3 spells
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x02) 2
	  WRITE_SHORT (mem_info_off + 0x10*i + 0x04) 2
	END
  END
END
 END
 BUT_ONLY_IF_IT_CHANGES

 

The only real difference is WRITE_BYTE -> WRITE_SHORT, and adjustments for the number of spells memorisable when he joins the party (it would auto-fix on level-up, but this will make sure he has the right number from when he joins to his first level-up).

 

(While I was doing this, I noticed that default XAN.CRE does not receive the +1 memorisable spells/level that he should - at level 2, he has 2 level 1 spells, instead of 3 level 1 spells, for being a specialist. It looks like Dudleyfix takes care of this.)

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...