Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

List of Global Variables and how to change them

Page: 1 of 1
 Seamhainn
09-12-2006, 1:53 AM
#1
Hello!

I don't want to anoy people, and this was probably asked before, but I try it just the same. Does a list of the Global Variables for KotOR I exist and how can I change them?

I am still toying with the After Ending Mod, and tho my work schedule is pretty tight I'd like to push it still.

Thanks and take care
 RedHawke
09-12-2006, 2:20 AM
#2
Moving to Holowan Labs proper as this isn't actually a Mod Request...

You change the values of variables either local or global in-game with scripts, you can use KSE to set them in your save game.

I don't believe anyone has compiled a list of what global variable does what.
 SithRevan
09-12-2006, 2:27 AM
#3
Yeah there is a list of global variables in the 2da sectiuon of kotor tool, the name of the file you want is called "Globcat.2da". Now changing them is a different story, do you want to add on or modify an existing one? So in any case I hope this was the answer that you were looking for, and good luck with you K1 end game mod!
 Seamhainn
09-12-2006, 2:48 AM
#4
Thanks SithRevan! I am at work now, but will try Kotor Tool tonight at home. As all (or most) of the variables are reset before/during/after the fight on the Starforge one has to redo some things / refight some fights.

I found out that it is pretty interesting to visit the known locations after the Starforge, but to make it easier it would be great to change the variables to how they were before the Starforge.

Take care
 stoffe
09-12-2006, 7:46 AM
#5
As all (or most) of the variables are reset before/during/after the fight on the Starforge one has to redo some things / refight some fights.


The problem with a "going back" mod is not just global variables being cleared, but that modules/areas are cleared out of the savegame automatically whenever you reach a point in the game when you'd normally be unable to return to them. So if you go back afterwards the areas will be recreated in their default/starting state with any NPCs in their starting positions, all doors and containers/placeables in their default state and the local variables set on the module, area or any objects within gone.

This savegame cleanup to reduce the file size is determined by the modulesave.2da file. While you could modify this file to prevent the game from removing areas from the savegame this would only have any effect for new games, or games which haven't progressed very far, since chances are that some areas have been cleaned out already otherwise. This would also result in a significant increase in the size of savegames, with a corresponding increase in load time when a savegame is loaded.
 Seamhainn
09-12-2006, 8:32 AM
#6
Thanks stoffe!

Does a modulesave.2da tutorial exist?

Thanks and take care
 stoffe
09-12-2006, 8:58 AM
#7
Does a modulesave.2da tutorial exist?


There isn't much to tutorialize over since the file is not very complex. :) Essentially you have these columns:
modulename is the ResRef of the module (essentially RIM file name) which the line governs.


includeinsave tells if the module should be stored in the savegame at all. There is no point in saving cutscene sets where the player never has any control in the savegame for example. 1 = save, 0 = don't save.


autosaveonenter tells if if the game should automatically save the game when the player enters the module. yes = save if no autosave has been done recently, force = always autosave every time the player enters the area no matter what, no = don't create any autosave here.


areaname is a dialog.tlk StrRef where the name of the area is stored. Don't know what this is used for in-game.


savegroup is a numerical group label that this module belongs to. A group can contain one or many modules. They are usually used for grouping together modules that belong to the same stage of the game, where Taris might be one group, Dantooine one, the Starmap planets one, the Leviathan one, the Unknown world modules one and the StarForge one, etc. These are used in the last column:


deletesavegrouponenter contains a group label number. All modules that have this number in the savegroup column will be deleted from the save game when the player enters the module of this line.


So, in essence you'd need to remove the value of the deletesavegrouponenter column for the rows of the modules you want to keep the game state intact for throughout the game so they can be revisited after the final battle. Replace the number in this column for thos lines with **** to keep them in the save game.
 Seamhainn
09-12-2006, 12:37 PM
#8
Sorry for being such a diletant. Where can I find the modulesave.2da file?

Thanks and take care

Edit: Found it!!!

Edit2: These modules have the deletesavegrouponenter:

danm13
ebo_m40aa
ebo_m40ad
ebo_m41aa
sta_m45aa
tar_m02af
unk_m41aa

(Not that many to save disc space and/or loading time I suppose.)

Does a list of module discriptions exist? This may take it a bit far, but: If I make changes to the file, what must I do if I want to make it a mod which I want to publish?

Thanks for the great help!
 Darth333
09-12-2006, 3:48 PM
#9
Sorry for being such a diletant. Where can I find the modulesave.2da file?
All the .2da files are at the same place: in the BIFs



Does a list of module discriptions exist? I don't know if this is what you mean but KotOR tool has an option to turn on module descriptions.
 Seamhainn
09-13-2006, 1:23 AM
#10
This is truely a bunch of helpful souls! And Dart333 is my KotOR goddess ;-) .

Take care (more questions to come)

Edit: Okay, I changed the data. I don't want to override my existing files. What must I do to make it a workable file which I can put into the override folder? Sorry for asking those dump questions. Is there a tutorial for these kind of things?

Also, for test and learning purposes I want to spawn a npc on the Endar Spire with which the player character can interact. Which is the best tutorial for this?

Thanks!
 stoffe
09-13-2006, 7:15 AM
#11
Okay, I changed the data. I don't want to override my existing files. What must I do to make it a workable file which I can put into the override folder?


What do you mean? Do you already have a modulesave.2da file in your override folder that you don't want to overwrite, or what is it you don't want to override?


Also, for test and learning purposes I want to spawn a npc on the Endar Spire with which the player character can interact. Which is the best tutorial for this?


If you want to spawn an NPC you'll first need to figure out the coordinates for where you want it to appear. You can do that by standing on the location you want it to appear, open the console and type in whereami and write down the coordinates displayed on the screen.

Then you could write a script using those coordinates to spawn the NPC like:

void main() {
location lLoc = Location(Vector(2.0, 6.0, 0.0), 0.0);
CreateObject(OBJECT_TYPE_CREATURE, "mynpc", lLoc);
}


The yellow part is the X coordinate, the green is the Y coordinate and the blue is the angle (0-359 degrees) the NPC should be facing. The red part should be the ResRef (filename without extension) of the UTC file to spawn the NPC from. I.e. in the above example the UTC file would be named mynpc.utc. Keep in mind that filesnames can be at most 16 alphanumerical characters and underscores.

If you have one of the later versions of KotorTool you can use its text editor to compile scripts into the NCS bytecode files that the game uses. Otherwise check in the "Scripting" tutorial forum at the top of Holowan Labs for instructions on how to compile scripts.

To make the script run you'll need to run it from somewhere. The easiest way if this is just for your own use is to modify trask's dialog when you start the level to run the script from one of the entry nodes to spawn the NPC. Just put the name of the script without the NCS suffix in the "Script to run..." (KotorTool) or "Script" (DLGEditor) box of the node to make it run.

To create the NPC itself you can use KotorTool to copy one of the existing UTC templates who are similar to how you intend your NPC to be, and then make changes to it and save it under a name new. You set the name of the DLG file to use for interactions on the Basic tab in the conversation field. Again filename without .dlg extension.

To create the DLG file use the DLG Editor or KotorTool's built in Conversation editor. Look at one of the existing DLG files to get a basic idea of how they are built up. They are essentially tree structures where Entry and Reply nodes alternate and link to other nodes.
 Seamhainn
09-13-2006, 9:03 AM
#12
No, I assumed I have to save the new modulesave.2da file in my override folder. But I wasn't sure if thats the right way to go. If thats all I have to do things are easy :-) . Is that the right way?

If I want to spawn an object don't I need alos the area/module specifications?

Thanks for the great help! I will give it a try tonight...

Take care
 Darth333
09-13-2006, 10:03 AM
#13
No, I assumed I have to save the new modulesave.2da file in my override folder. But I wasn't sure if thats the right way to go. If thats all I have to do things are easy :-) . Is that the right way?
That's all what you have to do. You are only dropping a modified copy of the file in your override folder. All the original files are still there.


If I want to spawn an object don't I need alos the area/module specifications?
Not necessarily. It depends from where you are firing the script. If you are firing the script from a .dlg file you only need the coordinates of the location where you want to spawn your object. Note that the object will always spawn in the module in which the script is fired and that you cannot spawn an object in module other from the one in which you currently are.

If you want to spawn your object when the module loads instead of firing your script from a .dlg or other file, then you need the name of the module to check if the PC is entering the module in order to ensure that the script is only triggered by the PC (or your script will loop and you'll end up with an army of clones). Check this thread for more examples of spawn scripts: http://www.lucasforums.com/showthread.php?t=143536)
 Seamhainn
09-13-2006, 4:02 PM
#14
Ah, okay. Do you know the On_enter file name for the Endar Spire? I searched for it quite some time...

Thanks!
Page: 1 of 1