LoneRaptor Posted March 17, 2019 Share Posted March 17, 2019 okay so I'm using a separate activator (power Switch) to spawn in the teleport activator so its initially disabled. I'm doing this to give the illusion that there's "power" being used. Now for the Emitter sound and effects if I make 2 versions of the emitter 1 with sounds and effects and apply your script to the power switch activator would this work?I'm not sure i follow why would you need 2 emittors?Adding my script to the power activator will work.How did you do the power switch, are you just enabling/disabling the teleport activator. if so you can make it a toggle by adding an if statement that check if it is enabled to the onActivate this can then enable the activator and the effects as well as disabling everything again. Link to comment Share on other sites More sharing options...
Swat715 Posted March 17, 2019 Author Share Posted March 17, 2019 These effects don't require power. They are actually animations inside the nif for that model wich you can play using PlayGamebryoAnimation() you can do this by adding something like this to the activator: ObjectReference Property EmitterRef Auto ;fill this with the reference of the emittor EmitterRef.PlayGamebryoAnimation("stage3loop", True); place this inside the OnActivate event There are more than just this animation in the nif, you can find them using nifscope in the animation dropdown. then you can replace stage3loop with the name of the animation you would likeThis only plays the visual effects for sound effects you have to find the corresponding sound descriptor and play that at the same time as the animation using the following line: ;First add 2 more properties: Sound Property OBJTeleporterJammerLP Auto; you should be able to auto fill this Int Property SoundEffectIncetanceID Auto Hidden ; no need to fill this the script will do that, this will later be used to stop the sound effect SoundEffectIncetanceID = OBJTeleporterJammerLP.Play(EmitterRef);place this below the PlayGamebryoAnimation line Both the animation and the sound effect are looping so you'll have to stop them at some point. This can be done on a timer or using an activator when you want them to stop. To stop both use the following lines: Sound.StopInstance(SoundEffectIncetanceID) ;stops the audio loop EmitterRef.PlayGamebryoAnimation("stage1", True); stops the animation loop okay so I'm using a separate activator (power Switch) to spawn in the teleport activator so its initially disabled. I'm doing this to give the illusion that there's "power" being used. Now for the Emitter sound and effects if I make 2 versions of the emitter 1 with sounds and effects and apply your script to the power switch activator would this work? Here's the list of the references to help better understand. 00Custom_Swat715_PowerSwitch (Power Switch Activator: When activated Enables the Teleport activator and EmitterON to no longer be initially disabled. And Turns EmitterOFF to disabled.) 00Custom_Swat715_EmitterOFF ("Standard Emitter" [OFF] Initially Enabled, Disabled by Power Switch) 00Custom_Swat715_EmitterON ("Powered Emitter" [ON] Initially Disabled, Enabled By Power Switch. Will include Effects and sounds) 00CustomSwat715_Activator ("Teleporter Activator" Initially Disabled, Enabled by Power Switch) I'm terrible at explaining things so Hopefully this helps. Link to comment Share on other sites More sharing options...
LoneRaptor Posted March 17, 2019 Share Posted March 17, 2019 (edited) Here's the list of the references to help better understand. 00Custom_Swat715_PowerSwitch (Power Switch Activator: When activated Enables the Teleport activator and EmitterON to no longer be initially disabled. And Turns EmitterOFF to disabled.) 00Custom_Swat715_EmitterOFF ("Standard Emitter" [OFF] Initially Enabled, Disabled by Power Switch) 00Custom_Swat715_EmitterON ("Powered Emitter" [ON] Initially Disabled, Enabled By Power Switch. Will include Effects and sounds) 00CustomSwat715_Activator ("Teleporter Activator" Initially Disabled, Enabled by Power Switch) I'm terrible at explaining things so Hopefully this helps.There is no need to have those 2 emitters.Instead of enabling and disabling them you can create one emitter and activate/deactivate the effects on that.using the same activator: ObjectReference Property ActivatorRef Auto ;objectreference of the teleporter activator ObjectReference Property EmitterRef Auto ;objecreference of the emitter Sound Property OBJTeleporterJammerLP Auto;sound effects Int Property SoundEffectIncetanceID Auto Hidden ; no need to fill this the script will do that Event OnActivate(ObjectReference akActionRef) If ActivatorRef.IsDisabled();if the teleporter activator is disabled enable it ActivatorRef.Enable();enables the teleporter activator EmitterRef.PlayGamebryoAnimation("stage3loop", True);starts animation stage3loop SoundEffectIncetanceID = OBJTeleporterJammerLP.Play(EmitterRef);starts the sound effects ElseIf !ActivatorRef.IsDisabled();if the teleporter activator is enabled disable it ActivatorRef.Disable();disables the teleporter activator If SoundEffectIncetanceID ; checks if there is sound playing EmitterRef.PlayGamebryoAnimation("stage1", True); stops the animation Sound.StopInstance(SoundEffectIncetanceID) ;stops the audio loop EndIf EndIf EndEvent You could add in a global variable to store the power state if you need to know in another script or as a condition for certain effects. Edit: removed SoundEffectIncetanceID = None beacuse this won't work :facepalm: Edited March 17, 2019 by LoneRaptor Link to comment Share on other sites More sharing options...
Swat715 Posted March 17, 2019 Author Share Posted March 17, 2019 Here's the list of the references to help better understand. 00Custom_Swat715_PowerSwitch (Power Switch Activator: When activated Enables the Teleport activator and EmitterON to no longer be initially disabled. And Turns EmitterOFF to disabled.) 00Custom_Swat715_EmitterOFF ("Standard Emitter" [OFF] Initially Enabled, Disabled by Power Switch) 00Custom_Swat715_EmitterON ("Powered Emitter" [ON] Initially Disabled, Enabled By Power Switch. Will include Effects and sounds) 00CustomSwat715_Activator ("Teleporter Activator" Initially Disabled, Enabled by Power Switch) I'm terrible at explaining things so Hopefully this helps.There is no need to have those 2 emitters.Instead of enabling and disabling them you can create one emitter and activate/deactivate the effects on that.using the same activator: ObjectReference Property ActivatorRef Auto ;objectreference of the teleporter activator ObjectReference Property EmitterRef Auto ;objecreference of the emitter Sound Property OBJTeleporterJammerLP Auto;sound effects Int Property SoundEffectIncetanceID Auto Hidden ; no need to fill this the script will do that Event OnActivate(ObjectReference akActionRef) If ActivatorRef.IsDisabled();if the teleporter activator is disabled enable it ActivatorRef.Disable();disables the teleporter activator EmitterRef.PlayGamebryoAnimation("stage3loop", True);starts animation stage3loop SoundEffectIncetanceID = OBJTeleporterJammerLP.Play(EmitterRef);starts the sound effects ElseIf !ActivatorRef.IsDisabled();if the teleporter activator is enabled disable it ActivatorRef.Enable();enables the teleporter activator If SoundEffectIncetanceID ; checks if there is sound playing EmitterRef.PlayGamebryoAnimation("stage1", True); stops the animation Sound.StopInstance(SoundEffectIncetanceID) ;stops the audio loop SoundEffectIncetanceID = None ; clears the inctance property so the script knows there is no sound playing EndIf EndIf EndEvent You could add in a global variable to store the power state if you need to know in another script or as a condition for certain effects. Holy Crap Wasn't Expecting to see this that quickly lolI tried adding the script to the Power Switch Activator Script (Blank script) and it says compilation failed? Also what do you mean by store power state? Link to comment Share on other sites More sharing options...
LoneRaptor Posted March 17, 2019 Share Posted March 17, 2019 The compilation error is because I made a mistake in the script i posted the line: SoundEffectIncetanceID = None won't work because you can't set an int property to none. If you remove that line it should work.with store power state i mean create a global variable that you can then reference somewhere else to check if the power is on or not (default value = 0 when powered set it to 1)you can do this with NamOfGlobal.SetValue(1) to change it to 1. You can read the value with NameOfGlobal.GetValueInt() Link to comment Share on other sites More sharing options...
Swat715 Posted March 17, 2019 Author Share Posted March 17, 2019 (edited) The compilation error is because I made a mistake in the script i posted the line: SoundEffectIncetanceID = None won't work because you can't set an int property to none. If you remove that line it should work.with store power state i mean create a global variable that you can then reference somewhere else to check if the power is on or not (default value = 0 when powered set it to 1)you can do this with NamOfGlobal.SetValue(1) to change it to 1. You can read the value with NameOfGlobal.GetValueInt() Swat715_EmitterActivator\Swat715_EmitterActivator.psc(3,25): const scripts may only contain const auto properties. Property ActivatorRef cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(3,25): const scripts may not contain data, script variable ::ActivatorRef_var cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(4,25): const scripts may only contain const auto properties. Property EmitterRef cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(4,25): const scripts may not contain data, script variable ::EmitterRef_var cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(5,15): const scripts may only contain const auto properties. Property OBJTeleporterJammerLP cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(5,15): const scripts may not contain data, script variable ::OBJTeleporterJammerLP_var cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(6,13): const scripts may only contain const auto properties. Property SoundEffectIncetanceID cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(6,13): const scripts may not contain data, script variable ::SoundEffectIncetanceID_var cannot be defined Swat715_EmitterActivator\Swat715_EmitterActivator.psc(20,0): mismatched input 'EndEvent' expecting ENDIF No output generated for Swat715_EmitterActivator:Swat715_EmitterActivator, compilation failed. Edited March 17, 2019 by Swat715 Link to comment Share on other sites More sharing options...
LoneRaptor Posted March 17, 2019 Share Posted March 17, 2019 (edited) These errors are because the default script adds a const flag to the end of the scriptname (first line of the script) if you remove that it should work. Edited March 17, 2019 by LoneRaptor Link to comment Share on other sites More sharing options...
Swat715 Posted March 17, 2019 Author Share Posted March 17, 2019 These errors are because the default script adds a const flag to the end of the scriptname (first line of the script) if you remove that it should work. Scriptname Swat715_EmitterActivator:Swat715_EmitterActivator extends ObjectReference Const ObjectReference Property ActivatorRef Auto That one? and if so just the const or everything after? Link to comment Share on other sites More sharing options...
LoneRaptor Posted March 17, 2019 Share Posted March 17, 2019 Just remove the const but the rest after that should be on the next line Link to comment Share on other sites More sharing options...
Swat715 Posted March 17, 2019 Author Share Posted March 17, 2019 okay sweet that worked, gonna boot it up and give it a try! Link to comment Share on other sites More sharing options...
Recommended Posts