Jump to content

ALTER_EFFECT question


subtledoctor

Recommended Posts

(man I wish Camdawg was around, but maybe someone else can answer this)

 

I'm trying to make a mod that can arbitrarily change the saving throw required by any given spell. I'm using ALTER_EFFECT for this, like so:

 

 

COPY_EXISTING ~spwixxx.spl~ ~override~
                LPF ALTER_EFFECT INT_VAR match_savingthrow = 1 savingthrow = 0 END
                LPF ALTER_EFFECT INT_VAR match_savingthrow = 2 savingthrow = 0 END
                LPF ALTER_EFFECT INT_VAR match_savingthrow = 3 savingthrow = 0 END
                LPF ALTER_EFFECT INT_VAR match_savingthrow = 4 savingthrow = 0 END
                BUT_ONLY

 

When I look at spells in NI, under the "save type" field, 0 is save v. spells, 1 is breath, 2 is death, 3 is wands, and 4 is polymorph. So that code should make the copied spell switch to a save vs. spells, regardless of what it is originally.

 

But, instead it's giving the spell a save vs. death (2). Why is that? What value is ALTER_EFFECT looking for in match_savingthrow?

 

IESDP says the offset is 4 bytes (dword). Can someone remind me what kind of value that wants?

 

Thanks y'all.

Link to comment

Does this function work if you use a different number than "savingthrow = 0"(aka vs. magic) ? I have a theory that's probably incorrect, but...

To answer the original question:
1 byte uses READ/WRITE_BYTE
2 bytes (word) uses READ/WRITE_SHORT
4 bytes (dword) uses READ/WRITE_LONG
8 bytes (resref) uses READ/WRITE_ASCII

ERHM !

 

LPF ALTER_EFFECT INT_VAR match_savingthrow = 1 savingthrow = 0 END

I would use this instead:

LPF ~ALTER_EFFECT~ INT_VAR match_savingthrow = 1 savingthrow = 0 END
Link to comment

Well, the function is working - it is changing the saving throw type of the spell. So I don't think that's the problem (the tildes). But, it's changing the saving throw to death instead of spells. The input I'm passing to it is wrong.

 

Neither the Weidu readme nor Camdawg's original post describing the function mention what kind of input is wanted there...

Link to comment

When I look at spells in NI, under the "save type" field, 0 is save v. spells, 1 is breath, 2 is death, 3 is wands, and 4 is polymorph. So that code should make the copied spell switch to a save vs. spells, regardless of what it is originally.

Bit 0 is vs. spells, bit 1 is vs. breath, bit 2 is vs. death, bit 3 is vs. wands, and bit 4 is vs. polymorph. IESDP also had this to say: if more than 1 saving throw type is specified, the target rolls against their best save.

 

If no saves are set, the value will be 0.

If only save vs. spells is set, the value will be 2^0 = 1.

If only save vs. breath is set, the value will be 2^1 = 2.

If only save vs. death is set, the value will be 2^2 = 4.

If only save vs. wands is set, the value will be 2^3 = 8.

If only save vs. polymorph is set, the value will be 2^4 = 16.

 

If a combination of those saves are set, the value will be a number between 1 and 31 determined by adding together the values of each included save type.

 

To achieve what you want, you could run the ALTER_EFFECT function multiple times, matching every saving throw value between 2 and 31 and setting them all to 1.

Link to comment

Ah! Got it. I was missing the whole exponent thing. Thank you!

 

And, since I have received such gracious assistance, I'll try to be gracious in return and share the result with everyone. The file at the following link is a little mod template that can arbitrarily change the saving throw required by a spell to whichever you want.

 

https://dl.dropboxusercontent.com/u/86011511/SaveMod.zip

 

Right now it is set to change every spell to require a save vs. Rod/Staff/Wand, instead of the original one. But you can set each spell to use whatever saving throw you like very simply, by editing "/savemod/spells/save_list_base.tpa." I've populated the list with every Priest and Wizard spell I found that offers a saving throw in BG2EE, from looking in NI. There is certainly a bunch of stuff missing - innate abilities and HLAs and random spells that look like normal spells but are used by the AI. But it's easy to add any .spl file you can think of to the list. Adding spells that don't exist in your game (references to IWDEE spells, in BGEE), or adding spells that do not offer saving throws, should not be harmful. This should not add saving throws to spells that don't already have one.

 

Also I'm not sure if my REPLACE_TEXTUALLYs will catch every reference to saving throws in spell descriptions. But again, with a little diligence anyone can easily check the phrases I've used in the .tp2 file and check the spell descriptions in the game, or in NI or DLTCEP, and add new lines to catch other phrasings. Like I said, this is just a template.

 

This can easily be used as part of a bigger mod. It could be an optional component, or just a way for the modder to compartmentalize these changes within an existing component. If you take a look at how ALTER_EFFECT works, you can also use this to do a *lot* more than just change saving throws. Go crazy!

 

Cheers

Link to comment

Archived

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

×
×
  • Create New...