Ez0n3 Posted August 22, 2013 Share Posted August 22, 2013 I was just playing around with the example on the wiki for Dynamically Attaching Scripts to Objects and I was wondering if it possible to detect when a script is attached to an object and also, when it gets detached? So far, OnInit seem to work for detecting when it gets attached, but is there any way to detect when the alias script stops affecting the object? EG: I was applying an Effect Shader to to some Acti's and Cont's and I wanted it to start the shader OnInit (PMS - BlockActivation), but how to stop it? What Event can I stick the SMS - UnBlockActivation into?Scriptname ShaderAliasScript extends ReferenceAlias EffectShader Property ObjShader Auto Event OnInit() EndEvent Auto State Waiting Event OnInit() Debug.Trace("Alias Script Attached") ObjectReference rSelfRef = GetRef() ObjShader.Play(rSelfRef) rSelfRef.BlockActivation(True) EndEvent Event ??? Debug.Trace("Alias Script Detached") ObjectReference rSelfRef = GetRef() ObjShader.Stop(rSelfRef) rSelfRef.BlockActivation(False) EndEvent EndStateThanks Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 22, 2013 Share Posted August 22, 2013 Alias scripts are stopped when the alias is removed or the quest is finished. You could, therefore, in theory set up a second quest that applies the script to the alias. On your main quest/scripting setup at the correct point, start the secondary quest so that the aliases do what you need, then when done stop the secondary quest. The objects should return to normal behavior. Link to comment Share on other sites More sharing options...
Ez0n3 Posted August 31, 2013 Author Share Posted August 31, 2013 Been tied up, thanks for the reply. I hadn't thought of setting up a 3rd "cleanup" quest. I might not end up needing to detect when it stops, I don't know yet. But now I know what to do if is it needed. ;) Thanks Link to comment Share on other sites More sharing options...
Recommended Posts