A "Graph Token" is a variable that is used for storing values and then re-using those values within the same graph.
These tokens can be used for performing simple logic manipulations and checks within the flow graph script.
Graph Tokens in Action
Graph Tokens share many similarities with Game Tokens. They can have the same types of variables set and even appear under the CVar command gt_show=1 along with the rest of the gametokens.
|It's important to understand that unlike Game Tokens, Graph Tokens can only be used locally to a single flow graph. |
They are typically used to communicate different variables across a very large graph and to alleviate the need for extra flow node connections.
Creating Graph Tokens and Accessing them in FlowGraph
In this tutorial we will create our own Graph Token that will check if we have spawned into the game or not. We will then use a check to see the value of the Graph Token and output that value to the screen.
- First open the Edit Graph Tokens from the Flow Graph / Tools Menu:
- In the Edit Graph Tokens interface create a New Token by pressing the New Token button and you will be presented with a new interface which you can name the token and set the type of variable to use:
- Use the Mission:GameTokenSet (or other Mission flow nodes) to set/get/adjust the value on the graph token.
- Assign the graph token by typing in the name:
In the flow graph above, when the entity:SpawnPoint node is triggered it sets the boolean of the graph token "spawned_check" to 1.
It's checked on start (in the same frame) and the value is seen as 1 using the game token debug view gt_show=1.
- Type in the console gt_show=1 and switch to game mode to see the token value change.
Additional Information and Useful CVars
- Graph Tokens are only local to the flow graph they exist in.
- The Entity ID of the Entity which stores the flow graph set the <graphid> value (88 above) you do not, however, need to type this into the mission nodes.
- gt_show Value="1" Shows gametoken and graph token state (1 screen and log , 2 screen only , 3 log only.
- gt_showFilter Value="" Filter string for gametokens and graph token.
- gt_showLines Value="25" How many lines to show.
- gt_showPosX Value="0” Where on the screen to show in X (left right).
- gt_showPosY Value="0" Where on the screen in Y (up down).
- Game Tokens Documentation: GAMETOKENS