Jump to content

MCM menu white extending ObjectReference


Archey6

Recommended Posts

Since I can't extend ObjectReference and SKI_ConfigBase how would I go about having a MCM that changes a variable that has to do with the ObjectReference? I could create a second script for MCM, but then it wouldn't have access to the variable in the initial script.

 

Any suggestions are welcome

 

Thanks,

Archey

Link to comment
Share on other sites

Maybe I'm misunderstanding... but can't you have an ObjectReference property in your MCM script, pointed at the ObjectReference in question, and access it through that?

 

e.g.

ObjectReference Property myRef auto
.
.
.
(myRef as MyRefScript).InternalProperty = SomeValue

and of course having InternalProperty defined in the ObjectReference script as a property... I mean, after all, isn't that what papyrus and properties are all about?

Edited by Vamyan
Link to comment
Share on other sites

Use a Global Variable (GV). GV's are numerical but you can assign other variables specific values depending upon the value of the GV. The MCM interface is a good alternative to the console for modifying a GV in-game.

 

I've been playing around with them, but when i changed it in the console, to test my script, my script doesnt seem to pickup the change, this is my script

Scriptname TestVar   extends quest
 
Import Form
 
GlobalVariable Property TestGlobal auto
 
Event OnInit()
    RegisterForUpdate(0.1)
EndEvent
 
Event OnUpdate()
    float test = TestGlobal.Getvalue()
 
    if(test == 1.0)
        Debug.MessageBox("IT WORKS;;;;")
    EndIf
EndEvent

the script works fine in that the message box will show up without the if statement, but even if i change the global var in the console, the script doesnt detect the change

 

Maybe I'm misunderstanding... but can't you have an ObjectReference property in your MCM script, pointed at the ObjectReference in question, and access it through that?

 

e.g.

ObjectReference Property myRef auto

.

.

.

(myRef as MyRefScript).InternalProperty = SomeValue

and of course having InternalProperty defined in the ObjectReference script as a property... I mean, after all, isn't that what papyrus and properties are all about?

What im trying to do is have two scripts, one for the actual script, the other for the MCM config menu, since the initial script is extending ObjectReference. I'm trying to get the MCM script to change a global var based on whether or not a check box is ticked
Side question: Is there anyway to have global variables as boolean, or int?
Edited by archeyreece
Link to comment
Share on other sites

Global variables can be bools if you limit the choice to 0 or 1 and call them as INT rather than FLOAT

 

I use all my GVs as INTs. Papyrus may be fickle. A 1.00000 may not equal a 1.00 :tongue:

 

Another thing you can try in your test script is to raise the length of the update cycle. 0.1 might be too fast for Papyrus to keep up with the changes. The GV could be changed but the message box already triggered to show. I would use no more than a minimum of .25 preferably more.

Edited by IsharaMeradin
Link to comment
Share on other sites

Global variables can be bools if you limit the choice to 0 or 1 and call them as INT rather than FLOAT

 

I use all my GVs as INTs. Papyrus may be fickle. A 1.00000 may not equal a 1.00 :tongue:

 

Another thing you can try in your test script is to raise the length of the update cycle. 0.1 might be too fast for Papyrus to keep up with the changes. The GV could be changed but the message box already triggered to show. I would use no more than a minimum of .25 preferably more.

Thanks, I tried both of those suggestions last night, with an update time of 2 seconds and 10 seconds, still getting the same results

Link to comment
Share on other sites

  • Recently Browsing   0 members

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