PDA

View Full Version : Help With Adding TSL Planets To Galaxy Map


stoffe
08-28-2006, 05:20 PM
(Explanation: This is a response to a PM I got, since the forum apparently won't let you post this long messages in PMs. Since it might be of at least some use to others I posted it here instead. I hope this is OK.)

I've read all the posts on adding a planet to the galaxy map. I've added my planet to Line 12 in the planetary 2da and I've edited a_galaxymap.ncs to include:
(...correct script snipped...)
However, nothing new shows up in the galaxy map. Is there anything else I need to add to make it show up? Did I put this line in the wrong place? Did I type the wrong syntax? The file comiles without error. Any help would be appreciated.


To add a new working planet to the Ebon Hawk Galaxy Map you'd roughly follow these steps. The NSS files for scripts mentioned below exist either in scripts.bif, or can be found in one of the tutorial forums below Holowan Labs:


Make a galaxy map icon for your planet. The easiest way is to extract one of the existing GAL_*_2.tpc files (where * is the planet name, for example GAL_M478_2.tpc), edit that one and then save it under a new name. In this example I'll call the new planet Gaia, so I'll save the modified icon as gal_gaia_2.tga. Put this in the override folder.

Next, create a TXI file containing the texture information KotorTool likely had trouble extracting when you converted the TPC file to TGA. Create a new text file, name it the same as your TGA file but with a TXI extension instead (gal_gaia_2.txi), and as content of the file type in mipmap 0. Save this file along with the TGA file in the override folder.


Open your dialog.tlk file with a TLK editor (TalkEd will do), and add two new entries. The first should contain the name of your new planet (Gaia in this example), the second should contain the specifics of the planet, laid out like:
Climate: Terran
Terrain: Mixed
Docking: Gaia's Landing
Write down the StrRef numbers these two entries were added as, you'll need those numbers soon.


From gui.bif, extract the file named galaxymap_p.gui and save it in your override folder. Open this file with a GFF Editor, expand the CONTROLS list field and select the struct with listindex 11, copy it and paste it in under the CONTROLS field to add a new struct to the list while saving yourself some manual field creation. Open your newly pasted struct, find the BORDER struct inside it and expand that one too. There, find the FILL field and change its value to the name of the planet icon you created in step 1 above, gal_gaia_2 in this case.

Next back up to your new struct again and expand the EXTENT struct (inside it) and change the LEFT and TOP fields to the X and Y coordinates on the galaxy map where you want your planet to appear. Check the coordinates for some of the other planets to get an idea of the scale, though some trial and error may be needed to find the desired location.

Next back up to your new struct again and expand the HILIGHT struct (inside it) and change the value of the FILL field here to the name of the icon you created in step 1 above as well, gal_gaia_2 in this case.

Back up to your new struct again and find the TAG field. Set this to something that has the name of your planet for simplicity, I use LBL_Planet_Gaia in this example, and write this down somewhere as you'll need this tag soon.

Save changes to the modified galaxymap_p.gui file.


Next, open Planetary.2da and find line 12 (live planet 2):
Change the Label field here to the name of your planet (Gaia).
Change the name field to the StrRef number of the name of your planet from step 2 above.
Change the description field to the StrRef number of the description from step 2 above.
Change the icon field to the name of the icon you created in step 1 above (gal_gaia_2).
Change the model field to the name of the model (MDL/MDX) file of the model you want to use for the "spinning planet" 3D view when you select your planet on the galaxy map. Unless you've made a new unique model for your planet you can re-use one of the existing ones, as I do in this example. I set the value planet_06 here, borrowing the planetary view of Dantooine for my planet.
Change the guitag field to the Tag of the struct you added to the galaxymap_p.gui file in the previous step, LBL_Planet_Gaia in this example.

Save your modified planetary.2da in the override folder.


Extract the include file named k_inc_hawk.nss from scripts.bif and put where you compile your scripts. You'll need to make some changes to this include file and use this modified copy when recompiling the following scripts.

First, find the function named SetBackground(). This is responsible for setting what is seen outside the cockpit window in the Ebon Hawk when you have "arrived" at the planet. As far as I am aware it's currently not possible to add new room animations to an area model, so you'll have to use a view from one of the existing planets. Pick one that's close enough to resemble your new planet, I'll use the view for Dxun in this example.

Scroll down to near the end of the long switch...case statement in this function, and before default: add a new case and set the room animation number you want to use here. In this example it looks like (the bolded part is what I added):
(...snip...)
case 10://Hyperspace
{
nRoomAnimation = ANIMATION_ROOM_SCRIPTLOOP11;
}break;
case 12: //ST: Gaia....
{
nRoomAnimation = ANIMATION_ROOM_SCRIPTLOOP05;
}break;
default://error
{
AurPostString("EBO ERROR: No background sepcified!",15,15,10.0);
}
(...snip...)



Next, scroll down to the function SetHologramWorld() and do the same. Before the default: case, add a new case for your planet, like (again, bolded part is what added, the other is just to show where to insert it):
(...snip...)
case 10://Hyperspace
{
sResRef = "";
}break;
case 12: //ST: Gaia...
{
sResRef = "holo_tel";
}break;
default://error
{
AurPostString("EBO ERROR: No background sepcified!",15,15,10.0);
}
(...snip...)

This function set the name of the placeable UTP file for the holographic image of a planet that is shown in the main hold of the ebon hawk while "landed" on the planet. Pick one of the existing ones to re-use if you haven't made your own model, it doesn't matter which one since they are all completely identical as far as I can tell. I used holo_tel in this example. :)


Last, find the function GetCurrentPlanet(), which is used to tell the other scripts what planet you are currently landed/docked at. Again insert a new case near the end, like (bolded part is new, again...):
(...snip...)
case 10://Hyperspace
{
return PLANET_EBON_HAWK;
}break;
case 12: //ST: Gaia...
{
return PLANET_LIVE_02;
}break;
default://error
{
return PLANET_EBON_HAWK;
}
(...snip...)


Save this modified k_inc_hawk.nss include file in a place where it will be used when you recompile the next batch of scripts below.


In the script a_galaxymap.nss (used to open the map screen), add...
SetPlanetAvailable(PLANET_LIVE_02, TRUE);
SetPlanetSelectable(PLANET_LIVE_02, TRUE);
...somewhere near the end to make sure the planet is always reachable. If you want the planet to only be reachable under certain conditions you may add additional checks here as well, but in this example the planet should always be there so the above is sufficient. Save the modified script, recompile it and put the resulting a_galaxymap.ncs file in the override folder.


In the script k_sup_galaxymap.nss (used when you pick a destination at the map screen), find the switch statement near the start of the main() function that begins like switch(GetGlobalNumber("003EBO_BACKGROUND")). Add a new case at the end for your planet, like:
case 12: // ST: Gaia....
{
QueueMovie("HypMov01");
}break;

This part plays the departure and hyperspace movies to give the impression of the ship travelling to its destination. If you've made a departure movie for your planet (or want to re-use an existing one) add a QueueMovie() call with the name of the BIK movie file as parameter. Otherwise you can do as the above example and skip the departure movie and go straight to the "jump to hyperspace" movie.

Next scroll down to the next switch statement. This plays the arrival/landing movie for the destination planet, and sets which planet the Ebon Hawk is currently loaded on. Add a new case at the end, like:
case PLANET_LIVE_02:
{
SetGlobalNumber("003EBO_RETURN_DEST",12);
SetGlobalNumber("003EBO_BACKGROUND",12);
}break;


This sets which planet you are currently landed on. If you've made a new landing movie for your planet, or want to re-use an existing one you can add a QueueMovie() call with the name of the BIK movie file as parameter after the last of the SetGlobalNumber() function calls.

Save and recompile the file, and put the resulting k_sup_galaxymap.ncs file in the override folder.


If you want to restrict what NPCs may be brought along when exiting the Ebon Hawk on your new planet you can modify the script tr_leave_ehawk.nss to add these restrictions. This script is the OnEnter script of the exit ramp trigger inside the Ebon Hawk.


Open the script check_party_gui.nss and scroll down to the ExitEbonHawk() function (it should be at the top of the script if you use the re-created script I made). In the switch statement inside this function, add a new case above the default case, like (bold text is new):
(..snip..)
case 10: sDest = "IN_TRANSIT"; break;
case 12: sDest = "ST_GAIA"; break;
default: sDest = "ERROR";
(..snip..)

The text you assign at case 12 above (ST_GAIA) is the name of the MOD or RIM file containing your new module (st_gaia.mod in this example). This tells the game what module to load when you exit the Ebon Hawk. Save, recompile and put the resulting check_party_gui.ncs file in the override folder.


These steps will add a new planet to the galaxy map. When selected, a "jump to hyperspace" movie is played and the hawk is "landed" on that planet. When you exit the Ebon Hawk, the module for the new planet will load. With reservation for typos and poor memory, since I just wrote this thing it's only roughly proof-read. :)

goldberry
08-28-2006, 06:00 PM
stoffe, I LOVE YOU!!!!!!!

This is the most easy to understand Galaxy Map tutorial I have seen.

*saves page to desktop*

Mav
08-28-2006, 09:04 PM
I'll go ahead and nominate this as an "add-on" to the existing tutorial for this subject

RedHawke
08-29-2006, 01:24 AM
Added to General Tutorials section...

http://www.lucasforums.com/showthread.php?t=169825

:D

Lit Ridl
08-29-2006, 04:16 AM
Yeah, STOFFE THE GREAT!!!
WE LOVE YOU!!!

Is it possible only with the live planets?
Will adding new row work (somehow I think no:()?

off-topic:
Are you game developer???
So many knowledges in one people...

Qui-Gon Glenn
09-04-2007, 03:46 PM
My apologies to all for bumping a very old thread.

Your tutorial is excellent Stoffe, although I have made some errors here and there. I do have one direct and simple question.

I think I understand the scale of the Galaxy Map, and how to use the left (x) and top (y) coordinates. If I am imagining things correctly (which would be rare) this is a 300 high by 600 long rectangle? Starting at the bottom left hand corner at 0,0?

This works out when I sketch the existing planets out into a simple map with this 300x600 grid. However my planet appeared in a different place than I expected. Just wanting to double check my thinking with anyone else in the community.