Jump to content

fxDustDropRandomScript


IsharaMeradin

Recommended Posts

It has already been reported that not all of the spam relating to this has been taken care of. #13847

In the comments of that bug tracker is a solution to the specific left behind spam using USKP's current script variation.

 

I wanted to share a new variation of the script that is based on the original that does not change the events used and still removes the associated spam.  However, I do have some questions first. These questions are targeted mainly to whomever devised the USKP's current solution.

 

What is the purpose in the change of events?  

Are there other errors that it resolves that I have not yet had the pleasure of seeing?

 

My suspected theories on the change of events in the current USKP script are that OnCellDetach and OnCellAttach may be considered more reliable than OnLoad and OnUnload.  And perhaps they were used because the dust did not drop again on another visit before the cell reset.  I tend not to revisit dungeons and such if I can help it which may be why such an issue has not been noticed by me.

 

Below is the script variation I mentioned earlier.

Scriptname fxDustDropRandomSCRIPT extends ObjectReference  
{Randomly fires the dust drop fx}

import debug				; import debug.psc for acces to trace()
import game					; game.psc for access to getPlayer()
import utility				; utility.psc for access to wait()
import sound				; sound.psc for access to play()


;===============================================
sound property mySFX auto	; specify SFX to play
Explosion property FallingDustExplosion01 auto
int chooser					; random FX choice integer
float rndWaitTimer			; we'll randomize how long we wait between FX
bool on
;===============================================
event onLoad()
	on = true
	while (on == true)
		chooser = RandomInt(1,3)	
		rndWaitTimer = RandomFloat(10.0, 30.0)
		wait(rndWaitTimer)
		If !(Self.Is3DLoaded())	;check for 3D - if no 3D change variable value and prevent loop from running again
			on = false
		ElseIf (Self.Is3DLoaded())	;check for 3D - if 3D process the loop and let loop again
			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
		EndIf
	endWhile		
endEvent

event onUnLoad()
	on = false
endEvent 
 

 

P.S.  It matters not to me what script is used in the USKP.  I did the above script as a learning exercise and my questions are intended to help me to learn more.  There is no negativity of any kind meant to be intended or implied.  Apologies ahead of time should any part be taken in such a manner.

 

 

Link to comment
Share on other sites

Those events were changed because OnLoad and OnUnload are horribly unreliable. That's how they got stuck to begin with.

 

The other problem is that even with the change, the old script will not get displaced. People will still see the spam from all the old versions until going back to revisit those locations. They do clear out though once you have, I've tested that much, and with what's in the USKP now I've never seen it start spamming again.

 

Your script would produce the same result assuming the OnLoad/OnUnload pairing was reliable.

 

Bethesda's own Papyrus documentation says they're not reliable so when situations like this come up that's why they get changed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...