Jump to content

Adding Scripted Magic Effect on Equipted Armor


arunsundibob

Recommended Posts

Hi

 

I've been trying to add custom enchantments to armor through the CK. Specifically, I want to use scripts attached to magic effects to automatically cast spells while worn and not cast those spells when not worn. Then I want to be able to apply conditions (IsSneaking, IsInCombat etc.) to the effects in the Enchantment.

 

This is what I have as my script for casting Candlelight when the item is worn:

Scriptname NEWCandlelight extends activemagiceffect

SPELL Property Candlelight Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
Candlelight.Cast(akTarget, akCaster)

EndEvent

 

In this case the property is the candlelight spell, but a correct script should work for any spell I define as the property (i think)

 

Does anyone have suggestions for my script/ know a way to to this that works?

Link to comment
Share on other sites

Attempt 2 using ObjectReference instead:

 

Scriptname ARUNCandlelight extends ObjectReference

SPELL property ActiveEffect Auto

Event OnEquip(Actor akActor)
if akActor == Game.GetPlayer()
ActiveEffect.cast(akActor)
endIf
EndEvent

Event OnUnequip(ObjectReference akActor)
if akActor == Game.GetPlayer()
ActiveEffect.Interruptcast(akActor)
endIf
endEvent

 

It won't compile because Interruptcast can't be used. Is there another equivalent function to end the effect? (or is the first script better for this?)

Link to comment
Share on other sites

Scriptname ARUNCandlelight extends ObjectReference

SPELL property ActiveEffect Auto
Actor Property PlayerREF auto

Event OnEquip(Actor akActor)
       if akActor == PlayerREF
 	      ActiveEffect.cast(akActor)
       endIf
EndEvent

Event OnUnequip(Actor akActor)
       if akActor == PlayerREF
	       akActor.Interruptcast()
	       akActor.DispelSpell(ActiveEffect)
       endIf
endEvent

Edited by steve40
Link to comment
Share on other sites

Scriptname ARUNCandlelight extends ObjectReference

SPELL property ActiveEffect Auto
Actor Property PlayerREF auto

Event OnEquip(Actor akActor)
       if akActor == PlayerREF
 	      ActiveEffect.cast(akActor)
       endIf
EndEvent

Event OnUnequip(Actor akActor)
       if akActor == PlayerREF
	       akActor.Interruptcast()
	       akActor.DispelSpell(ActiveEffect)
       endIf
endEvent

 

Thanks! It compiled but when i used the enchanted item in game there was still no effect. Perhaps its due to how I've set it up in the CK?

 

 

 

 

I've various different changes to those with no signs of it working. I tested it with both a candlelight spell and a ward spell.

Link to comment
Share on other sites

It's working, thanks for the scripting help! Turns out that I forgot to change the enchantment on the weapon to the one using the newer script haha... Also, you may be interested to know that the duration of the enchantment CAN be zero. Only tested it with candlelight but I guess that should apply to all similarly scripted enchantments.

 

Now, moving on, i don't suppose there's a way to reliably convert the conditions found in the CK to a script? (like IsSneaking, IsInCombat etc.)

 

EDIT: Scratch that, orb of light shows up but doesn't actually light up the area so the effect works, just not the script attached to it.

Edited by arunsundibob
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...