PDA

View Full Version : Travelling to custom planets


tk102
04-17-2004, 02:37 PM
Edit tk102: This tutorial is centered around KotOR. stoffe -mkb- wrote an excellent tutorial for travelling to custom planets in TSL (http://www.lucasforums.com/showthread.php?t=169825).

A simple tweak to two scripts unlocks the potenial of other planets that Bioware was intending with "Live Content".

The planets appear as white squares on your Galaxy map*. You can travel to them. Of course once you arrive at these unmade planets, if you step off the Ebon Hawk you'll be nowhere and the game will crash. But that's for us to fix.


*=See below for fixing that


Directions:
Extract k_pebn_galaxy.nss and k_inc_ebonhawk.nss using KotOR Tool
Open up k_pebn_galaxy.nss and find the last line of code that says ShowGalaxyMap(nPlanet);
Just before this line, add the following lines of code:
SetPlanetAvailable(11, TRUE);
SetPlanetAvailable(12, TRUE);
SetPlanetAvailable(13, TRUE);
SetPlanetAvailable(14, TRUE);
SetPlanetAvailable(15, TRUE);
SetPlanetAvailable(16, TRUE);
SetPlanetSelectable(11, TRUE);
SetPlanetSelectable(12, TRUE);
SetPlanetSelectable(13, TRUE);
SetPlanetSelectable(14, TRUE);
SetPlanetSelectable(15, TRUE);
SetPlanetSelectable(16, TRUE);
Save your changes k_pebn_galaxy.nss
Open up k_inc_ebonhawk.nss (we have to fix the original programmer's syntax error! before we can compile our code.)
Look for this line of code around line 19:void EBO_PlayTakeOff(int nCurrentPlanet); and replace it with string EBO_PlayTakeOff(int nCurrentPlanet);
Look for this line of code around line 21:void EBO_PlayLanding(int nDestination); and replace it with string EBO_PlayLanding(int nDestination);
Save your changes to k_inc_ebonhawk.nss
Put a copy of nwnnsscomp.exe into the same folder as these two .nss files and use it to compile k_pebn_galaxy.nss to k_pebn_galaxy.ncs.
Move k_pebn_galaxy.ncs to your Override folder.
Start KotOR and go check your galaxy map



Edit: Screenshots:
New star map: Hoth (http://img56.photobucket.com/albums/v170/tk102/0c4857f1.jpg)
New star map: Sleheyron (http://img56.photobucket.com/albums/v170/tk102/1c3aa1c8.jpg)


Original thread (http://www.lucasforums.com/showthread.php?s=&threadid=143328)

tk102
04-17-2004, 09:37 PM
Here is the sequence of how the game loads a new custom planet module.

1. Player selects a planet from Galaxy Map which fires the k_sup_galaxmap.ncs script.
2. The k_sup_galaxmap.ncs script loads module ebo_m12aa and sets K_CURRENT_PLANET global variable based on the planet index that was selected on the Galaxy Map.
3. Module ebo_m12aa plays takeoff and landing sequence.
4. The player then exits Ebon Hawk module (ebo_m12aa) which fires k_pebn_exithawk.ncs script.
5. The k_pebn_exithawk.ncs script loads the new planet's module based on the value stored in K_CURRENT_PLANET.

The values of K_CURRENT_PLANET correspond with the following module names:

Planet Index K_CURRENT_PLANET Associated Module Description
0* 5 (none) Endar Spire
1 10 tar_m02aa Taris Apartments
2* -1 (none) Ebon Hawk
3 15 danm13 Dantooine
4 35 tat_m17ab Tattooine
5 20 kas_m22aa Kashyyyk
6 25 manm26ad Manaan
7 30 korr_m33aa Korriban
8* 40 lev_40a Leviathan
9 45 unk_m41aa Unknown World
10 50 sta_m45aa Star Forge
11 55 liv_m99aa Yavin Station
12* 60 liv_m99ab Custom Planet#1
13* 65 liv_m99ac Custom Planet#2
14* 70 liv_m99ad Custom Planet#3
15* 75 liv_m99ae Custom Planet#4
16** 80 liv_m99af Custom Planet#5

*=not normally selectable from Galaxy Map
**=requires extra editing and recompilation to get liv_m99af


Let's say you want to travel to a single new planet (planet #12). So you follow the instructions in the above first post, making sure to add SetPlanetAvailable(12, TRUE);
SetPlanetSelectable(12, TRUE);
to k_pebn_galaxy.nss and recompiling it (with the fixed k_inc_ebonhawk.nss script). Now you will need to create a new module called liv_m99ab.mod and place it in your modules directory. Creating a custom module and area are outside the scope of this tutorial -- see Doom Dealer's Area Editing tutorial (http://www.lucasforums.com/showthread.php?p=1552754#post1552754) for more info.

Now when you click your new custom planet you should be able to exit the Ebon Hawk and enter your new custom module.


-----
If you really want to get liv_m99af, you will need to do the following:
1. In k_inc_ebonhawk.nss search for this lines (EBO_GetPlanetFrom2DA function):
else if(nPlanetIndex == PLANET_LIVE_05)
{
return 75;
}
2. Right after the brace, insert:
else if(nPlanetIndex == 16)
{
return 80;
}
3. Save. Recompile k_pebn_galaxy.nss with the newly modified k_inc_ebonhawk.nss.

Jackel
04-18-2004, 02:06 AM
Originally posted by shosey
is it possible to add new cutscene animations for the inbetween planet travel?

shouldnt be to hard , just change the scripts that tk was talking baout .. though unless someone is willing to make new bink files we would have to reuse the ones in game already

tk102
04-19-2004, 06:59 PM
Here's some more information regarding the graphical representation of new planets. The planetary.2da file has two fields of importance: icon and model. The first is a reference to a .tga file. The second is a reference to an .mdl/.mdx set.

To create a new planet icon on the Galaxy Map
Extract an existing planet icon (eg. "lbl_ikash.tpc") using KotOR Tool under ERFs->TexturePacks->swpc_tex_gui.erf (L section).
Convert the .tpc to .tga using tpc2tga utility.
Modify the .tga file as you please. Save it as 32-bit uncompressed .tga with a name as designated in the planetary.2dafor the "Live Planets" (eg. "lbl_live04.tga").
Put the file in your override folder.

To create a new planet model on the Galaxy Map (the slow rotating planet that zooms in):
Extract the .mdl/.mdx files from the models.bif for "lplanet_01.mdl" and "lplanet_01.mdx". You'll need to make sure you have the "Enable Model BIF node in tree" option selected in KotOR Tool.
Rename the .mdl/.mdx set with a name as designated in the planetary.2da for "Live Planets" (eg. "lplanet_04.mdl", "lplanet_04.mdx")
Extract any existing planet's texture from ERFs->TexturePacks->swpc_tex_gui.erf (G section). They're named something like "GUI_KORRIBAN_1.tpc".
Convert the .tpc to .tga using tpc2tga utility.
Modify the .tga as you please. Save it as 32-bit uncompressed .tga with a name formatted as "GUI_xxxxx_1" (eg. "GUI_SLEHE_1"). This will make sure the name has the same number of characters as the original.
Save the .tga in the override folder.
Hex Edit the .mdl file from step 2. Replace the one instance of the original texture name to the new texture name (eg. Find "GUI_YAVIN_1" and replace with "GUI_SLEHE_1"). Replace the 4 instances of the original model name to the modified name (eg. Find "lplanet_01" and replace with "lplanet_04"). Save the modification.