Jump to content

Code for patching a spell


Kish

Recommended Posts

If I want to change an existing spell so that its damage goes from 1 die to 2 dice--that is, I want:

# dice / Max level: 1

to become

# dice / Max level: 2

What code would I use? Presumably WRITE_BYTE, but write what to what?

Link to comment

Is this a spell or all the possible spells ?

If you are interested in actual useful code... :p subtledoctor... you would, yeah, but HOW ?

The usual suspects of damage spells use the do damage opcode 12 to do business usually twice per effect, so they can be easily isolated, but after that, it can get tricky...

BEGIN ~Allow elemental spells pierce magic resistance~ DESIGNATED 6

//Making all elemental damage spells immune to magical resistance
//Damage types of non-magical Acid, Cold, Electricity, Fire and Poison
//opcode #12
//damage (type)=

//65536 Acid
//65537 Acid Set to Value
//65538 Acid Set to Percentage
//65539 Acid Reduce by Percentage
//131072 Cold
//131073 Cold Set to Value
//131074 Cold Set to Percentage
//131075 Cold Reduce by Percentage
//262144 Electricity
//262145 Electricity Set to Value
//262146 Electricity Set to Percentage
//262147 Electricity Reduce by Percentage
//524288 Fire
//524289 Fire Set to Value
//524290 Fire Set to Percentage
//524291 Fire Reduce by Percentage
//2097152 Poison
//2097153 Poison Set to Value
//2097154 Poison Set to Percentage
//2097155 Poison Reduce by Percentage 

COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~
READ_LONG 0x64 ~ab_off~
READ_SHORT 0x68 ~ab_num~
READ_LONG 0x6a ~ef_off~
	FOR (i=0;i<ab_num;i+=1) BEGIN
	READ_SHORT (ab_off+i*0x28 + 0x000c) ~type~
	PATCH_IF ~type~=1 OR ~type~=4 THEN BEGIN
		READ_SHORT (ab_off+i*0x28+0x00) ~opcode~
		READ_SHORT (ab_off+i*0x28+0x08) ~damage~
		PATCH_IF ~opcode=12~ THEN BEGIN
			READ_SHORT (ab_off+i*0x28+0x1e) ~ef_num~
			READ_SHORT (ab_off+i*0x28+0x20) ~ef_ind~
			PATCH_IF ~damage~=65536 OR ~damage~=65537 OR ~damage~=65538 OR ~damage~=65539 OR ~damage~=131072 OR ~damage~=131073 OR ~damage~=131074 OR ~damage~=131075 OR ~damage~=262144 OR ~damage~=262145 OR ~damage~=262146 OR ~damage~=262147 OR ~damage~=524288 OR ~damage~=524289 OR ~damage~=524290 OR ~damage~=524291 OR ~damage~=2097152 OR ~damage~=2097153 OR ~damage~=2097154 OR ~damage~=2097156 THEN BEGIN
				FOR (k=0;k<ef_num;k+=1) BEGIN
//				WRITE_BYTE  (ef_off+(k+ef_ind)*0x30 + 0x000d) 2 // this removes the magic resistance from 'non magical' attacks, which is why the code is here... you need to make your own patching
				END
			END
		END
	END
END
READ_SHORT (ab_off+i*0x28+0x04) ~dice~

WRITE_SHORT (ab_off+i*0x28+0x04) ~dice*2~ //will double the max dice, so a 1d6 becomes 1d12, but that's probably not what you seeks for...

Link to comment

One spell--Storm of Vengeance, to be specific, I just noticed that it seems really dismal when by the time you can cast it you can do 19d4 damage with Holy Smite. I'd want to go from 1d6 to 2d6, rather than 1d12.

Link to comment

I haven't dealt with the poison damage...

 

One spell--Storm of Vengeance, to be specific...

K...

COPY_EXISTING ~spdm711.spl~ ~override~
WRITE_SHORT 0xb6 ~2~
WRITE_SHORT 0xe6 ~2~
WRITE_SHORT 0x116 ~2~
WRITE_SHORT 0x146 ~2~
WRITE_SHORT 0x176 ~2~
WRITE_SHORT 0x1a6 ~2~
WRITE_SHORT 0x1d6 ~2~
WRITE_SHORT 0x206 ~2~
WRITE_SHORT 0x236 ~2~
WRITE_SHORT 0x266 ~2~
WRITE_SHORT 0x296 ~2~
WRITE_SHORT 0x2c6 ~2~
//the spell has a few other effects
WRITE_SHORT 0x326 ~2~
WRITE_SHORT 0x356 ~2~
WRITE_SHORT 0x386 ~2~
WRITE_SHORT 0x3b6 ~2~
WRITE_SHORT 0x3e6 ~2~
WRITE_SHORT 0x416 ~2~
WRITE_SHORT 0x446 ~2~
WRITE_SHORT 0x476 ~2~
WRITE_SHORT 0x4a6 ~2~ 
PS, the spell is actually a 1d3 + something with 3 elements, in 3 turns/rounds(0 seconds, 6 seconds and 12 seconds) and poison damage that's damage per second.

 

EDIT: So maybe this would result to actually better result, as we double the dice ... don't know.

COPY_EXISTING ~spdm711.spl~ ~override~
READ_LONG 0x64 ~ab_off~
READ_SHORT 0x68 ~ab_num~
READ_LONG 0x6a ~ef_off~
    FOR (i=0;i<ab_num;i+=1) BEGIN
    READ_SHORT (ab_off+i*0x28 + 0x000c) ~type~
    PATCH_IF ~type~=4 THEN BEGIN
        READ_SHORT (ab_off+i*0x28+0x00) ~opcode~
        READ_SHORT (ab_off+i*0x28+0x08) ~damage~
        PATCH_IF ~opcode=12~ THEN BEGIN
            READ_SHORT (ab_off+i*0x28+0x1e) ~ef_num~
            READ_SHORT (ab_off+i*0x28+0x20) ~ef_ind~
            PATCH_IF (damage=~65536~ OR damage=~262144~ OR ~damage~=524288 ) THEN BEGIN
                FOR (k=0;k<ef_num;k+=1) BEGIN
                  READ_SHORT (ab_off+i*0x28+0x04) ~dice~
                  WRITE_SHORT (ab_off+i*0x28+0x04) ~dice*2~
                END
            END
        END
    END
END
Link to comment

I had to edit the post above... as the spell is a little complicated. And I don't know which of the solutions is better... and you then also need to deal with the poison damage, like said, if you really wish to ...

Link to comment

Archived

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

×
×
  • Create New...