YaBoyChrisB Posted September 14, 2019 Share Posted September 14, 2019 Hi, So I'm working on some test scripts for a new mod project and I've run into some scripting issues. Now, I'm definitely not the best when it comes to scripting so I could use some help here. Basically, I'm trying to use global variables in an esm to connect choices made in different esp files. The test I have setup is simply kill npc in first esp>enable table in second esp. There's a script connected to the npc that's a simple OnDeath event that changes the global variables' value on death, then the table has a script that's meant to enable the table when it reads that the global variable value has changed. Here's the npc's script that (at least to my knowledge) works fine: Scriptname NPCTestScript extends Actor Const GlobalVariable Property GlobalTest Auto Const Actor Property TestNPC Auto Const Event OnDeath(Actor akKiller) if (akKiller == Game.GetPlayer()) GlobalTest.SetValue(1) endif EndEvent Here's the table script. It gives me an error saying "missing EndOfFile at 'if'" when I compile: Scriptname TableTestScript extends ObjectReference Const ObjectReference Property TestTable Auto Const GlobalVariable Property GlobalTest Auto Const if GlobalTest.GetValue()==1 TestTable.enable() endif Like I said, I'm not the best with scripting so any help would be much appreciated! Link to comment Share on other sites More sharing options...
SKKmods Posted September 14, 2019 Share Posted September 14, 2019 You need to wrap the TableTestScript If .. Endif test in a Function that is called by a trigger event, or a trigger event. Consider what should trigger the TableTestScript to run the if test ? Also to avoid having a hard master relationship between esp files, using GetFormFormFile() on the GlobalTest variable is best. Link to comment Share on other sites More sharing options...
YaBoyChrisB Posted September 14, 2019 Author Share Posted September 14, 2019 On 9/14/2019 at 5:35 PM, SKK50 said: You need to wrap the TableTestScript If .. Endif test in a Function that is called by a trigger event, or a trigger event. Consider what should trigger the TableTestScript to run the if test ? Also to avoid having a hard master relationship between esp files, using GetFormFormFile() on the GlobalTest variable is best. Could you show me an example? I've tried triggering with an event but it says that it can't be defined because the script isn't native. Thanks for the reply though! Link to comment Share on other sites More sharing options...
SKKmods Posted September 14, 2019 Share Posted September 14, 2019 What typeof ObjectReference are you attaching the script to ? Link to comment Share on other sites More sharing options...
YaBoyChrisB Posted September 14, 2019 Author Share Posted September 14, 2019 ObjectReference Const Link to comment Share on other sites More sharing options...
SKKmods Posted September 14, 2019 Share Posted September 14, 2019 Yes we can see that from the script, the question is: what is the base object ... container, furniture, actor, weapon ... ? Link to comment Share on other sites More sharing options...
YaBoyChrisB Posted September 15, 2019 Author Share Posted September 15, 2019 Ah I gotcha. Furniture. Standard static table mesh. Link to comment Share on other sites More sharing options...
payl0ad Posted September 15, 2019 Share Posted September 15, 2019 (edited) Standard static tables are not "Furniture" in Creation Engine terms. Furniture is (generally) interactable, tables are statics. You need to tell us what "record type" your object is of, a 4-letter-all-caps short handle. Furniture objects are FURNs, pickable plants are FLORs, statics are STATs, ... this is what SKK50 wants to know. Edited September 15, 2019 by payl0ad Link to comment Share on other sites More sharing options...
YaBoyChrisB Posted September 15, 2019 Author Share Posted September 15, 2019 OH! Yeah sorry I've been out of the CK for awhile now and some things have escaped me. it's a STAT. Link to comment Share on other sites More sharing options...
SKKmods Posted September 15, 2019 Share Posted September 15, 2019 Thats it, you see different base objects have different script events that can be used as triggers to run your evaluation. Lets simplfy to break through the confiusion, getting stuck into code at this level of comprehension is doomed to frustration. Talk us through the sequence of events and interactions between the actors and objects that shuld cause your script to trigger. Link to comment Share on other sites More sharing options...
Recommended Posts