Non-Triggered Random Events?

Post » Thu Jun 21, 2012 4:48 am

Is there a way to create events that are not "triggered"?

This new mod I'm working on is set in a cave. I'm thinking it would be nice to occasionally have the "FXdustDropTriggerACT" effect send down dust every once in a while and scattered about.

Any ideas?

Thanks!
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Wed Jun 20, 2012 11:31 pm

I can't elaborate on this but I remember some error in the log concerning a vanilla script and by its very name I would assume it is what you are looking for,

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 playExplosion property FallingDustExplosion01 autoint chooser	; random FX choice integerfloat rndWaitTimer   ; we'll randomize how long we wait between FXbool on;===============================================event onLoad()on = truewhile 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)   endifendWhileendEventevent onUnLoad()on = falseendEvent
User avatar
Pixie
 
Posts: 3430
Joined: Sat Oct 07, 2006 4:50 am

Post » Thu Jun 21, 2012 3:38 am

I hate that script, it's always cluttering my script log with errors. Apparently because the dust drop effect or whatever doesn't have 3D and that gives off an error when trying to play a sound from it.
User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm

Post » Thu Jun 21, 2012 1:50 am

I hate that script, it's always cluttering my script log with errors. Apparently because the dust drop effect or whatever doesn't have 3D and that gives off an error when trying to play a sound from it.

Further to that and since the script is named after you :-)

Maybe someone can answer an off topic question. As a test of sorts I went into that script and changed the OnLoad() event to a OnCellLoad() event and compiled it creating a PEX file in the scripts folder. I would assume the game would pick it up and use it instead of the vanilla script. When loading the game it continued to throw the OnLoad() event and the errors within. So I changed it again and completely commented out the While loop and compiled it again leaving it to do nothing but assign ther bool values on load and unload. Loaded the game and it continued to throw errors for the OnLoad() event for actions contained in a completed commented out script. So does this mean any script cannot be changed in the middle of a savegame. I knew that the save retained some variables and such for uninstalled mods but entire scripts that have been changed?
User avatar
Shelby Huffman
 
Posts: 3454
Joined: Wed Aug 08, 2007 11:06 am

Post » Wed Jun 20, 2012 7:33 pm

Check the http://www.creationkit.com/Save_File_Notes_%28Papyrus%29. If a script is in the middle of a function call when the game is saved, then when the game is loaded, the old version of the script will continue to be used.

On second thought, all those errors in the script log that shows up for me is because the objects that the script is actually attached to aren't loaded. Since they aren't loaded, then http://www.creationkit.com/Play_-_Sound doesn't work with them.

This means there must have been something wrong with the http://www.creationkit.com/OnUnload_-_ObjectReference event. It was never called and so the "on" variable stayed true, leading to an infinite loop. The notes for it on the CK wiki says that using http://www.creationkit.com/OnCellDetach_-_ObjectReference is more reliable.
User avatar
Jessica Thomson
 
Posts: 3337
Joined: Fri Jul 21, 2006 5:10 am

Post » Thu Jun 21, 2012 9:34 am

Excellent, thank you. That completely clarifies for me. I would also assume that if I were to go to the location that contains the object listed in the error log that it would be possible to allow the script to end successfully and thus allow its replacement. Not that I would do that with a vanilla script but it helps big time to understanding how this VM works.

thanks again
User avatar
Cash n Class
 
Posts: 3430
Joined: Wed Jun 28, 2006 10:01 am


Return to V - Skyrim