MarchUntoTorment Posted November 20, 2014 Share Posted November 20, 2014 Hello all, I'm very new to scripting, although not to modding as a whole. I'm looking to create a script that will enable a crate containing a set of armour when, and only when, a certain stage in a certain quest is reached. The crate is, by necessity, located in a location traversed a few times prior, and I don't want the crate appearing then. The intention is to place a Primitive Form at the entrance to the building, and have the form check the player for the necessary variable each time. Of course, given how abysmal I am with scripting, I'm not getting anywhere - it's refusing to save (I assume because there's an error in it), and I don't know why.Please help! SCN UniqueTeslaCrateScript BEGIN OnTriggerEnter player If GetStage MQ11 == 50 Enable UniqueTeslaArmorCrate Else If GetStage MQ11 == 60 Enable UniqueTeslaArmorCrate Else Disable UniqueTeslaArmorCrate EndIf END Could someone please tell me what I'm doing wrong here? Any help would be much appreciated :) Best regards, - MarchUntoTorment Link to comment Share on other sites More sharing options...
Ladez Posted November 20, 2014 Share Posted November 20, 2014 You're missing an EndIf statement. Every If statement, without exception, must be accompanied by a closing EndIf statement. You're using Enable and Disable wrong. First, they are reference functions and need to be called directly on a reference using dot notation, like this: UniqueTeslaArmorCrateREF.Enable. Second, you need to use the editor ID of the reference you've placed in the world, not the editor ID of the base form. Reference forms do not have an editor ID by default, you need to give it to them. Third, the reference need to be persistent for the script to use it. Link to comment Share on other sites More sharing options...
MarchUntoTorment Posted November 21, 2014 Author Share Posted November 21, 2014 (edited) Thanks for the advice, Ladez! Anyway, I followed your advice - double-clicked on the placed object and gave it a reference, then checked 'persistent reference'. I also followed your instructions with relation to how to make it work. However, most likely because I'm an idiot, it's still not working. Here's the revised script: SCN UniqueTeslaCrateScript BEGIN OnTriggerEnter player If GetStage MQ11 == 50 OR If GetStage MQ11 == 60 UniqueTeslaArmorCrateREF.Enable EndIf Else UniqueTeslaArmorCrateREF.Disable END Any idea what's still wrong? I think I followed your instructions right... I tried putting the Else inside my If block, but that didn't get me anywhere. Help would be greatly appreciated! Edited November 21, 2014 by MarchUntoTorment Link to comment Share on other sites More sharing options...
Ladez Posted November 21, 2014 Share Posted November 21, 2014 (edited) There's no such thing as OR, the correct expression is || (two vertical lines. Similarly, in place of AND you would have to use &&.)The first If denotes everything down to the closing EndIf as an if-block, so using If again is incorrect.Fixing those two things should allow you to move the else-block inside the if-block where it belongs. SCN UniqueTeslaCrateScript BEGIN OnTriggerEnter player If GetStage MQ11 == 50 || GetStage MQ11 == 60 UniqueTeslaArmorCrateREF.Enable Else UniqueTeslaArmorCrateREF.Disable EndIf END Edited November 21, 2014 by Ladez Link to comment Share on other sites More sharing options...
MarchUntoTorment Posted November 21, 2014 Author Share Posted November 21, 2014 Thank you for your help, Ladez! The advice you provided was invaluable. I ended up changing the function to GetStageDone, though, to make my life a little easier. Nonetheless, it works perfectly! Naturally, I'll credit you when the mod goes up :) Link to comment Share on other sites More sharing options...
Ladez Posted November 21, 2014 Share Posted November 21, 2014 Glad to be of help. :) Link to comment Share on other sites More sharing options...
Recommended Posts