Pocket Plane Group

Miscellany, Inc. => Infinity Engine Modding Q&A => Topic started by: Caedwyr on April 19, 2004, 04:05:51 PM

Title: Opcode removal or other suggestions
Post by: Caedwyr on April 19, 2004, 04:05:51 PM
I'm trying to create the spell Anti-Magic Shield.  This spell gives the caster immunity to all spells level 1-9(opcode 102), causes 100% spell failure for cleric, mage and innate abilities (opcode 60), as well as dispelling all spell effects currently on the character (opcode 58), giving the character the magic immunity icon (opcode 142), a minor globe animation (opcode 155), and will cause a sound file to play when the effect wears off (opcode 174, delayed timing).

What I would like to do, is make this a spell that will bypass the caster's resistance (consider it a friendly spell), make it undispellable, but still be able to use a new innate ability which will allow the caster to end the spell early.  I know how to make the new innate work even with the 100% spell failure (just put it in the casting features, not the extended effects), but I cannot figure out how to remove the various effects of the spell if I make the spell undispellable.  Is there a method for removing the opcodes, or are there any other suggestions for how to design this spell so it can remove itself early?
Title: Re: Opcode removal or other suggestions
Post by: SimDing0™ on April 19, 2004, 04:38:16 PM
I think you can flag the spell by secondary type or something, and then use some special effect to dispel it. Someone who knows what they're talking about, quite possibly Ghrey or igi, will be along soon to explain this.
Title: Re: Opcode removal or other suggestions
Post by: Ghreyfain on April 19, 2004, 04:53:41 PM
Maybe try immunity to opcode (opcode) with a duration of instant, for the undispellable permanent opcodes you want to dispel.  Sim says igi will be along shortly, anyways.
Title: Re: Opcode removal or other suggestions
Post by: igi on April 19, 2004, 05:00:18 PM
Yep, seconday type is the way to go.
Set all the effects in the spell which adds the "anti-magicness" to use a new secondary type (ie. just set the secondary type to a number greater than 13, (no need to add it to the msectype file, and greater than 13 as there are 13 sec types in vanilla bg2)).
Then, in the spell to remove the "anti-magicness" use opcode "#221 (0xdd) Removal: Remove Secondary Type [221]" or opcode "#230 (0xe6) Removal: Remove One Secondary Type [230]" ( i cant remember which. maybe both work for this), with the 2nd param set to the sec type value used in the 1st spell.
And it should work
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 19, 2004, 06:21:02 PM
Thanks for the help.  A further question on the implementation.  I am using DLTCEP version 6.1e to edit these spells and effects.  In the edit effect window I see a section that is always greyed out labeled Spell School and another labeled Secondary Type.  Are these the areas that you refer to when you say to set secondary type to a number greater than 13, or are you refering to the actual spell itself and changing Secondary type in the general properties heading to a number greater than 13?


Doing a bit more investigation, it seems I can modify these fields when I create a new spell effect from scratch and do not go through the edit spell effect option in the extended effects window of new spell creation.  In this case I will need to call a specific spell effect.  That works though.


A further question.  Is there an easier way to edit these fields than creating a new effect.  Since the spell will have quite a few spell effects and multiple spell level headers (a 6th, 8th, 9th, ... 20th level version) for different durations, my current method will require lots of new .eff files.
Title: Re: Opcode removal or other suggestions
Post by: Idobek on April 20, 2004, 01:21:07 PM
Can't use just alter the secondary type of the spell? I would have thought that then applies that secondary type to all the effects of the spell.
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 20, 2004, 02:40:24 PM
Thanks.  That'll make it a lot simpler.  I was looking too hard at how the spell effect mechanics worked.
Title: Re: Opcode removal or other suggestions
Post by: igi on April 20, 2004, 06:34:41 PM
Um, yeah, the secondary type of the spell itself would probably work... sorry :)
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 20, 2004, 07:07:49 PM
That's made it a lot simpler. 


Another question.  In the general properties of the spell, there is a field where you can select the spell type. 

Given values are 0: Special, 1: Wizard, 2: Cleric, 3: Unknown, 4: Innate. 

Since I am assigning 100% spell failure for wizard (0), cleric (1) and innate abilities (2) I would like to use a spell type that will not be affected by spell failure using the opcode: [60] Miscast Magic. 

For opcode 60, the description in DLTCEP says:
Quote
Known values for 'Type' are:
0   Mage Spells
1   Cleric Spells
2   Innate
3   Mage Spells
4   Cleric Spells
5   Innate

'Type' values of 0,1 or 2 display a message -'Spell Failed: casting failure'
'Type' values of 3,4 or 5 display a message -'Spell failed due to dead magic'

This doesn't include several of the spell types listed in the general properties tab.  What I am wondering, is can I use a spell type 5 (arbitrary #5) in the spell type field of general properties, and in the extended effects tab place the location as innate without any problems?  Also, will my miscast magic effects interfere with this spell type 5?

Can this non-innate ability be given to the player using opcode 171: Give Innate?

Basically, will using an additional spell type cause any funky interactions that can't be predicted or seen at first glance, or should everything run smoothly?
Title: Re: Opcode removal or other suggestions
Post by: Galactygon on April 20, 2004, 09:06:50 PM
Rather than making that innate a new spell type, try setting the target type to 7; "none". It is in reality target: self and ignores game pause (and I think even Miscast Magic and Silence IIRC).

-Galactygon
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 20, 2004, 09:48:55 PM
I already know how to avoid casting failure, so that isn't an issue.  The question is, will the spell display the casting failure message, even though it is successful?  The reason I wanted to create the new spell type was so it would not be one of the spell types that I have set miscast magic to 100% for.  Basically it is for the suppression of the casting failure message.
Title: Re: Opcode removal or other suggestions
Post by: hlidskialf on April 20, 2004, 10:15:58 PM
Caedwyr, when you get done with all this you should consider writing and posting a "Spell Creation - Inside and Out" type tutorial. You've been doing enough lately to make it interesting, and possibly inspire a new modder to try something harder than the defunctory "elemental damage" spells.  ;)
Title: Re: Opcode removal or other suggestions
Post by: Galactygon on April 20, 2004, 10:23:18 PM
I already know how to avoid casting failure, so that isn't an issue.  The question is, will the spell display the casting failure message, even though it is successful?  The reason I wanted to create the new spell type was so it would not be one of the spell types that I have set miscast magic to 100% for.  Basically it is for the suppression of the casting failure message.

I thought setting the target type to '7' prevents even the message from popping up?  :)

Best way is to try and experiment.

-Galactygon
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 20, 2004, 11:12:21 PM
I document everything, so I'll be able to at least write down what I've experienced.

Yep, I know I can experiment, but since I am currently slugging my way through 20 or so extended spell headers and manually changing each of the 30 or so effects duration, I figured I'd be lazy and pick the brains of those who know something.  Incidently if someone knows how to use DLTCEP to allow me to change increase the durations of the effects in each header by 60, starting at an initial value of 360, I'd be very happy.  I tried fiddling around with the tool tab in the spell editor, but I haven't had any luck there.


Quote
I thought setting the target type to '7' prevents even the message from popping up?

Glad to hear it.  I'll be sure to test it.
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 23, 2004, 01:30:58 PM
$&*&#&^@ board ate my first message.  Here it goes again.

I am currently having troubles bypassing the 100% spell failure effect I've placed the target for the removal spell.

What I have been doing, is creating an anti-magic shell spell.  The relevant information to my problem is as follows:

I use DLTCEP v. 6.1e.  The anti-magic shell uses 20 different extended headers to grant various immunities and effects, the duration depending on the caster level (6-25).  The problem effects are:
Stat: Miscast Magic [60], 100% chance, type 3&4&5 ('Type' values of 3,4 or 5 display a message -'Spell failed due to dead magic' with 3 for mage spells, 4 for cleric spells, and 5 for innate spells)  This effect is non-magical and has no save.

The anti-magic shell spell has a secondary type of 14 (General Properties Tab), which I plan to use for removing opcode protections that I add with the spell.   The anti-magic spell is a level 6 innate of the abjuration school.  Part of the extended headers gives the caster an innate ability which is to be used to end the anti-magic shell effect.

When I use the cancel anti-magic shell spell, I get the following message:
Spell failed due to dead magic

The Cancel Anti-Magic shell spell was originally going to be an innate spell, that uses the Removal: Remove One Secondary Type [230] opcode with secondary type of 14, cast through the casting features which I thought would bypass the miscast magic effect.  This has not worked.  I have also tried to use Galac's suggestion to set the target type to '7' in the extended header, as well as changing the spell type to 5, 6, 7, etc. in the General Properties tab (since I have only set spell failure to 100% for wizard, cleric and innate spells AFAIK).  The spell location (from the extended header) is 4- innate.


Any help with letting me bypass the 100% miscast magic effect would be much appreciated.
Title: Re: Opcode removal or other suggestions
Post by: Galactygon on April 24, 2004, 02:28:16 PM
Now I think I know a solution:

- Set the dispelling spell back to a target type of 'self'
- Set the casting time to 1
- Erase all the dispelling effects in this spell (this spell will be used to trigger amother spell)
- In the Casting Features Tab, make an effect that casts a second spell (opcode #146, target: Self, casting level: 1, casting type: 0).

- Make the second spell. This is where you put all the dispelling stuff.
- Make sure the casting time is set to zero for the second spell

Now try it. This is sort of like ForceSpell() in a sripting action.

-Galactygon
Title: Re: Opcode removal or other suggestions
Post by: Caedwyr on April 24, 2004, 11:16:18 PM
Works like a charm.  Thanks alot.