Scriptname VolkiharTestingButton extends ObjectReference{A button to test adding an ability to the player through scripting}Event OnActivate(ObjectReference akActionRef) Game.GetPlayer().AddSpell(VolkiharBloodEuphoria01) Debug.MessageBox("Added Blood Euphoria I!")endEventSpell Property VolkiharBloodEuphoria01 Auto
Now, this code snippet works flawlessly. However, when I attempt to add the same function call, Game.GetPlayer().AddSpell(VolkiharBloodEuphoria01) to the VampireFeed() function of PlayerVampireQuestScript, nothing happens. I've tested adding a debug dialogue box to the same function, which DOES work for some reason, but nothing I've tried has allowed the spell effect to actually apply to the player upon feeding.
My question is this: what could cause the function call to fail in one instance but succeed in another, when the script is being compiled properly and is apparently otherwise functional?
For completeness, the entire VampireFeed() function:
Spoiler
Function VampireFeed() ; Volkihar Mod modifications -------------------------------------------------- ; Testing a direct reference to see whether that's causing this to fail Actor Player = Game.GetPlayer() Player.AddSpell(VolkiharBloodEuphoria01) Debug.MessageBox("Adding blood euphoria I! Volkihar age: "+VolkiharAge) ; End Volkihar mod modifications -------------------------------------------------- ;Effects for hiding the change ;VampireChangeFX.play(game.getPlayer()) VampireTransformDecreaseISMD.applyCrossFade(2.0) utility.wait(2.0) imageSpaceModifier.removeCrossFade() ;VampireChangeFX.stop(game.getPlayer()) Game.IncrementStat( "Necks Bitten" ) VampireFeedMessage.Show() VampireFeedReady.SetValue(0) ;Game.ForceThirdPerson() ;Game.GetPlayer().PlayIdle(VampireFeedingBedRight) ;Player has fed, regress to Stage 1 Vampirisim ;Remove Stage 2, 3, and 4 buffs and spells LastFeedTime = GameDaysPassed.Value VampireStatus = 1 VampireProgression(Game.GetPlayer(), 1) ;Player is no longer hated Game.GetPlayer().RemoveFromFaction(VampirePCFaction) Game.GetPlayer().SetAttackActorOnSight(False) int cfIndex = 0 while (cfIndex < CrimeFactions.GetSize()); Debug.Trace("VAMPIRE: Removing enemy flag from " + CrimeFactions.GetAt(cfIndex)) (CrimeFactions.GetAt(cfIndex) as Faction).SetPlayerEnemy(false) cfIndex += 1 endwhile ;Start checking GameTime again if we weren't already UnregisterforUpdateGameTime() RegisterForUpdateGameTime(12) EndFunction