Adding your own custom Magic Script Effects

Post » Sat Feb 19, 2011 5:00 am

So here's the deal.

I'm making a sword for my mod, that uses an enchantment. The purpose of this enchantment is to remove the god-like abilites of a certain enemy, so that you can kill him. So far I have created a script (very much like the Maiden's Tears script used against the SI Gatekeeper) that does these things, but I don't seem to be able to add this effect to the enchantment that I have created.

So here's the summary of what I have created so far:
An enemy
A godlike regeneration ability for the enemy
A weapon
An Enchantment (which does not work, cause I cannot apply the script effect on it)
A Script that remove the enemy's godlike ability.

So my first and foremost question would be: Is it even possible to add custom effect scripts to enchantments/spells/potions? And if it is, how do I do it, because at the moment I must be missing something.

Here's script btw:
Spoiler

scn DiNOrichalcEffectScript

;This is the script that is used by DiNOrichalcEnch with the Orichalc Blade
;It's purpose is to take off the special "invincibility" spell abilities of Kathulos

begin ScriptEffectStart
if GetIsID DiNKathulosLich == 1
removeSpell DiNKathMagicResistance
removeSpell DinKathRegenerate

endif

end ;ScriptEffectStart

User avatar
Victoria Vasileva
 
Posts: 3340
Joined: Sat Jul 29, 2006 5:42 pm

Post » Sat Feb 19, 2011 4:41 am

It is easy to add scripts to enchantments and spells. First, make sure your script is save as a Magic Effect script (it's set to Object Script by default). Next, open your enchantment, select "new", click on the dropdown box where you choose effects and select "Script Effect". In the script effect info section (lower half of the Enchantment Effect window), select your script and click "Okay".
However, if your intended target has 100% resistance to magic, you may want to make this an Object Script and attach it directly to the sword.

Also, while using GetIsID should work in this instance, it's not the best method to use for something like this. If there is more than one DiNKathulosLich in game, hitting one with this enchantment could remove the abilities from the other(s). It's better to make the placed instance of DiNKathulosLich a persistent reference, give it a RefID and use that in the script.

Example:

scn DiNOrichalcEffectScriptbegin ScriptEffectStart   If GetIsReference KathulosRef01 == 1    removeSpell DiNKathMagicResistance    removeSpell DinKathRegenerateend 


You can add additional RefIDs in ElseIf blocks if there is more than one DiNKathulosLich in game.
User avatar
Anna Beattie
 
Posts: 3512
Joined: Sat Nov 11, 2006 4:59 am

Post » Sat Feb 19, 2011 10:28 am

It is easy to add scripts to enchantments and spells. First, make sure your script is save as a Magic Effect script (it's set to Object Script by default). Next, open your enchantment, select "new", click on the dropdown box where you choose effects and select "Script Effect". In the script effect info section (lower half of the Enchantment Effect window), select your script and click "Okay".
However, if your intended target has 100% resistance to magic, you may want to make this an Object Script and attach it directly to the sword.

Also, while using GetIsID should work in this instance, it's not the best method to use for something like this. If there is more than one DiNKathulosLich in game, hitting one with this enchantment could remove the abilities from the other(s). It's better to make the placed instance of DiNKathulosLich a persistent reference, give it a RefID and use that in the script.


You can add additional RefIDs in ElseIf blocks if there is more than one DiNKathulosLich in game.


Thanks! My main problem was actually that due to my demented brain I did not notice the script type tab in the Scripts window :facepalm:
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Fri Feb 18, 2011 6:44 pm

Thanks! My main problem was actually that due to my demented brain I did not notice the script type tab in the Scripts window :facepalm:

Don't be so hard on yourself. I've made that mistake, too (more than once). Glad you got it sorted out.
User avatar
dean Cutler
 
Posts: 3411
Joined: Wed Jul 18, 2007 7:29 am


Return to IV - Oblivion