Jump to content

[LE] Set Value of a Global Variable within Dialogue


Recommended Posts

I am attempting to change the value of a custom global variable within the ending fragment of some dialogue spoken with an NPC, but keep getting met with error calls.

 

The fragment is set like this:

 

MyCustomGlobal.SetValueInt(1)

 

The CK reports that the "vairiable MyCusomGlobal is undefined" and that "none is not a known user-defined type".

 

I cannot edit the properties of the script because a totally different error pops up saying that something is wrong and the operation failed.

 

There must be one heck of a difference between Skyrim's Creation Kit and Fallout 4's, because this exact script wording works fine within the latter's version of the CK.

 

- - - - -

 

If this was Fallout 4's CK, then I would have to do this:

 

1. Place this within the ending script fragment:

 

MyCustomGlobal.SetValueInt(1)

 

2. Click Properties.

 

3. Create Property from form

 

4.Type Global Variable:

 

MyCustomGlobal

 

5. Property Name - it will add a P, remove it.

 

6. Hit Compile

 

- - - - -

 

So what am I missing here? What hoops do I have to jump through in order to achieve the same effect in Skyrim's CK?

Edited by Lollia
Link to comment
Share on other sites

First, you need to create your global variable. In the Creation Kit, you can do that under miscellaneous / global. Then in your dialogue fragment, you need to add that property to it. Choose the Add Property button, choose GlobalVaraible type and name it the same as the globalVariable you made. Once the property is added, then you should be able to use it in your dialgoue script fragement.

Link to comment
Share on other sites

First, you need to create your global variable. In the Creation Kit, you can do that under miscellaneous / global. Then in your dialogue fragment, you need to add that property to it. Choose the Add Property button, choose GlobalVaraible type and name it the same as the globalVariable you made. Once the property is added, then you should be able to use it in your dialgoue script fragement.

 

We meet again, dylbill! :happy:

 

That's the part where I am caught, though. The global has already been created. And even though the name is typed correctly into the script, it throws those same errors at me. As also mentioned, the Properties tab refuses to open at all. It claims that there's an error with the script and closes out. I am utterly befuddled.

 

- - - - -

 

Edit 1: I just tried this out with another new global variable, and the process is repeating itself. I receive a "Script Reload" error whenever trying to open the script's Properties: "Errors encountered while attempting to reload the script".

 

- - - - -

 

Edit 2: The CK is still very unhappy, but I did manage to get the Add Property to finally work (had to exit and restart). Here are my new errors once the global is added via Add Property:

 

Missing SCRIPTNAME at 'GlobalVariable'

 

require (...) + loop did not match anything at input 'Property'

 

mismatched input '\\r\\n' expecting STATE

 

filename does not match script name: globalvariable

 

I will note this: Upon clicking the OK button of the list of Papyrus Errors, no properties are listed when looking at the actual Properties screen.

 

- - - - -

 

Edit 3: Did everything all over again in a different dialogue box, and it actually TOOK IT. :wallbash: :psyduck: :wallbash:

 

Going to go test in-game real quick.

 

 

- - - - -

 

Edit 4: It worked. Everything triggered correctly. :mellow:

 

 

Can you tell that I am currently staring at the Creation Kit with a very stony expression? I'm comparing all the dialogue boxes, scripts and property components--everything is written exactly the same! Yet one works and one does not. Current theory: random script corruption.

 

Seriously. WHAT IS THE DEAL? Fickle, fickle creature!

 

77598a5a54e24622b4b8071e8f453962.gif

 

 

- - - - -

 

*breathes deeply*

 

Thank you for trying to help, dylbill.

Edited by Lollia
Link to comment
Share on other sites

No problem, glad you got it working though. Yeah if a dialogue fragment gets errors like that, sometimes it's impossible to fix without creating a new one as you discovered. The CK can be real frustrating at times.

Link to comment
Share on other sites

Did you set your script command as a comment before adding the property? ie ;MyCustomGlobal.SetValueInt(1)

 

Then the CK doesn't get a chance to try and compile before you have added the property. Compile after the property is added then remove the semi-colon and compile again.

 

You can make it work without doing this but the CK can throw a hissy fit.

Link to comment
Share on other sites

Did you set your script command as a comment before adding the property? ie ;MyCustomGlobal.SetValueInt(1)

 

I should have done that from the beginning, I can see that now. It all seems a bit backwards, considering that FO4's CK just lets you create the script and jump right into setting the Properties without anything extra. Ah, well. Lesson learned! :happy:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...