Jump to content

Including Spells as Kit Special abilities


Bill Bisco

Recommended Posts

I'm trying to fill out the clab file for my custom kit. I just want to copy spells as they are but have them be special abilities.

 

For example, Invisibility is spin188. I added this to the clab file but the ability did not appear.

 

What do I have to do to get default game spells working from the kit clab file?

 

Thanks,

 

Bill

Link to comment

Where do you want them to appear? If you need it as an innate ability, you should change the spell's type to Innate. This way, it'll appear in your character's special abilities. If you just plain copied, the spell probably still has it's original spell type (Wizard) and the game will try to send it to spell book (which a character might not have access to).

 

Here's an example that does just that:

 

 

COPY_EXISTING ~SPPR111.spl~ ~override/SPINI98.spl~
  WRITE_SHORT 0x1C 4
Link to comment

Here's an example that does just that:

COPY_EXISTING ~SPPR111.spl~ ~override/SPINI98.spl~
  WRITE_SHORT 0x1C 4

It not enough, because the spell icons locations need to be placed in the innates too.

DEFINE_PATCH_MACRO ~divine_spells_to_level_three~ BEGIN
  PATCH_IF ("%SOURCE_SIZE%" > "0x71") BEGIN
    READ_LONG  0x64 "abil_off" ELSE 0
    READ_SHORT 0x68 "abil_num" ELSE 0
    READ_ASCII ("%abil_off%" + 0x04) "bam" (8)					// reads the bam filename from ability
    WRITE_SHORT 0x1C 1								// sets spell type to Wizard (1)
    WRITE_LONG  0x34 3								// sets spell level to 3
    WRITE_EVALUATED_ASCII 0x3A "%bam%" #8					// writes the bam filename from abilities to spell icon
    FOR ( index = 0 ; index < abil_num ; index = index + 1 ) BEGIN
      WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 2			// changes ability icon location to spell (2) just incase
      END
    END
  END

This does similar thing to divine spells, turning them to custom level 3 wizard spells, when copies using this:

COPY_EXISTING ~SPPR211.spl~ ~override/IJ#P211.spl~
  LAUNCH_PATCH_MACRO ~divine_spells_to_level_three~
Link to comment

 

Here's an example that does just that:

COPY_EXISTING ~SPPR111.spl~ ~override/SPINI98.spl~
  WRITE_SHORT 0x1C 4

It not enough, because the spell icons locations need to be placed in the innates too.

DEFINE_PATCH_MACRO ~divine_spells_to_level_three~ BEGIN
  PATCH_IF ("%SOURCE_SIZE%" > "0x71") BEGIN
    READ_LONG  0x64 "abil_off" ELSE 0
    READ_SHORT 0x68 "abil_num" ELSE 0
    READ_ASCII ("%abil_off%" + 0x04) "bam" (8)					// reads the bam filename from ability
    WRITE_SHORT 0x1C 1								// sets spell type to Wizard (1)
    WRITE_LONG  0x34 3								// sets spell level to 3
    WRITE_EVALUATED_ASCII 0x3A "%bam%" #8					// writes the bam filename from abilities to spell icon
    FOR ( index = 0 ; index < abil_num ; index = index + 1 ) BEGIN
      WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 2			// changes ability icon location to spell (2) just incase
      END
    END
  END

This does similar thing to divine spells, turning them to custom level 3 wizard spells, when copies using this:

COPY_EXISTING ~SPPR211.spl~ ~override/IJ#P211.spl~
  LAUNCH_PATCH_MACRO ~divine_spells_to_level_three~

You only will see the icon in innate if you follow above advise.

Alternatly you can create your own spell with NI from the copy of the exising. In any case Do everyone (including yourself) a favour and give the spell some name of your own BIBIINV.spl or whatever (it is designed only for your NPC, right?) there is no need to use SPPR or SPIN or whatever if you just give it with AddAbility to your NPC, It avoids mess with the global spells.

Link to comment

Thank you all very much for your replies. I could not do this without assistance.

 

Spells I want to be innates for my kit:

Luck : SPWI209
Non-Detection SPWI310
Knock SPWI207
Invisibility : SPWI206
Find Traps : SPPR205 or SPPR205D (What's the difference with the D?)
Dimension Door: SPWI402, SPWI926, SPWI982, SPWI994, or SPWI995 (Which one should I use?)
Improved Invisibility SPWI405
Farsight SPWI424
True Sight SPWI609 or SPWI609D (What's the difference with the D?)
Mass Invisibility SPWI721

 

Let me try the modified code for what I want.

COPY_EXISTING ~SPWI209.spl~ ~override/BIIN01.spl~
COPY_EXISTING ~SPWI310.spl~ ~override/BIIN02.spl~
COPY_EXISTING ~SPWI207.spl~ ~override/BIIN03.spl~
COPY_EXISTING ~SPWI206.spl~ ~override/BIIN04.spl~
COPY_EXISTING ~SPWI205.spl~ ~override/BIIN05.spl~
COPY_EXISTING ~SPWI402.spl~ ~override/BIIN06.spl~
COPY_EXISTING ~SPWI405.spl~ ~override/BIIN07.spl~
COPY_EXISTING ~SPWI424.spl~ ~override/BIIN08.spl~
COPY_EXISTING ~SPWI609.spl~ ~override/BIIN09.spl~
COPY_EXISTING ~SPWI721.spl~ ~override/BIIN10.spl~

DEFINE_PATCH_MACRO ~Certain Spells Copied as Innates~ BEGIN
PATCH_IF ("%SOURCE_SIZE%" > "0x71") BEGIN        // I really want to define the spells to be patched just the ones above.
READ_LONG 0x64 "abil_off" ELSE 0
READ_SHORT 0x68 "abil_num" ELSE 0
READ_ASCII ("%abil_off%" + 0x04) "bam" (8)                    // reads the bam filename from ability
WRITE_SHORT WRITE_SHORT 0x1C 4                                // sets spell type to Innate (4)
WRITE_EVALUATED_ASCII 0x3A "%bam%" #8                    // writes the bam filename from abilities to spell icon
FOR ( index = 0 ; index < abil_num ; index = index + 1 ) BEGIN
WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 2            // changes ability icon location to spell (2) just incase.  Do I need to set the location to Spell (2)?  I don't need these to be second level spells.  I want them to retain their spell levels.
END
END
END

LAUNCH_PATCH_MACRO ~Certain Spells Copied as Innates~

How would I modify the "%SOURCE_SIZE%" > "0x71" ? I only want to patch the specified files above.

 

The below code is from Song and Silence. It should work fine with icons because it copies a Priest Spell to a Wizard Spell instead of a Spell to an Innate?

// Armor of Faith
COPY_EXISTING sppr111.spl ~override/a!ch11.spl~
  WRITE_SHORT 0x1c 1 // sets spell type to Wizard (1)
  SAY 0x50 @48

I could create a spell file on my own. I feel though it's probably more elegant if it's created in code. If someone modifies one of the above spells in their games, the innate ability here will also be modified accordingly which is probably ideal.

 

 

Link to comment

Thank you all very much for your replies. I could not do this without assistance.

 

Spells I want to be innates for my kit:

Luck : SPWI209

Non-Detection SPWI310

Knock SPWI207

Invisibility : SPWI206

Find Traps : SPPR205 or SPPR205D (What's the difference with the D?)

Dimension Door: SPWI402, SPWI926, SPWI982, SPWI994, or SPWI995 (Which one should I use?)

Improved Invisibility SPWI405

Farsight SPWI424

True Sight SPWI609 or SPWI609D (What's the difference with the D?)

Mass Invisibility SPWI721

 

Let me try the modified code for what I want.

COPY_EXISTING ~SPWI209.spl~ ~override/BIIN01.spl~
COPY_EXISTING ~SPWI310.spl~ ~override/BIIN02.spl~
COPY_EXISTING ~SPWI207.spl~ ~override/BIIN03.spl~
COPY_EXISTING ~SPWI206.spl~ ~override/BIIN04.spl~
COPY_EXISTING ~SPWI205.spl~ ~override/BIIN05.spl~
COPY_EXISTING ~SPWI402.spl~ ~override/BIIN06.spl~
COPY_EXISTING ~SPWI405.spl~ ~override/BIIN07.spl~
COPY_EXISTING ~SPWI424.spl~ ~override/BIIN08.spl~
COPY_EXISTING ~SPWI609.spl~ ~override/BIIN09.spl~
COPY_EXISTING ~SPWI721.spl~ ~override/BIIN10.spl~

DEFINE_PATCH_MACRO ~Certain Spells Copied as Innates~ BEGIN
PATCH_IF ("%SOURCE_SIZE%" > "0x71") BEGIN        // I really want to define the spells to be patched just the ones above.
READ_LONG 0x64 "abil_off" ELSE 0
READ_SHORT 0x68 "abil_num" ELSE 0
READ_ASCII ("%abil_off%" + 0x04) "bam" (8)                    // reads the bam filename from ability
WRITE_SHORT WRITE_SHORT 0x1C 4                                // sets spell type to Innate (4)
WRITE_EVALUATED_ASCII 0x3A "%bam%" #8                    // writes the bam filename from abilities to spell icon
FOR ( index = 0 ; index < abil_num ; index = index + 1 ) BEGIN
WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 2            // changes ability icon location to spell (2) just incase.  Do I need to set the location to Spell (2)?  I don't need these to be second level spells.  I want them to retain their spell levels.
END
END
END

LAUNCH_PATCH_MACRO ~Certain Spells Copied as Innates~

How would I modify the "%SOURCE_SIZE%" > "0x71" ? I only want to patch the specified files above.

 

The below code is from Song and Silence. It should work fine with icons because it copies a Priest Spell to a Wizard Spell instead of a Spell to an Innate?

// Armor of Faith
COPY_EXISTING sppr111.spl ~override/a!ch11.spl~
  WRITE_SHORT 0x1c 1 // sets spell type to Wizard (1)
  SAY 0x50 @48

I could create a spell file on my own. I feel though it's probably more elegant if it's created in code. If someone modifies one of the above spells in their games, the innate ability here will also be modified accordingly which is probably ideal.

 

 

I was about to comment on that very last issue - but it seems your intentions are just opposite of what mine normally are. Creating a spell on your own guarantees that you get what you wanted regardless of other mods tweaking the source spell (which in large BGT installations may lead to a final result you never expected). However, if you want your spell to mirror closely the behaviour a player would see from the spell cast by another NPC, then create spell by code way is what you want.

Link to comment

I only want to patch the specified files above.

The macro needs to be run once for every file that is copied. You should define the macro before copying the files.

 

// change regular spell to innate
DEFINE_PATCH_MACRO ~spell_to_innate~ BEGIN
  READ_LONG  0x64 "abil_off" ELSE 0
  READ_SHORT 0x68 "abil_num" ELSE 0
  READ_ASCII ("%abil_off%" + 0x04) "bam" (8) // reads the bam filename from ability
  WRITE_SHORT 0x1C 4                         // sets spell type to innate (4)
  WRITE_LONG  0x34 1                         // sets spell level to 1 to avoid scripting issues
  WRITE_EVALUATED_ASCII 0x3A "%bam%" #8      // writes the bam filename from abilities to spell icon
  FOR ( index = 0 ; index < abil_num ; index = index + 1 ) BEGIN
    WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 4 // changes ability icon location to innate (4)
    READ_SHORT  ("%abil_off%" + 0x12 + (0x28 * "%index%")) "speed" // reads casting speed
    PATCH_IF ("%speed%" > 3) BEGIN
      WRITE_SHORT  ("%abil_off%" + 0x12 + (0x28 * "%index%")) ("%speed%" - 2) // reduces casting speed
    END ELSE BEGIN
      WRITE_SHORT  ("%abil_off%" + 0x12 + (0x28 * "%index%")) 0 // makes instant
    END
  END
END
This macro is from Divine Remix and should work a little better than what you have. I'm not sure if you want the casting speed changes or not (it reduces the casting speed of the innate versions by 2).

 

COPY_EXISTING ~SPWI209.spl~ ~override/BIIN01.spl~
              ~SPWI310.spl~ ~override/BIIN02.spl~
              ~SPWI207.spl~ ~override/BIIN03.spl~
              ~SPWI206.spl~ ~override/BIIN04.spl~
              ~SPWI205.spl~ ~override/BIIN05.spl~
              ~SPWI402.spl~ ~override/BIIN06.spl~
              ~SPWI405.spl~ ~override/BIIN07.spl~
              ~SPWI424.spl~ ~override/BIIN08.spl~
              ~SPWI609.spl~ ~override/BIIN09.spl~
              ~SPWI721.spl~ ~override/BIIN10.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
By using one COPY_EXISTING with multiple files, the patches will be applied to all of the files.

 

The equivalent code with multiple COPY statements would look like this:

 

COPY_EXISTING ~SPWI209.spl~ ~override/BIIN01.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI310.spl~ ~override/BIIN02.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI207.spl~ ~override/BIIN03.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI206.spl~ ~override/BIIN04.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI205.spl~ ~override/BIIN05.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI402.spl~ ~override/BIIN06.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI405.spl~ ~override/BIIN07.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI424.spl~ ~override/BIIN08.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI609.spl~ ~override/BIIN09.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
COPY_EXISTING ~SPWI721.spl~ ~override/BIIN10.spl~
  LAUNCH_PATCH_MACRO ~spell_to_innate~
Link to comment

Mike1072, you're an angel in human clothing! Thank you. I've incorporated your suggested coding and given credit.

 

However, I can't get these special abilities to appear when I start up a new ToB Game.

 

ibO7no.png

 

 

 

My Setup TP2 is located at: https://github.com/billbisco/erevainmod/blob/master/Erevain/Setup-Erevain.tp2

My CLAB file is located at: https://github.com/billbisco/erevainmod/blob/master/Erevain/Kits/Infiltrator/biClabth01.2DA

 

I thought I formatted everything correctly. Is there something stupid that I'm missing?

 

Sincere thanks for the help so far,

 

Bill

Link to comment

The name of your CLAB file has to be at most 8 characters long (not counting the .2da extension). Also, this isn't going to cause problems, but in the CLAB file itself, there's no need to uniquely reserve each row for a different ability. The GA_BIIN02 entries at level 3 could go in the rows for ABILITY1 and ABILITY2 just as easily as ABILITY3 and ABILITY4.

Link to comment

I modified the clab file as you said. Thank you! That worked!

 

All of the Innate Abilities made it! Woo hoo!

 

bhDOy2.png

 

One question though is this item

WRITE_LONG 0x34 1 // sets spell level to 1 to avoid scripting issues

Don't we want spells to be at their regular level to avoid Dispel magic et al?

 

Link to comment

Inmates should be level ..

Inmate is a bunk mate in prison... not an innate spell ability. :p Just a small spelling error ?

Sorry Bill, I didn't have the time to explain the intricacities of patching the fle with Weidu... there's lots things you can do with it... but we got you there eventually.

Link to comment

Inmates should be level 1; I think you can set the "power level" in each effect to the normal spell level.

Yeah, this. Non-level one innates fail, spectacularly, when you try to cast them via script; for bonus points triggers like SpellCastInnate won't work unless the level matches the file name (don't ask), though I believe we've sorted all of this in the EEs. The good news is that the power levels in the effects are the important parts--those determine how spell protections interact, not the spell level.

Link to comment

Archived

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

×
×
  • Create New...