Jump to content

Scripting help needed - Vampire lord revert fix not working!


TheLordofNyrin

Recommended Posts

I've been trying to fix this issue for a while now and I am close to solving this issue once and for all. I have made a custom race mod that will not properly revert my character back from a vampire lord. When the character changes back they are not in the proper race: customracevampire and are forced into just the normal mortal one: customrace. I've been trying to make a script to force it to change you into the proper race the moment the revert effect for the vampire lord transformation ends. The script I wrote below does compile however it does not work. So far to my knowledge, The script is not activating at all. I NEED this to work soon as I am overdue for posting this mod up on the nexus and this is the LAST thing stopping me from uploading it without any major issues. Any help given or advice on things to try is wanted.

scriptName ChocolateVampireLordFixScript extends ActiveMagicEffect
{This script fixes an issue with chocolate characters incorrectly reverting into a mortal instead of a vampire after transforming into vampire lord}

import debug
import game

Race Property ChocolatianRace Auto
Race Property ChocolatianRaceVampire Auto
MagicEffect Property RevertEffect Auto


EVENT OnMagicEffectApply(ObjectReference akCaster, MagicEffect RevertEffect)
	
	Actor player = Game.GetPlayer()
	akCaster = player

	IF player.HasMagicEffect(RevertEffect)
		Debug.Trace("Player is reverting from vampire lord, registering for update")
		RegisterForSingleUpdate(0.5)
	ELSE
		;player is not reverting from vampire lord. Bailing Out!
	ENDIF
ENDEVENT

EVENT OnUpdate()
	
	Actor player = Game.GetPlayer()
	
	IF player.HasMagicEffect(RevertEffect)
		Debug.Trace("Player is still reverting, waiting .5 seconds then testing again")
		Utility.Wait(0.5)
		RegisterForSingleUpdate(0.5)
	ELSE
		;Player no longer has the revert effect, check to see if the fix is needed.
		Debug.Trace("Player is no longer reverting, checking to see if fix is needed")
		
		IF player.GetRace() == ChocolatianRace
			Debug.Trace("Player is not in the proper vampire race! Applying Revert fix!")
			player.SetRace(ChocolatianRaceVampire)
			;register for update one more time to make sure fix worked.
			RegisterForSingleUpdate(0.5)
		ELSEIF player.GetRace() == ChocolatianRaceVampire
			Debug.Trace("Player is in the proper vampire race! Revert fix is not needed!")
			UnregisterForUpdate()
		ELSE
			Debug.Trace("Player is not a Chocolatian. Bailing Out")
			UnregisterForUpdate()
		ENDIF
	ENDIF
ENDEVENT
Link to comment
Share on other sites

  • Recently Browsing   0 members

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