David Brasher Posted February 19, 2012 Share Posted February 19, 2012 What should the code in the Papyrus fragment look like? Is there a trick to initializing a global variable? What exactly do you have to do besides writing the line of code correctly to make the script compile? Link to comment Share on other sites More sharing options...
scrivener07 Posted February 19, 2012 Share Posted February 19, 2012 Im no expert but Ive seen globals under Misc > Global. Make a new global object, give it a value. Not sure but you may also need to assign it a property.. or call it directly? Cant remember. Edit: Also thought I might add. Do not attempt to edit fragments outside the editor. I wasted a whole day of modding due to that. The fragments say DO NOT EDIT if you open them. The normal properties and compile buttons are on the fragment windows. Fragments are very "do it my way or I wont do anything" Link to comment Share on other sites More sharing options...
Mansh00ter Posted February 19, 2012 Share Posted February 19, 2012 You have to declare the global variable in the fragment, like this: GlobalVariable Property MyGlobalVariable Auto then make sure it is set to point to the correct global variable in the CK, via the properties panel. You can also declare there if you like. After that, you set the value of the global like this MyGlobalVariable.setValue(MyValue) and retrieve it's value like this MyValue = MyGlobalVariable.getValue() That's it! Oh, and you can edit fragments outside of editor (just make sure you know what you are doing), in fact I recommend going to the CK Wiki and following one of the external editor tutorials (I use Notepad ++) because that's much easier to use than the CK editor, that one is meant only for small, quick changes. Link to comment Share on other sites More sharing options...
David Brasher Posted February 19, 2012 Author Share Posted February 19, 2012 Thanks for the advice, but it is still not working for me. Your Suggestion:MyGlobalVariable.setValue(MyValue) My Papyrus fragment:AAMyFollow.SetValue(1) Details about my global variable:FormID: AAMyFollowProperty Name: AAMyFollerType: GlobalVariableValue: AAMyFollowResidence Location: A quest script attached to the quest in which the dialog info which the Papyrus fragment is attached to resides in. Compilation failure error message: Starting 1 compile threads for 1 files...Compiling "TIF__01001DA4"...c:\games\skyrim\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001DA4.psc(10,0): variable AAMyFollow is undefinedc:\games\skyrim\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001DA4.psc(10,11): none is not a known user-defined typeNo output generated for TIF__01001DA4, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on TIF__01001DA4 Link to comment Share on other sites More sharing options...
Mansh00ter Posted February 19, 2012 Share Posted February 19, 2012 You haven't declared AAMyFollow as a globalvariable. Also, global variables, as far as I know, can have only values of "short", "long" and "float", not string First you must create the global variable via the CK under globals, and give it it's unique ID (I assume you already did that). Then you declare it in the script with the following code: GlobalVariable Property AAMyFollow Auto IMPORTANT:Then navigate to your script location in the CK, click "Properties" and make sure that your Property AAMyFollow actually points to the GlobalVariable you created earlier (select it from the drop down list) - it will point automatically only if the name of the property being declared is same as the ID of the global variable (but I like to make sure anyway). Alternatively, you can both declare and point the property directly via the CK interface - I usually type the code because sometimes you want to declare a dozen properties and it's faster than clicking. Link to comment Share on other sites More sharing options...
Recommended Posts