Here is the script. Everything except for my little problem of the looping Sound Descriptor called "BatsFlying". Which I've set to a global ID as "BatsFly"
The spell is a toggle (ignore the Fly function I haven't got it working yet. It compiles but does nothing basically)
Scriptname DV_BatFormTraits extends ActiveMagicEffect import Gameimport Soundimport Formimport Debugimport Utilityimport GlobalVariableimport ActorActor Property Player AutoSpell Property DVampireBatForm AutoSpell Property DVampireBatFormToggle AutoIdle Property SwimStart AutoIdle Property swimStop AutoIdle Property JumpFall Autobool Property bIsOn Autobool Property bVal AutoEffectShader Property DVCelerityShadowForBats AutoEffectShader Property Bats_DV AutoSound Property AMBBatsSD AutoSound Property BatsFlying AutoSound Property BatsLeaving Autofloat bearingfloat elevationfloat speedfloat posxfloat posyfloat poszfloat movefloat dtimeint BatsFlyIDint BatsLeaveIDEvent OnEffectStart(Actor Target, Actor Caster)if !Caster.IsInInterior() if !Caster.HasSpell(DVampireBatFormToggle) Caster.AddSpell(DVampireBatFormToggle, false) Caster.SetAlpha(0) Wait(0.1) DisablePlayerControls() Wait(0.1) SetIniFloat("fInAirFallingCharGravityMult:Havok",0) Caster.MoveTo(Caster, 0, 0, 800) BatsFlyID = BatsFlying.Play(Caster) ;turn on the sound to play while in Bat Form SetInstanceVolume(BatsFlyID, 2.0) Caster.TranslateTo(Caster.GetPositionX(), Caster.GetPositionY(), Caster.GetPositionZ(), 0.0, 0.0, 0.0, 0.0) Wait(0.1) Caster.StopTranslation() DVCelerityShadowForBats.Play(Caster) Bats_DV.Play(Caster) Caster.SetAllowFlying() ForceThirdPerson() Wait(0.1) SendAnimationEvent(Caster ,"SwimStart") EnablePlayerControls() SetIniFloat("fInAirFallingCharGravityMult:Havok",0) while Caster.HasSpell(DVampireBatFormToggle) Fly() endwhile ;bVal = True else Caster.RemoveSpell(DVampireBatFormToggle) SendAnimationEvent(Caster ,"JumpFall") Caster.SetAlpha(1) DVCelerityShadowForBats.Stop(Caster) Bats_DV.Stop(Caster) Caster.SetAllowFlying(false) StopInstance(BatsFlyID) ;turn off the flying sound when Bat Form ends BatsLeaveID = BatsLeaving.Play(Caster) ;landing/exit form sound ;bVal = False endifendif ;Toggle() EndEventfunction Fly() if Player.IsRunning() posx = Player.GetPositionX() posy = Player.GetPositionY() posz = Player.GetPositionZ() bearing = Player.GetAngleZ() elevation = Player.GetAngleX() speed = 1000 if bearing < 90 posx += (bearing)*speed posy += (90 - bearing)*speed elseif bearing > 90 && bearing < 180 posx +=(180 - bearing)*speed posy +=(90 - bearing)*speed elseif bearing > 180 && bearing < 270 posx += (180 - bearing)*speed posy += (bearing - 270)*speed elseif bearing > 270 posx += (bearing - 360)*speed posy += (bearing - 270)*speed endif posz = Player.GetPositionZ() - (elevation*speed) Player.TranslateTo(posx,posy,posz,Player.GetAngleX(),Player.GetAngleY(),Player.GetAngleZ(),speed,1) if Player.IsSprinting() move = 0 endIf else Player.StopTranslation() endIfendFunctionEvent OnTranslationComplete() move = 0 Fly()endEventFunction Toggle() if (bVal == True) bIsOn = True elseif (bVal == False) bIsOn = False endif EndFunctionEvent OnEffectFinish(Actor Player, Actor Caster) Player.StopTranslation() SetIniFloat("fInAirFallingCharGravityMult:Havok",1.35) EndEventThe StopInstance does not stop the sound and thus my looping bat sound just keeps playing ingame. Much to my annoyance.