Jump to content


Photo

Changing Priest/Mage Spells to Innates on the Fly


10 replies to this topic

#1 CamDawg

CamDawg

    Just returned from a triumphant carpet-bombing of Eden 7

  • Gibberling Poobah
  • 8894 posts
  • Gender:Not Telling

Posted 23 February 2004 - 03:21 PM

Particularly in kit making, there is a need to quickly and easily change spells from wizard or priest to innate abilities. One way to accomplish this is to open your spell editor of choice, copy the spell, change the spell type to innate, change the spell icon to the innate version, and also change each one of the spell effect headers to display icons as innate abilities. Then you would need to include and copy this file with your installation package.

In the course of the Cleric Remix mod, this issue is coming up repeatedly, and frankly, I got tired of making the same changes over and over. Another potential issue is that if another mod wants to alter the spell you're modifying, you could end up with an innate and mage version of a spell that do different damage, save penalties, etc. since the innate version is based on the modder's install, while the player's version is based off another mod.

The ideal solution is to use a COPY_EXISTING command and patch as you go along. The following example is one I used to change the mage spell Chain Lightning SPWI615.spl into an innate ability named C!TLCHNL.spl for the Cleric Remix mod.

COPY_EXISTING ~SPWI615.spl~ ~override/C!TLCHNL.spl~
  WRITE_SHORT 0x1C 4 // sets spell type to innate (4)
  WRITE_LONG 0x34 1
  READ_LONG 0x64 "offset_abil"
  READ_SHORT  0x68 "num_abil"

  READ_ASCII ("%offset_abil%" + 0x04) "bam" // reads the bam filename from ability
  WRITE_EVALUATED_ASCII 0x3A "%bam%" // writes the bam filename from abilities to spell icon

  SAY NAME1 ~blah~
  SAY NAME2 ~blah~
  SAY UNIDENTIFIED_DESC ~blah~
  SAY DESC ~blah~

  WHILE (0 < "%num_abil%")
    BEGIN
      WRITE_SHORT (("%offset_abil%" + 0x02) + (("%num_abil%" - 1) * 0x28)) 4 // changes ability icon location to innate (4)
      SET "num_abil" = ("%num_abil%" - 1)
    END


This could also be used in reverse, or to change wizard to priest spells, etc. by altering the number 4 (in bold) in the two WRITE_SHORT commands. If you wanted to alter the name and description of the spell, all of the normal SAY commands can be used with the COPY_EXISTING command. The SAY commands in this example are in gray and are entirely optional as you would only need them if you wanted to change the name and/or description of the spell.

The section in green is the meat of the routine. First, you read in the number of abilities and where they begin in the file. Then, you create a loop using WHILE that goes through and patches every ability with the icon location of innate (4). You need the number of abilities and their offset to determine how many times WHILE will loop and the exact offset to patch.

The section in purple is used to change the BAM of the spell icon and is also an optional component. By convention, every spell has three icons, named xxxxA.bam, xxxxB.bam, and xxxxC.bam. The A version is used on scrolls, the B version is what shows up in your spellbook, and the C version is displayed on the bottom bar of the game screen when selecting your spell from the "Cast Spell" or "Special Abilities" button. In this example, we're using the fact that the 'Abilities' headers of spells always use the B version of the icon, and copying the name over to the general spell. Please not that this section is specific to changing spells into innates; do not use this block if you're changing a spell into a wizard or priest spell.

edit: Thanks for the cleaner code, Idobek!

Edited by CamDawg, 17 July 2004 - 04:48 PM.

What makes a good man go neutral? Lust for gold? Power? Or were you just born with a heart full of neutrality?


#2 Grim Squeaker

Grim Squeaker

    Utter Bastard

  • Gibberling Poobah
  • 3296 posts
  • Gender:Male
  • Location:Hovering around London

Posted 23 February 2004 - 03:25 PM

Hail Cam, the READ/WRITE King!

I swear, is there nothing you can't do with these commands...
"Leave me be, I don't want to argue.
I just get confused and I come all undone.
If I agree, well it's just to appease you,
'Cause I don't remember what we're fighting for."

#3 CamDawg

CamDawg

    Just returned from a triumphant carpet-bombing of Eden 7

  • Gibberling Poobah
  • 8894 posts
  • Gender:Not Telling

Posted 23 February 2004 - 03:34 PM

My ideal world is one in which all mods play together nicely.

OK, so I really did it because it save me a lot of time in spell editing. :D

What makes a good man go neutral? Lust for gold? Power? Or were you just born with a heart full of neutrality?


#4 Andyr

Andyr

    HELLO EVERYBODY

  • Gibberlings
  • 4534 posts
  • Gender:Male
  • Location:Oxford, UK

Posted 24 February 2004 - 05:13 AM

I've just been doing it the old-fashioned way, as I couldn't be bothered to look up all the offsets for spells with lots of headers. :D I did it this way for Elai's spellbook though.
Since you're here, download G3 mods please...

Suggested plugs include "Click here so Compton doesn't ban me. http://www.pocketplane.net/ub"

The most reliable way to get hold of me is via email (button when viewing my profile).

#5 Galactygon

Galactygon

    Nostradoctopus

  • Members
  • 648 posts
  • Location:Hungary

Posted 26 February 2004 - 02:22 PM

My ideal world is one in which all mods play together nicely.

Unless there are 2 competing spell-system TCs :D



#6 Idobek

Idobek

    Dust Bunny

  • Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 28 February 2004 - 05:24 PM

There are some new commands in WeiDU:
READ_ASCII ("%offset_abil%" + 0x04) "bam" // reads the bam filename from ability

WRITE_EVALUATED_ASCII 0x3A "%bam%" // writes first the bam filename from abilities to spell icon
Saves a couple of lines of code. You can't use a READ_ASCII variable in a WHILE or IF_EVAL situation though.
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'

#7 CamDawg

CamDawg

    Just returned from a triumphant carpet-bombing of Eden 7

  • Gibberling Poobah
  • 8894 posts
  • Gender:Not Telling

Posted 28 February 2004 - 05:31 PM

Right on! Thanks Idobek. I'll update the tutorial--and my code!

Your tutorials were what got me started with my love affair using WeiDU as a hex editor. :D

What makes a good man go neutral? Lust for gold? Power? Or were you just born with a heart full of neutrality?


#8 Idobek

Idobek

    Dust Bunny

  • Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 28 February 2004 - 05:40 PM

Your tutorials were what got me started with my love affair using WeiDU as a hex editor.

Well you are returning the favour. Looking at some of your code helped me solve a problem today.
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'

#9 Idobek

Idobek

    Dust Bunny

  • Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 04 March 2004 - 05:21 PM

Me again. Spells don't use NAME2 and DESC. :D
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'

#10 CamDawg

CamDawg

    Just returned from a triumphant carpet-bombing of Eden 7

  • Gibberling Poobah
  • 8894 posts
  • Gender:Not Telling

Posted 04 March 2004 - 06:09 PM

I know, it's just my curse to be horribly anal retentive and use four SAYs on everything. :D

What makes a good man go neutral? Lust for gold? Power? Or were you just born with a heart full of neutrality?


#11 Idobek

Idobek

    Dust Bunny

  • Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 18 April 2004 - 05:53 AM

As well as changing the spell type to innate you should also set the spell level to 1 (WRITE_LONG 0x34 1). Otherwise if you try to cast it via script you will crash the game. This is the reason for the Scriptable Spells mod, several vanilla innates also have this issue.

Why are you changing the spell icon bam? It makes no difference in-game, the icon from the ability is used. The spell icon is only used in the spell book/scroll. Another anal retentiveness example? :D

I really should clean up this thread.
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users