Doslo je do pogreske kod spajanja
Starpoint Gemini 2 modding resources

MODDING DATABASES

A lot of parameters in SPG2 is handled through databases. Database definition is saved as a *.wdb (Whale Database) file, while individual tables are *.wdt (Whale Data Table) files.

Tables can be either in text or binary format. Text format tables have an initial "txt", while binary tables have "bin" in the header.

Tables (text format) can be edited with Notepad++, OpenOffice Calc or Microsoft Excel. They consist of a header with the basic info and data sorted in rows and columns. Columns are separated by tab.

Due to the nature of database tables, using Excel or Calc is advised. It gives a much better overview of the entire table than you could get in a plain text editor. Simply select the entire contents of a *.wdt file and copy/paste it into Excel or Calc. Make the wanted modifications and then copy/paste it back into *.wdt file. Remove the empty line usually added by Notepad++ automatically.

To prevent Excel or Calc from doing any auto-correction and changing existing data on copy/paste, please follow this procedure:

  1. open the *.wdt file with the Notepad or Notepad++
  2. select the entire contents and copy it
  3. open an Excel/Calc spreadsheet
  4. CTRL+A to select the entire spreadsheet (empty) and set cell formatting to text(!)
  5. select a single cell and paste the data from the *.wdt file
  6. edit the data
  7. select all data in Excel and paste it over the existing data in *.wdt file

Setting cell formatting to text is important as then Excel won't for example switch float numbers (decimal numbers) into calender dates (which it does sometimes when formatting is set to General).


TABLES

(Click for details)

For explanation on enhancement tables look in the Assembly Editor/Enhancements section


ACCESSING THROUGH SCRIPTS

Data stored in a table can be accessed via scripts. To do that use the function explained below.

Goal is to get price of the Tesla weapon from the LightWeapons table.

	int weaponId = 0 ;
	int column = 3 ;
	float price = base LightWeapons weaponId column ;
	

GAME ENGINE

IC_Base class handles database interaction in the game engine. Here's a list of important functions:

  • int GetRowMax(WORD TableID); returns the number of rows in a table TableID
  • wChar* QueryFieldString(WORD TableID, WORD Id, WORD x); returns a string from table TableID, row Id, column x
  • int QueryFieldInt(WORD TableID, WORD Id, WORD x); returns integer from table TableID, row Id, column x
  • float QueryFieldFloat(WORD TableID, WORD Id, WORD x); returns float from table TableID, row Id, column x
  • int GetFieldId(int TableID, int x, wChar* CellText); returns row number from table TableID where CellText is in column x

Modifying original game files directly in their default folders is NOT RECOMMENDED!