edited June 2014 in ORK Support
Hello,

I have had some trouble getting game variables working. They don't seem to be reacting to anything I do.

First off, I was trying to get a global points value to keep track of the player's point value as the player had interactions with NPCs. So I defined a points variable in the game variables and then added a node to the end of an event to add 10000 points:

--------------------
Change Game Variables
Enabled true
Override Node Name false

Variable Key
Value Type Game Variable
Value points
Remove false
Type Float
Operator Add

Float Value
Value Type Value
Value 10000
--------------------

I also tried the equivalent of this in the Set After Event section of the event interaction. I displayed the value on the screen using a HUD. The information element of this HUD was #varifloatpoints#. It stayed zero even after performing the event interaction which was supposed to add 10000 points.

I have since used a currency value to hold points and it seems to work well, but there are other reasons I need to be able to use game variables. I need to unlock other interactions after one has completed. That requires the use of global bool values. Those do not work either.

Any idea what is happening?

Thanks,
David
Post edited by drod7425 on
  • You need to select Value in the variable key's Value Type setting.
    Value type Game Variable means that the value you define is the key of another game variable that holds the variable key.

    In your case, you simply define the variable key that should be used, so it's Value. You can learn more about this in this how-to.

    Also, as a side note, you don't need to define variables in the Game Variables sub-section, that's mostly a convenience feature to add variables to the popup list of the variable fields :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • That was it, thanks!
    Value type Game Variable means that the value you define is the key of another game variable that holds the variable key.
    0_0 Maybe it's because I'm not awake yet, but that sentence made me dizzy. Lol looks like I'll be staying away from the Game Variable value type...Oh fine, I'll try.

    Is it the equivalent of this?:

    Dictionary<string,object> gameVars = new Dictionary<string,object>(); //The collection of game variables
    gameVars.Add("someVar",true); //Adding a game variable of someVar
    bool grabTheGameVar = gameVars["someVar"]; //Declaring a variable that grabs the value of the someVar game variable

    And then in the event interaction inpector, the key value is grabTheGameVar and the value value is someVar? I think I get it.
  • Yes, its similar to that :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.