Jump to content

Need help getting script to fire from Magic Effect


Dragonfire12

Recommended Posts

I need some help with a mod I’m working on trying to get a script to fire.

The game is Skyrim Special Edition.

The Mod is my Vampire Follower, Athenasia. I want to spoof the movie Beetlejuice by using a shout to say Athenasia’s name three times fast. This transforms her into a Vampire Hag. Using the Shout a second time transforms her back to Athenasia.

 

I created a version of the Whispmother, red and horribly awesome (called a Vampire Hag), and tied it to a summon spell.

I’ve created the shout and have gotten it to load, etc., and I can use the shout in game but I can’t get the script to fire when I use the shout.

I’m placing the script within the Magic Effect for the third word of the shout.

The script compiles and I’m able to Fill all the Properties.

Here is the script.

 

 

Scriptname _AthanasiaShoutScript extends activemagiceffect

 

Actor property pPlayerRef auto

Actor property pAthanasiaNPC auto

ObjectReference property pAthanasiaStorageMarker auto

spell property pAth_SummonVampireHag auto

Quest property p0AthanasiaShoutQuest auto

Message Property p0Ath_ShoutMessage Auto

Message Property p0Ath_ShoutMessage1 Auto

Message Property p0Ath_ShoutMessage2 Auto

 

 

Event OnInit()

 

If p0AthanasiaShoutQuest.GetCurrentStageID() == 0

p0AthanasiaShoutQuest.SetCurrentStageID(10)

p0Ath_ShoutMessage.show() ;Show first time use Message - will only display once in message window box.

p0Ath_ShoutMessage1.show() ;Message Shout Stage 1 displayed top left screen

pAthanasiaNPC.EquipSpell(pAth_SummonVampireHag, 0)

pAth_SummonVampireHag.cast(pAthanasiaNPC)

pAthanasiaNPC.moveto(pAthanasiaStorageMarker)

pAthanasiaNPC.EnableAI(false) ;turn Athanasia AI processing off and store her someplace safe

 

ElseIf p0AthanasiaShoutQuest.GetCurrentStageID() == 1

p0AthanasiaShoutQuest.SetCurrentStageID(10) ;First time the shout was used so set Quest Stage to prepare for the second time

p0Ath_ShoutMessage1.show() ;Message Shout Stage 1 displayed top left screen

pAthanasiaNPC.EquipSpell(pAth_SummonVampireHag, 0)

pAth_SummonVampireHag.cast(pAthanasiaNPC)

pAthanasiaNPC.moveto(pAthanasiaStorageMarker)

pAthanasiaNPC.EnableAI(false) ;turn Athanasia AI processing off and store her someplace safe

 

ElseIf p0AthanasiaShoutQuest.GetCurrentStageID() == 10

p0AthanasiaShoutQuest.SetCurrentStageID(1) ;Second time the shout was used so reset the Quest/Script

p0Ath_ShoutMessage2.show() ;Message Shout Stage 2 displayed top left screen

pAthanasiaNPC.EnableAI() ;turn Athanasia AI processing back on, summon her back to the player

float az = pPlayerRef.GetAngleZ()

pAthanasiaNPC.SetAngle(0.0, 0.0, az + 180.0)

pAthanasiaNPC.MoveTo(pPlayerRef, 200.0 * Math.sin(az), 200.0 * Math.cos(az), 0.0, false)

pAthanasiaNPC.DispelSpell(pAth_SummonVampireHag) ;dispel the Vampire Hag

 

Endif

 

EndEvent

 

 

I think the problem may be how I am starting the script with, Event OnInit()

 

I have looked and searched and I can’t seem to find the right Event to use to launch a script from a magic effect.

 

Any Help?

Link to comment
Share on other sites

@ IsharaMeradin

 

It got the script to fire but it was firing twice. It took me forever to figure out that the Shout remained longer than it took for the script to run. This caused the script to fire twice.

I rewrote the entire script added Utility.Wait(5.0) to the end to give the Shout time to dissipate. Seems like I've worked on this for months and it finally works.

 

Thank you for your help.

 

Scriptname _AthanasiaShoutScript extends activemagiceffect

 

Actor Property pPlayerRef Auto

Actor Property pAthanasiaNPC Auto

Actor Property pAthanasia_VampireHag1 Auto

ObjectReference Property pAthanasiaStorageMarker Auto

ObjectReference Property pOAthVampireHagMarker Auto

Spell Property p0HagVampireBats Auto

Spell Property p0HagVolley Auto

Spell Property p0HagVampireDrain Auto

Message Property p0Ath_ShoutMessage Auto

Message Property p0Ath_ShoutMessage1 Auto

Message Property p0Ath_ShoutMessage2 Auto

GlobalVariable property WWAthHagCounter auto

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

If WWAthHagCounter.GetValue() == 0 || WWAthHagCounter.GetValue() == 1

WWAthHagCounter.Mod(2) ;First time the shout was used so prepare for the second time the shout is used

pAthanasiaNPC.EnableAI(False) ;turn Athanasia AI processing off and store her someplace safe

pAthanasiaNPC.moveto(pAthanasiaStorageMarker)

pAthanasia_VampireHag1.Enable() ;Summon the Vampire Hag

pAthanasia_VampireHag1.EnableAI()

float az = pPlayerRef.GetAngleZ()

pAthanasia_VampireHag1.SetAngle(0.0, 0.0, az + 180.0)

pAthanasia_VampireHag1.MoveTo(pPlayerRef, 200.0 * Math.sin(az), 200.0 * Math.cos(az), 0.0, false)

pAthanasia_VampireHag1.EquipSpell(p0HagVampireBats, 0)

p0HagVampireBats.cast(pAthanasia_VampireHag1)

Utility.Wait(2.0)

pAthanasia_VampireHag1.UnequipSpell(p0HagVampireBats, 0)

pAthanasia_VampireHag1.EquipSpell(p0HagVolley, 1)

pAthanasia_VampireHag1.EquipSpell(p0HagVampireDrain, 0)

p0Ath_ShoutMessage1.show() ;Message Shout Stage 1

Else

WWAthHagCounter.Mod(2)

pAthanasia_VampireHag1.RemoveSpell(p0HagVampireBats)

pAthanasia_VampireHag1.DispelSpell(p0HagVampireBats)

;pAthanasia_VampireHag1.UnequipSpell(p0HagVampireBats, 0)

pAthanasia_VampireHag1.EnableAI(False)

pAthanasia_VampireHag1.moveto(pOAthVampireHagMarker) ;turn Vampire Hag AI processing off and put her back into storage

pAthanasia_VampireHag1.Disable()

pAthanasiaNPC.EnableAI() ;turn Athanasia AI processing back on, summon her back to the player

float az = pPlayerRef.GetAngleZ()

pAthanasiaNPC.SetAngle(0.0, 0.0, az + 180.0)

pAthanasiaNPC.MoveTo(pPlayerRef, 200.0 * Math.sin(az), 200.0 * Math.cos(az), 0.0, false)

p0Ath_ShoutMessage2.show() ;Message Shout Stage 2

EndIf

EndEvent

 

Event OnEffectFinish(Actor Target, Actor Caster)

Utility.Wait(5.0) ;Keep the shout from firing the script twice

If WWAthHagCounter.GetValue() == 2

p0Ath_ShoutMessage.show() ;Show first time use Message - will only display once

Utility.Wait(1.0)

ElseIf WWAthHagCounter.GetValue() > 3

WWAthHagCounter.SetValue(1) ;Second time the shout was used so reset the Script

EndIf

EndEvent

Edited by Dragonfire12
Link to comment
Share on other sites

  • Recently Browsing   0 members

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