Jump to content

How do you replace a script that is running but won't finish?


wysiwyg

Recommended Posts

So if a script is running when you save a game and you try to replace the script Skyrim will use the original version from the save until the script exits, right?. What if it never exits because of an error or was written badly enough to always run and you can't stop it without updating it? If this happen will it create a situation where you can't update the running copy because it's still running and will always use the version from the save game?

 

Is there a way for force a running script to quit in the console?

 

Specifically, this old chestnut:

 

[09/12/2012 - 03:10:52PM] error: Object reference has no 3D

stack:

[ (0001E68C)].Sound.Play() - "<native>" Line ?

[ (000621D5)].fxDustDropRandomSCRIPT.OnLoad() - "<savegame>" Line ?

 

Well, I can fix the script but it never unloads because it doesn't seem unload the script after the error and just runs it again.

 

The original looks like this and sure. I could easily fix the script if I could get Skyrim to use the changed code in locations I already visited. It looks the script doesn't end after onLoad ends possibly because the statement with the error occurred after a timer. OnUnload never seems to get executed. Even if I replace OnLoad and OnUnload with OnCellAttach/OnUpdate/OnCellDetach the game keeps executing the old OnLoad forever every 10 seconds or so in the locations where it was originally run.

 

It's not just this script but in general I'd like to know if there is a way to forcibly unload a script and use a new version.

 

event onLoad()

on = true

while on == true
	chooser = RandomInt(1,3)	
	rndWaitTimer = RandomFloat(10.0, 30.0)
	wait(rndWaitTimer)
		if chooser == 1
			self.PlayAnimation("PlayAnim01")
			mySFX.play(self)
			wait(0.5)
			placeAtMe(FallingDustExplosion01)
			wait(3)
			self.PlayAnimation("PlayAnim02")
		elseif chooser == 2
			self.PlayAnimation("PlayAnim02")
			mySFX.play(self)
		elseif chooser == 3
			self.PlayAnimation("PlayAnim03")		
			mySFX.play(self)
		endif
endWhile		
endEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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