Faerthorn35 Posted October 7, 2014 Share Posted October 7, 2014 I have a question concerning scripting. I'm currently workng on a mod and tyring to figure out how to make a basic script that will allow me to enable or disable an object when a quest is run. I've watched some tutorials, and I have no issues enabling - disabling things using triggerboxes that the player activates, but for the purposes of my mod, I need a script that will disable - enable objects only when a certain quest is running, without the usage of an external activator, like a trigger box or a timer etc. I plan to use the condition options of the quest itself to determine when the object is modified, I just can't figure out the scripting side of things. Any help with this problem would be greatly appreciated. Link to comment Share on other sites More sharing options...
GreyFox77 Posted October 7, 2014 Share Posted October 7, 2014 Can't you just use the Papyrus Fragment attached to the Quest Stages? This way you could use 2 different Quest Stages (make sure to check Allow Repeated Stages in the Quest Data tab) to run a certain script for each stage. These scripts would then have the things to enable or disable as Properties. (If there are many, I would recommend setting an Enable Parent - open the References in the Editor, go to Enable Parent tab and link them all to one object. Then set only that object as Property in the quest scripts - when you enable/disable that one Reference, all the linked References will do the same) Link to comment Share on other sites More sharing options...
Faerthorn35 Posted October 7, 2014 Author Share Posted October 7, 2014 (edited) Thank you for your reply GreyFox77. That is exactly what I intend to do. I know that I can use an xmarker and link it to the objects so that when it is enabled / disabled so are they. My issue is I can't figure out how to write the script itself that I would attach as a fragment on the quest. From the tutorials I've read, I assume that I will have to use some kind of "event" in the script before I write the line to disable - enable. I found the script below on a forum post last night, but it relies on a trigger box as the activator. Scriptname MyscriptName extends ObjectReference ObjectReference Property MyObject auto Event OnTriggerEnter(ObjectReference akActionRef) MyObject.enable()EndEvent What I'm trying to figure out is how to get rid of the need for the triggerbox so that it would look something like this. Scriptname MyscriptName extends ObjectReference ObjectReference Property MyObject auto Event MyObject.enable()EndEvent After further research, I am wondering if I could use this Event OnInit() Scriptname MyscriptName extends ObjectReference ObjectReference Property MyObject auto Event OnInit() RegisterForSingleUpdate(2.0) MyObject.enable()EndEvent I haven't tried to compile the OnInit() script yet, but I will update this post later today with the results. Edited October 7, 2014 by Faerthorn35 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 7, 2014 Share Posted October 7, 2014 Script fragments such as what are found on the various quest stages do not use events. Such quest stage fragments automatically run when that quest stage starts. So all you need is to add the property that points to the object being enabled then use that variable to call the enable & disable functions. One thing to note, properties for script fragments cannot be added until after the script has been created. Since the script name for script fragments is automatically generated you'll need to enter a commented line in order to compile/save the script before you can add any needed properties. Link to comment Share on other sites More sharing options...
Faerthorn35 Posted October 7, 2014 Author Share Posted October 7, 2014 (edited) Thank you very much IsharaMeradin for your reply and clarification. I am new to scripting and I just assumed that an event would be required in order to facilitate any kind of change. I am headed off to work on this right now, and I will update this post with the outcome. I'm still working / testing this out, but it looks like the above suggestions are going to solve my problem. Thanks again to both of you for your replies. Edited October 8, 2014 by Faerthorn35 Link to comment Share on other sites More sharing options...
Recommended Posts