Aintiarna Posted August 19, 2015 Share Posted August 19, 2015 (edited) The following script is attached to a magical effect that is run by a lesser power. It summons a custom vampire follower I created and works flawlessly 39 times out of 40. 1 time in 40 it causes a CTD and I cannot figure out why. There is nothing relevant in the papyrus logs despite me putting lots of debugging code in (which I've removed for readability). The magical effect gets as far as applying the image space modifier, then CTD. i.e. none of the special effects in the script show on screen, just the imod defined in the base magical effect. Anyone have a clue why it's breaking? Thanks. Scriptname TMMSummonFollowerScript extends ActiveMagicEffect ;Fade in visual Effects for actorEffectShader Property DLC1VampireBatsReformFXS autoEffectShader Property DLC1VampireBatsReformBATSFXS auto ; Add BatsActivator Property DLC1VampLordBatsFXActivator autoObjectReference MyBatsFXObjectRef= None ; Reference to NPC to summon.Actor Property FollowerToSummon autoEvent OnEffectStart(Actor akTarget, Actor akCaster)Actor actorRef = FollowerToSummon as Actor ;Where to place NPCFloat afDistance = 150.0Float afZOffset = 0.0 ; keep the bats effect tracking the actorFloat fTranslationSpeed = 512.0; simple counterInt aiStage = 0 ; Make sure actor isn't disabled.if actorRef.IsEnabled() While aiStage < 7 aiStage += 1 If aiStage == 1 ; disable the actor before moving them actorRef.DisableNoWait(true) ElseIf aiStage == 2 ; Move the actor in front of the player actorRef.MoveTo(akCaster, Math.Sin(akCaster.GetAngleZ()) * afDistance, Math.Cos(akCaster.GetAngleZ()) * afDistance, afZOffset) ElseIf aiStage == 3 ; Play special effects and re-enable the actor MyBatsFXObjectRef = (actorRef.placeatme(DLC1VampLordBatsFXActivator)) MyBatsFXObjectRef.EnableNoWait(false) actorRef.EnableNoWait(false) DLC1VampireBatsReformFXS.Play(actorRef, 0.2) DLC1VampireBatsReformBATSFXS.Play(actorRef, 0.2) ElseIf aiStage == 4 ; Translate bats with actor MyBatsFXObjectRef.TranslateToRef(actorRef,fTranslationSpeed,1) ElseIf aiStage == 5 MyBatsFXObjectRef.TranslateToRef(actorRef,fTranslationSpeed,1) ElseIf aiStage == 6 MyBatsFXObjectRef.TranslateToRef(actorRef,fTranslationSpeed,1) Endif Utility.Wait(0.6) EndWhile ; clean up MyBatsFXObjectRef.disable() MyBatsFXObjectRef.delete() MyBatsFXObjectRef = NoneEndIf EndEvent Edited August 19, 2015 by tirnoney Link to comment Share on other sites More sharing options...
cdcooley Posted August 20, 2015 Share Posted August 20, 2015 You're trying to play effects on an actor but also used EnableNoWait. My experience is that trying to do anything graphical without checking that the 3d is fully loaded either results in failure (but there might be situations where it could cause a crash). Try playing the DLC1VampireBatsReformFXS and DLC1VampireBatsReformBATSFXS effects on the MyBatsFXObjectRef instead of ActorRef. If that isn't possible then try waiting for the 3D of the actorRef to be loaded before you apply those two effects. Link to comment Share on other sites More sharing options...
Aintiarna Posted August 20, 2015 Author Share Posted August 20, 2015 I seem to have fixed it but not with that enablenowait. I changed the DisableNoWait on the actor before moving at the start of the script to disable(false) and it stopped the problem. So far. Thanks anyway. I hope it lasts. Link to comment Share on other sites More sharing options...
morismark Posted January 3, 2021 Share Posted January 3, 2021 (edited) I'm sorry it's past so many years, I have a teleport script with pyrotx [/size]Sky Ai Teleporting NPCs at Skyrim Nexus - Mods and Community with him permission, that cause CTD. But your strings script are different from pyrotx one. Scriptname teleportability extends activeMagicEffectimport GameImport Utility;=========================================================================================; PROPERTIES;============================Activator property teleportActivator Auto{The activator that will be placed and teleported to}Activator property TeleportFXStart Auto{The Fx that will be placed before teleporting}Activator property TeleportFXFinish Auto{The Fx that will be placed after teleporting}Int Property TeleportChance = 20 Auto{The Chance that an NPC will be able to use this ability (Default 20) + 2/3's of the NPC's Level}Int Property TeleportChanceHit = 60 Auto{If allowed to teleport at all, this is the chance to be allowed to teleport by being hit (Default 60)}Int Property TeleportChanceTimed = 60 Auto{If allowed to teleport at all, this is the chance to be allowed to teleport on a timer (Default 60)}Int Property CountMin = 3 Auto{Minimum number of times the script updates before teleporting (Default 3)}Int Property CountMax = 7 Auto{Maximum number of times the script updates before teleporting (Default 7)}Int Property HitCountMin = 2 Auto{Minimum number of hits until teleport (Default 3)}Int Property HitCountMax = 7 Auto{Maximum number of hits until teleport (Default 7)}Float Property UpdateTime = 2.5 Auto{How often the script updates (Default 2.5 seconds)}Float Property fRadius = 2048.0 Auto{Radius to search for a teleport point (2048.0 Auto)}Bool Property bTimebased = True Auto{Allows user to teleport after the script updates a certain number of times. (Default True)}Bool Property bHitbased = True Auto{Allows user to teleport after being hit a certain number of times. (Default True)};=========================================================================================; VARIABLES;============================ObjectReference ActivatorRefObjectReference casterRefObjectReference FXStartLocObjectReference FXFinishLocObjectReference targetLocactor casterint RandTeleportint RandTeleportHitint RandTeleportTimedint hitCountint updateCounterint teleportTimedint teleportHitint level;=========================================================================================; EVENTS;============================Event OnEffectStart(Actor akTarget, Actor akCaster)caster = akCastercasterRef = (caster as ObjectReference)level = (caster.getLevel() * 2/3)RandTeleport = Utility.RandomInt(0,100)if RandTeleport <=(TeleportChance + (level as Int))ActivatorRef = casterRef.placeAtMe(teleportActivator)RandTeleportHit = Utility.RandomInt(0,100)RandTeleportTimed = Utility.RandomInt(0,100)if RandTeleportHit <= TeleportChanceHitbHitBased = trueelseIf RandTeleportHit > TeleportChanceHitbHitBased = falseendIfif RandTeleportTimed <= TeleportChanceTimedbTimeBased = trueelseIf RandTeleportTimed > TeleportChanceTimedbTimeBased = falseendIfif bTimeBased == trueupdateCounter = 0teleportTimed = Utility.RandomInt(CountMin, CountMax)endIfif bHitBased == truehitCount = 0teleportHit = Utility.RandomInt(HitCountMin, HitCountMax)endIfif bHitBased == True || bTimeBased == TrueregisterForSingleUpdate(0.5)endIfendIfEndEventEvent OnUpdate()ActivatorRef = casterRef.placeAtMe(teleportActivator)if caster.isInCombat() && caster.isDead() == falseif bTimeBased == TrueupdateCounter+= 1If updateCounter >= teleportTimedTeleport()updateCounter = 0teleportTimed = Utility.RandomInt(CountMin, CountMax)endifendIfActivatorRefregisterForSingleUpdate(UpdateTime)endIfEndEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if bHitbased == TrueHitCount += 1if HitCount >= TeleportHitTeleport()HitCount = 0if updateCounter != 0updateCounter -= 1endIfteleportHit = Utility.RandomInt(HitCountMin, HitCountMax)endIfendIfEndEventFunction Teleport()targetLoc = Game. FindRandomReferenceOfTypeFromRef(TeleportActivator, casterRef, fRadius)FXStartLoc = casterRef.placeAtMe(TeleportFXStart)FXFinishLoc = targetLoc.placeAtMe(TeleportFXFinish)FXStartLoctargetLocFXFinishLoccasterRef.moveTo(targetLoc)EndFunction Edited January 3, 2021 by morismark Link to comment Share on other sites More sharing options...
Recommended Posts