Jump to content

Home

(K1) Lightsaber Mod idea and help request.


GamerX51

Recommended Posts

I know I haven't been around the forums in a long time, but I have been thinking long and hard about this, and I would like to try my own hand at modding KOTOR! I was thinking of doing a lightsaber mod similar to the USM for K1. (I know T7nowhere was working on one, but then he quit for some strange and unknown reason.) The only problem is, I'm a complete noob when it comes to modding!

 

I've been using Fred Tetra's KOTOR tool for a while, and I know my way around it pretty well, but I was wondering if any of you modding/modeling geniuses had any tips or suggestions that would make my life easier. If anyone could offer me any advice at all as to how I could best go about making my dream a reality, It would be greatly appreciated.

 

I have a fully licensed version of 3DS Max and all the proper modeling tools (NWMax, MDlops, etc.) so all I really need is professional advice and some inspiration!

Link to comment
Share on other sites

Open up Max and make a model. Start by completing a few of the max tutorials, then when you feel you are comfortable with 3ds max, make something you want to make. If your having trouble getting into the modding mode just set a goal for yourself, like making a lightsaber.

Link to comment
Share on other sites

What type of advice are you looking for; advice on how to model a lightsaber, how to get it in game, how to make it upgradeable, what type of lightsabers you should make, how to create a form of story behind each one, etc?

 

For modelling a lightsaber, you could read the 'A-Z of Modeling a new Lightsaber' thread by T7nowhere.

 

To get it in game, you could search around or try the following, which should work fine:

Section 1: Get your tools

I'm doing this for KotOR I, but KotOR II would be somewhat similar.

 

I would suggest the following three files:

Kotor Tool

KGFF

Hex Editor (A free one is located Here)

 

Section 2: Get your files

 

I would advise you create a separate folder for all the files to get organized. So go ahead and create a new folder (name it whatever you wish).

 

Now get your icons in order. For now just get default ones, you can change them later. Open up kotor tool (make sure you’re in the kotor 1 section) and go to ERFs->TexturePacks->swpc_tex_gui.erf->I and go to iw_lghtsbr_001.tpc and iw_sbrcrstl_014.tpc and press ‘Extract file’ on each one (Save as TGA on each one), then save them to the folder you created.

 

Now get your item files in order. I’ll just get the default ones here as well, you can do the customizing once you get your item in game. Go to BIFs->templates.bif->Blueprint, Item and extract g_w_lghtsbr01.uti and g_w_sbrcrstl14.uti to the folder you created.

 

Now get your model and blade color in order. I’ll just use the default ones here as well, but you can use your custom model/texture as well. So let’s get the mdl and mdx files: Go to BIFs->items.bif->Aurora Model and extract w_lghtsbr_001.mdl to the folder you created, and go to BIFs->items.bif->Aurora Model Extension and extract w_lghtsbr_001.mdx to the folder you created. Now go to ERFs->TexturePacks->swpc_tex_tpa.erf->W and double click on w_lsabreblue01.tpc and check the box ‘Export Selection to TXI file’ and click on the Write File button and save the file to the folder you created. Take note of the text in the box (blending additive and decal 1) as these are the properties for the blade color, which makes it blend into the background.

 

You should now have all the files required, so let’s choose a model number. I don’t believe any mod uses 245, so change the files to that model number and change the blade color files to a name of your choosing. I’ll change the color files to mysaber_colo01. w_lsabreblue01 is 14 characters long, so the new name MUST be 14 characters long. This represents the current blade color, so if you were to be using the red saber (g_w_lghtsbr02.uti) that uses w_lsabrered01 then the new name would need to be 13 characters long. So let’s get started by changing the following files:

 

iw_lghtsbr_001.tga to iw_lghtsbr_245.tga

iw_sbrcrstl_014.tga to iw_sbrcrstl_245.tga

w_lghtsbr_001.mdl to w_lghtsbr_245.mdl

w_lghtsbr_001.mdx to w_lghtsbr_245.mdx

w_lsabreblue01.tga to mysaber_colo01.tga

w_lsabreblue01.txi to mysaber_colo01.txi

 

Next, let’s change the model to the new blade color. Open up your hex editor (I’m using the one I listed, so the steps won’t be the same on different ones) and open the w_lghtsbr_245.mdl file. Go to Search and then Replace. Under ‘Find’ and under ‘Replace with’, make sure to select Text string. Now let’s replace the old blade color with the new one, so type w_lsabreblue01 in the Find box and mysaber_colo01 in the Replace with box, and press Replace all (there should be 4 occurrences, though there with be 8 with a double saber). Now save the file.

 

Next, open the two item files in kotor tool. Open g_w_lghtsbr01.uti and change the Template ResRef and Tag to the filename you want to use for the item, I’m going to change them to newsaber. Change Model Variation to the model number you’re using, in this case we will put 245. Now go to the Description tab and change the Name field to whatever you want, I’ll just put New Saber. You can set the Description to whatever you want as well. You can also mess around in the Properties tab. Now save the file to whatever you chose as the Template ResRef and Tag, I’ll save it as newsaber.uti. Do the same for the g_w_sbrcrstl14.uti file.

 

Next, let’s make your saber upgradeable. Go into kotor tool and go to BIFs->2da.bif->2D Array and open up upcrystals.2da (if you already have an upcrystals.2da in your Override folder, then open that instead). You will see 6 columns: (Row Label), label, template, shortmdlvar, longmdlvar, and doublemdlvar. The (Row Label) column is just the next number. The label column can be whatever you want, so just name it something that signifies your new saber (I just put tutsaber). The template column is the name of the Template ResRef that you chose for the crystal (which should be the file name as well), I’ll put newcrystal since that is what I chose for my crystal. The shortmdlvar, longmdlvar, and doublemdlvar columns are the names of the Template ResRefs that you chose for the three item files, since we only created a regular long saber, put the name of the Template ResRef in your lightsaber's item file in the longmdlvar column and **** in the other two. So your columns should look like this:

 

(Row Label): 17 (this was the next number in my upcrystal.2da file)

label: tutsaber (again, you can put whatever you want)

template: newcrystal (the Template ResRef from my crystal’s item file)

shortmdlvar: **** (we didn’t make a short saber)

longmdlvar: newsaber (the Template ResRef from my lightsaber’s item file)

doublemdlvar: **** (we didn’t make a double saber)

 

Now you put all of your files in the Override folder. Everything should be working now.

 

A few added notes:

 

The name of the icon file for your lightsaber will always be iw_lghtsbr_xxx.tga (where xxx is the Model Variation you chose in your lightsaber’s item file). If you were to put 1 in as your Model Variation in your lightsaber’s item file, then the icon file would be iw_lghtsbr_001.tga, if you put 10 then the icon file would be iw_lghtsbr_010.tga, if you put 100 then the icon file would be iw_lghtsbr_100.tga, etc.

 

The name of your model files (the mdl and mdx files) will always be w_lghtsbr_xxx.mdl and w_lghtsbr_xxx.mdx (where xxx is the Model Variation of your lightsaber’s item file). The xxx has the same relativity as the icon file.

 

The name of the icon file for your crystal has the same relativity as the icon file for your lightsaber.

 

The Model Variation of your lightsaber and crystal do not need to be the same. Truthfully, aside from the entry in the upcrystals.2da, the lightsaber and crystal have nothing to do with each other.

 

You can edit the blade color file to your desire.

Link to comment
Share on other sites

What type of advice are you looking for; advice on how to model a lightsaber, how to get it in game, how to make it upgradeable, what type of lightsabers you should make, how to create a form of story behind each one, etc?

 

What I really need the most is how to get it in game, and make it upgradable..all the "technical" details of a lightsaber mod. I've already been playing around in MAX for a while, and I think I understand it well enough now to start working on some models. (thanks for the sugggestion T7nowhere!)

 

The only thing that might give me problems is texturing the models themselves. If anyone could give me any pointers there it would be a huge help! I have GIMP 2.2, so I *could* do the texturing myself if I had to, although I'm really dreading it.

 

Something that I would like to do (if it's possible, that is), would be to create a custom lightsaber that the player would recieve when they create thier first lightsaber on Dantooine, but have it change based on the player's alignment and Jedi class choice. But I really suck at scripting, so it's highly unlikely that I could do that myself. (even with someone hand-holding me through the process) Could anyone help there?

 

Anyway, thanks for the suggestions everybody! I might get started on it sometime later today, but I've got college midterm exams all day today, so I doubt it. Thanks for being so helpful and encouraging me! :shads3:

Link to comment
Share on other sites

What I really need the most is how to get it in game, and make it upgradable..all the "technical" details of a lightsaber mod. I've already been playing around in MAX for a while, and I think I understand it well enough now to start working on some models. (thanks for the sugggestion T7nowhere!)

 

The only thing that might give me problems is texturing the models themselves. If anyone could give me any pointers there it would be a huge help! I have GIMP 2.2, so I *could* do the texturing myself if I had to, although I'm really dreading it.

 

As far as placing the item in-game, you have several options. Scripts, while the most confusing for me, it allows the greatest flexibility. Put your item in a merchant's inventory, or put the item in a placeable's inventory (loot). There are various tutorials on each subject in the tutorials section of the boards. As far as how to make your lightsaber upgradeable, I wrote a tutorial for that very subject, and it can be found in the tutorials section as well.

 

As far as texturing your model, I think you'll find that the painting of the texture in GIMP/PSP/Photoshop, whatever, is the easy part. Uvmapping your model, detaching polys for detail and to prevent texture warping in-game, that will be your worst nightmare. ;)

Link to comment
Share on other sites

If you read through the quote I put in my first post, I put how to make it upgradeable near the bottom.

 

If you want to get the saber when you get assigned your jedi class, then go into kotor tool and go to BIFs->scripts.bif->Script, Source and extract the k_inc_dan.nss script. Open that with notepad or some other text editor (the default one in kotor tool should work fine, and you can access that by double clicking on the script instead of extracting it) and you should see 'void TurnPlayerIntoJedi()' near the middle of the script (it is also located near the top, but do not edit that). This is what you should see:

 

void TurnPlayerIntoJedi()
{
   object oPC = GetFirstPC();
/*    int nXP = GetXP(oPC);
  // AurPostString("Current XP: " + IntToString(nXP),5,5,5.0);

   int nLevel = GetHitDice(oPC);
  // AurPostString("Current Level: " + IntToString(nLevel),5,6,5.0);

   int nXPNeeded = 1000 * FloatToInt((IntToFloat(nLevel) / 2.0) * (IntToFloat(nLevel) + 1.0));
  // AurPostString("XP Needed" + IntToString(nXPNeeded),5,7,5.0);

   int nSaved = nXP - nXPNeeded;
  // AurPostString("Extra: " + IntToString(nSaved),5,8,5.0);
   if(nSaved > 0)
   {
       SetGlobalBoolean("DAN_EXTRA",TRUE);
       int nLow = nSaved & 0xff;
       AurPostString(IntToString(nLow),5,9,5.0);
       int nHigh = (nSaved >> 8) & 0xff;
       AurPostString(IntToString(nHigh),5,10,5.0);
      // if (nLow > 0)
      // {
          SetGlobalNumber("DAN_EXTRA_XP",nLow - 128);
      // }
     //  if (nHigh > 0)
       //{
           SetGlobalNumber("DAN_EXTRA_XP2",nHigh - 128);
      //}
   } */

   int nJediPath = GetGlobalNumber("DAN_PATH_STATE");
   if(nJediPath > 0)
   {
       if(nJediPath == JEDI_PATH_GUARDIAN)
       {
           AddMultiClass(CLASS_TYPE_JEDIGUARDIAN,oPC);
       }
       else if (nJediPath == JEDI_PATH_SENTINEL)
       {
           AddMultiClass(CLASS_TYPE_JEDISENTINEL,oPC);
       }
       else if (nJediPath == JEDI_PATH_CONSULAR)
       {
           AddMultiClass(CLASS_TYPE_JEDICONSULAR,oPC);
       }
     //  int nLevel = GetHitDice(oPC);
     //  int nXPNeeded = 1000 * (nLevel / 2) * (nLevel + 1);
     //  SetXP(oPC,nXPNeeded);
   }
   //ShowLevelUpGUI();
   CancelPostDialogCharacterSwitch();
   NoClicksFor(0.6);
   DelayCommand(0.5,WraperShowLevelUpGUI());
}

 

If you want to assign a specific lightsaber based on class, you should be able to replace that with the following:

 

void TurnPlayerIntoJedi()
{
object oPC = GetFirstPC();
int nJediPath = GetGlobalNumber("DAN_PATH_STATE");
string SABER_GUARDIAN = "itemname";
string SABER_SENTINEL = "itemname";
string SABER_CONSULAR = "itemname";

if(nJediPath > 0)
{

	if(nJediPath == JEDI_PATH_GUARDIAN)
	{
           		AddMultiClass(CLASS_TYPE_JEDIGUARDIAN,oPC);
		CreateItemOnObject(SABER_GUARDIAN, oPC);
	}

	else if (nJediPath == JEDI_PATH_SENTINEL)
	{
		AddMultiClass(CLASS_TYPE_JEDISENTINEL,oPC);
		CreateItemOnObject(SABER_SENTINEL, oPC);
	}

	else if (nJediPath == JEDI_PATH_CONSULAR)
	{
		AddMultiClass(CLASS_TYPE_JEDICONSULAR,oPC);
		CreateItemOnObject(SABER_CONSULAR, oPC);
	}
}

CancelPostDialogCharacterSwitch();
NoClicksFor(0.6);
DelayCommand(0.5,WraperShowLevelUpGUI());
}

 

Each "itemname" next to the SABER_GUARDIAN, SABER_SENTINEL, and SABER_CONSULAR strings at the beginning of the script portion above are the filenames of the items you want to use, without the .uti extension. Once you edit the k_inc_dan.nss script, you should be able to compile it using nwnnsscomp and place it in the Override directory.

Link to comment
Share on other sites

If you read through the quote I put in my first post, I put how to make it upgradeable near the bottom.

 

Thanks for the scripting help, Grimshadow. However, If I'm not mistaken, that script is the one that fires when you first gain your jedi class after choosing a crystal, isn't it? I really want to change the script that controls when you build your first lightsaber (After you gain your class.) Sorry if I wasn't clear about that before. <Edit> Nevermind grim, I found the section of code that creates your first lightsaber, but how should I edit it to do what I want? <Edit>

 

BTW, thanks for showing me your tutorial on making a lightsaber upgradable, Maverick. It was really imformative. ;)

Link to comment
Share on other sites

Ah, thats no problem either:

 

object CreateFirstLightsaber()
{
object oPC = GetFirstPC();
object oSaber;
object oCrystal = GetItemPossessedBy(GetFirstPC(),"dan13_plotcrys");
SetPlotFlag(oCrystal,FALSE);
DestroyObject(oCrystal);
int nJediPath = GetGlobalNumber("DAN_PATH_STATE");

string SABER_GUARDIAN = "itemname";
string SABER_SENTINEL = "itemname";
string SABER_CONSULAR = "itemname";

if(nJediPath > 0)
{
	if(nJediPath == JEDI_PATH_GUARDIAN)
	{
		oSaber = CreateItemOnObject(SABER_GUARDIAN,oPC);
	}

	else if (nJediPath == JEDI_PATH_SENTINEL)
	{
		oSaber = CreateItemOnObject(SABER_SENTINEL,oPC);
	}

	else if (nJediPath == JEDI_PATH_CONSULAR)
	{
		oSaber = CreateItemOnObject(SABER_CONSULAR,oPC);
	}
}

if(GetIsObjectValid(oSaber))
{
	DelayCommand(0.1,AssignCommand(oPC,ActionEquipItem(oSaber,INVENTORY_SLOT_RIGHTWEAPON)));
}
return oSaber;
}

 

Just like before, replace the itemname inside the SABER_GUARDIAN, SABER_SENTINEL, and SABER_CONSULAR strings with your item names minus the uti extension.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...