View Full Version : Global variable?
09-09-2005, 07:29 AM
Hi I want to make some Scripts. But I need a Variable to combine the Script. How can I make a Global Variable so I can use the Variable in all my scripts?
Please Help me.
09-09-2005, 08:38 AM
The global variable names and data types are stored in globalcat.2da. Add a new number, boolean or whatever you need and put the modified file into override. There are several script functions for each data type that allow you to read a global or alter its value:
int GetGlobalBoolean( string sIdentifier );
void SetGlobalBoolean( string sIdentifier, int nValue );
int GetGlobalNumber( string sIdentifier );
void SetGlobalNumber( string sIdentifier, int nValue );
location GetGlobalLocation( string sIdentifier );
void SetGlobalLocation( string sIdentifier, location lValue );
The comments in nwscript indicate that these two may be problematic:
string GetGlobalString( string sIdentifier );
void SetGlobalString( string sIdentifier, string sValue );
sIdentifier is the name of the variable as seen in globalcat.2da.
09-09-2005, 11:04 AM
If you want to avoid distributing a new globalcat.2da file for smaller mods, you can also reuse globals that are no longer use instead of adding a new line to globalcat.2da. In Kotor 1, there are some you can take from the Endar Spire that do not affect your game later on. I'm pretty sure there are various you can take from Peragus too.
Just make your source code available so people can see what you used.
vBulletin®, Copyright ©2000-2016, Jelsoft Enterprises Ltd.