Elbethien Posted January 1, 2015 Share Posted January 1, 2015 (edited) Hey I made some changes to Mr pwners marihuana mod. I wanted a color-changing sky (a static flat mesh with animated textures) to move to player, when ever the marihuana effects hit.That woks so far, but I can't get it to move back to where it came from. I created a new interior cell, put my sky mesh with a persistent ref (colorskyRef) + a Xmarker with a persistent ref (colorskyxmarkerRef) in it. "ColorskyRef.moveto player" works fine.But when the script ends, I use the command "colorskyRef.moveto colorskyxmarkerRef" and nothing happens in game.The colorful sky stays.I looked into other mods that have unsummon functions and can't see any difference.What might it be I'm doing wrong? Edit:Ok I found something that works for now. When effect starts:"colorskyRef.enable""ColorskyRef.moveto player" and when the effect ends:"colorskyRef.disable" But is that good?I'm not sure what disable really does. Edited January 1, 2015 by Elbethien Link to comment Share on other sites More sharing options...
IkeCoast Posted January 1, 2015 Share Posted January 1, 2015 The "disable" function simply tells the engine to erase the involved "object" from the world and ignore any other call to it unless an "enable" function is called. It can cause CTD because if a disabled object or actor is later required by another script, the game will not automatically re-load it from the resources, instead it will detect that the object is no longer present, fail to run the current script, and voilà, CTD. But, since your script starts with the "enable" function, you should be safe from CTDs with it, because next time you go high, the game will not "expect" the colorful sky to be already there, it will directly load it before starting the trip. I am not a good scripter, so I could be wrong, but I think your solution is elegant and effective. Cheers! Link to comment Share on other sites More sharing options...
Elbethien Posted January 1, 2015 Author Share Posted January 1, 2015 Thank you very much for your answer! Well, as you explain it, it really seams to be ok to use enable/disable.It also works, so I think I can stick with that. Thanks again :) Link to comment Share on other sites More sharing options...
forli Posted January 1, 2015 Share Posted January 1, 2015 (edited) Don't know if it's true, as in my mod I use Disable on an actor and few frames later I use Kill without CTD.Also, a disabled actor/activator can still cast spell with the "Cast" command (which is what most mods do when they need to cast a spell from an invisible source) Edited January 1, 2015 by forli Link to comment Share on other sites More sharing options...
Elbethien Posted January 2, 2015 Author Share Posted January 2, 2015 Wouldn't that mean that my animated mesh is still there, just invisible? That is not good :( Link to comment Share on other sites More sharing options...
Recommended Posts