Global variables

From NWN Lexicon
Jump to navigationJump to search

To set a global variable: In the toolset general view click Edit->Module Properties->Advanced->Variables (Click on the "..." button near "Variables")

Select the name, type and value of your variable.

To access a global use the following code:

    int nCakes = GetLocalInt(GetModule(), "AMOUNT_OF_CAKES"); //whereas AMOUNT_OF_CAKES is the name of the global variable

Global variables can be modified (provided they're not declared as constants) in the following manner

    SetLocalInt(GetModule(), "AMOUNT_OF_CAKES", 41);