Jump to content

Variables question


larryrathbun

Recommended Posts

I am starting to script my mod, and I need a whole lot of variables to represent items being moved around and dialog options. I have considered a couple of way to do this, but am not 100% sure if they will work.

 

1) A quest script. Can I reference a variable in a quest script from outside that quest script? It seems intuitive, but maybe because the question is so basic no-one has explained it. Does this work, so long as itemvariable is declared as an INT in DPQuestScript?

 

scn DPObjectScript

begin OnActivate
 if DPQuest.itemvariable==1
   ;dosomething
 end
end

 

2) A token with an attached script full of variables. Some basic method, but use an object script to hold the variables. If the other doesn't work, I don't see why this would.

 

3) Making a whole ton of tokens, 1 for each item/variable - I do not want to use this method.

 

4) Global variables - I don't like globals in general. Everything will be inside this mod and limited to several internal cells. There will be one or two things handled outside those cells, I intend to use a token for that.

Link to comment
Share on other sites

1) Yes, you can access a quest script's variables using the QuestID.Variable syntax. Any variables in the script attached to that quest can be used in this manner.

 

2) You can access variables in an object script with the ObjectReference.Variable sytax. Any variables in the script attached to the object can be used in this manner.

 

3) There is no need for multiple objects, as you can define multiple variables in one script.

 

4) Global variables are useful for values you intend to use across several plugins or for global constants that reset to a set value each time the game is loaded. Anything else you can use local variables in a quest or object script for.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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