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.

adding an item to the exiles room

Page: 1 of 1
 rocky348
05-27-2007, 3:57 PM
#1
ok, don't know if this is the proper place to put this, but here we go. I am currently working on a mod that gives the exile battle armor that he designed during the mandalorian wars. I want to put the armor in the exiles room on the harbinger, how would i do this?

ciao for now
 Master Zionosis
05-27-2007, 4:15 PM
#2
You could script the armor into the footlocker, using a script like this:

void main()
{
CreateItemOnObject("YOUR_ITEM_TAG", GetObjectByTag("CONTAINER_TAG"));
CreateItemOnObject("YOUR_ITEM_TAG", GetObjectByTag("CONTAINER_TAG"));
}

Replace YOUR_ITEM_TAG with the tag of your item and replace CONTAINER_TAG with the tag of the container you want the item to appear in, then compile the script.
 tk102
05-27-2007, 8:41 PM
#3
Replace YOUR_ITEM_TAG with the tag of your item

Small note of clarification: actually the first parameter of CreateItemOnObject is the TemplateResRef (the name of the .uti file without the .uti extension), not the Tag. Usually these two are the same, but they don't have to be.
 Master Zionosis
05-27-2007, 10:09 PM
#4
Small note of clarification: actually the first parameter of CreateItemOnObject is the TemplateResRef (the name of the .uti file without the .uti extension), not the Tag. Usually these two are the same, but they don't have to be.

Dang it, i always get them bloody mixed up, note to self: must imprint it into my brain, lol.
 ajc291
05-27-2007, 10:40 PM
#5
Some thing like this (http://knightsoftheoldrepublic.filefront.com/file/Exile_Item_Pack;57068)

I tried to reverse engineer the .ncs file to get the .nss with DeNCS.
But when i recompiled the .nss with some alterations (just wanted to get rid of the armors casue i dont really like them) it didnt work out...so i kinda just abandoned it.

void main() {
vector struct2 = Vector(7.4417, 12.37265, (-0.03665));
int int1 = 1;
location location1 = Location(struct2, 0.0);
object oNearest = GetNearestObjectToLocation(64, location1, int1);
while (GetIsObjectValid(oNearest)) {
if ((GetTag(oNearest) == "MilLowFootLker")) {
CreateItemOnObject("g_i_credits014", oNearest, 1, 0);
CreateItemOnObject("bh_robe_32", oNearest, 1, 0);
CreateItemOnObject("bh_robe_34", oNearest, 1, 0);
CreateItemOnObject("a_belt_15", oNearest, 1, 0);
CreateItemOnObject("a_helmet_12", oNearest, 1, 0);
CreateItemOnObject("w_melee_21", oNearest, 1, 0);
return;
}
oNearest = GetNearestObjectToLocation(64, location1, (++int1));
}
}


thats the script from the file that i reverse engineered (casue i know diddly about scripting)


This script and the mod are not mine
 stoffe
05-28-2007, 7:05 AM
#6
Something like this might work as well: It looks for the container that contains the PC specific armband and then places a new item created from ItemResRef.uti in the same container:

void main() {
object oLocker = GetItemPossessor(GetObjectByTag("a_band_c01"));
if (GetIsObjectValid(oLocker)) {
CreateItemOnObject("ItemResRef", oLocker);
}
}


Dang it, i always get them bloody mixed up, note to self: must imprint it into my brain, lol.

Rule of thumb: Resrefs are used to create dynamic objects (and reference static resources like sounds, scripts and dialog files that aren't objects), Tags are used to manipulate already existing dynamic objects. :)
 Jasher
05-29-2007, 12:19 PM
#7
I don't know squat about scripting either, and I was always hoping there were robes in the footlocker as well (I just assumed the Exile was wearing something more than a jumpsuit when he was aboard the Harbinger).
SO...using the script Stoffe gave, what do I do next?
 rocky348
05-29-2007, 12:41 PM
#8
I don't know squat about scripting either, and I was always hoping there were robes in the footlocker as well (I just assumed the Exile was wearing something more than a jumpsuit when he was aboard the Harbinger).
SO...using the script Stoffe gave, what do I do next?

If you aren't using a custom item:

1) open kotor tool
2) open the RIMS tree
3) open the MODULES tree underneath
4) open the 152HAR_s.rim tree
5) open the Blueprint, Placeables tree
6) open the file g_tresmillow007.utp
7) click on inventory in lower left
8) on left hand side select robes from the list
9) select Jedi Master Robe
10) select the (17)Jedi Master Robe, and drag it over to the right hand side
11) Click ok to close inventory
12) Click save and place the g_tresmillow007.utp file in the games override directory.

Note: you dont have to use the robe I used. I just used it as an example. Hope this helps

ciao for now
 ajc291
05-29-2007, 7:10 PM
#9
I thought about using rocky's method but i think that when u alter g_tresmillow007.utp it will alter all files named g_tresmillow007.utp (there are several foot lockers with the same name)

but i dont really know im a newbie at modding and read this on this thread (http://www.lucasforums.com/showthread.php?s=&threadid=123433)

its on the last post (post#40 by ChAiNz.2da) on the first page
the thread was for KotOR1 tho

@Jasher
Type the script into a text file and save it as <name it whatever>.nss
Then compile it with HazardX's compiler or KotOR Tool's compiler
Use this thread (http://www.lucasforums.com/showthread.php?s=&threadid=143681) for help on using compilers
 stoffe
05-29-2007, 8:18 PM
#10
I thought about using rocky's method but i think that when u alter g_tresmillow007.utp it will alter all files named g_tresmillow007.utp (there are several foot lockers with the same name)


Yes, placing tresmillow007.utp in the override folder would make it replace various containers on the Peragus Admin level, Peragus Mining Tunnels, Peragus Fuel Depot, Peragus Dormitories, Peragus Hangar, Harbinger Command Deck, Harbinger Engine Deck and Nar Shaddaa refugee quad, in addition to the footlocker in the player's old room on the Harbinger Crew Deck. You'd end up with quite a number of duplicates of whatever items that container held.

Generally putting modified placeable containers in the override folder is not safe in K2:TSL since many of them are not uniquely named on a global scope, only in the module they are found in. If you want to edit the template directly you'll need to put it back into the module file you got it from instead of in the override folder.


I don't know squat about scripting either, and I was always hoping there were robes in the footlocker as well (I just assumed the Exile was wearing something more than a jumpsuit when he was aboard the Harbinger).
SO...using the script Stoffe gave, what do I do next?

Replace the text in the script marked in yellow with the name of the UTI file (without the .uti extension) containing the template for the robe you want to place in the container. Then compile the script, put the NCS file in the override folder and add the script to either a dialog or some event that runs in the Harbinger Crew Deck to make it fire and place the robe in the locker.
 rocky348
05-29-2007, 9:55 PM
#11
Yes, placing tresmillow007.utp in the override folder would make it replace various containers on the Peragus Admin level, Peragus Mining Tunnels, Peragus Fuel Depot, Peragus Dormitories, Peragus Hangar, Harbinger Command Deck, Harbinger Engine Deck and Nar Shaddaa refugee quad, in addition to the footlocker in the player's old room on the Harbinger Crew Deck. You'd end up with quite a number of duplicates of whatever items that container held.

Generally putting modified placeable containers in the override folder is not safe in K2:TSL since many of them are not uniquely named on a global scope, only in the module they are found in. If you want to edit the template directly you'll need to put it back into the module file you got it from instead of in the override folder.

are you sure, i went through some of the other files name g_tresmillow007, and they have different name, tag, and apperance! (fields under basic tab)
or doesn't matter? Is it the template resref which matters?
 stoffe
05-29-2007, 10:40 PM
#12
are you sure, i went through some of the other files name g_tresmillow007, and they have different name, tag, and apperance! (fields under basic tab)
or doesn't matter? Is it the template resref which matters?

The game loads resources using its ResRef (filename). Files with the same names can exist in multiple locations. Depending on location it may have a higher priority and thus be used instead of files with the same ResRef in other locations.

Resources located inside module files are only used when that particular module is loaded. As such you can have files that are named the same but do different things located in various module RIM files, but only the file in the currently loaded module will be used.

The override folder, on the other hand, is a global, game-wide scope, like the data in the BIF files. Resources located in the override folder are always available no matter where in the game you are. Unlike the BIF data, the override folder has higher priority than data found in the module RIM files. Placing a file with a certain ResRef (name) in the override folder will cause that file to replace any other resources with the same name found elsewhere.

The priority list goes something like:

1. override folder
2. savegames
3. module RIMs / MODs
4. global data (BIF, texture ERFs etc)

Any resource located in a place lower on the list will be unused if another with the same name located higher on the list exist within the current scope.

So, yes, several g_tresmillow007.utp exist in various modules and they are not identical. But they have the same name/resref, so if you place a file with that name none of the module specific g_tresmillow007.utp templates will be used any more, they will all be replaced with the one in the override folder.

Hence the need to either modify the in-game instance of the placeable via scripts, or put the modified template back into the module RIM it was extracted from, so that it only applies to that particular module/area.
 rocky348
05-30-2007, 3:26 PM
#13
Ok, I didn't know thanks for the info. BTW, is there any other way to modify a rim module then besides the erf editor you built? I used it, and it doesn't seem to be giving me any problems, but I would like to know if there are alternatives to it.

ciao for now
 Jasher
05-31-2007, 1:02 PM
#14
...Then compile the script, put the NCS file in the override folder and add the script to either a dialog or some event that runs in the Harbinger Crew Deck to make it fire and place the robe in the locker.
The NCS file won't just work by itself? How do I do this?
 ChAiNz.2da
05-31-2007, 1:30 PM
#15
The NCS file won't just work by itself? How do I do this?
Easiest way is to attach it to the cutscene dialog that happens just before you enter the room. The one where the Exile suddenly pauses and Atton / Kreia asks you what's up?

It's a guaranteed game "fire" and there's more than enough lines in there to attach several scripts too. Or if you can manage to find a unique door in the area, you can attach it to it's OnActivate/Use field (forget which for doors :o )..
 tk102
05-31-2007, 1:32 PM
#16
The NCS file won't just work by itself? How do I do this?
The script needs to be triggered by something since that's the only way the game knows when to execute them.

You'll need to use DLGEditor (http://www.lucasforums.com/showthread.php?t=135639) to modify an exisiting dialog (I was thinking of the one where you enter your old crew quarters, 152kreia.dlg) and add your script name into the Script #1 field of one of the nodes (such Entry #2 where Kreia says "Are you all right?"). Then put the modified dialog into your Override.

See also this thread (http://www.lucasforums.com/showthread.php?s=&threadid=143356) and the DLGEditor readme for more information.
 rocky348
05-31-2007, 11:05 PM
#17
Easiest way is to attach it to the cutscene dialog that happens just before you enter the room. The one where the Exile suddenly pauses and Atton / Kreia asks you what's up?

It's a guaranteed game "fire" and there's more than enough lines in there to attach several scripts too. Or if you can manage to find a unique door in the area, you can attach it to it's OnActivate/Use field (forget which for doors :o )..


That is exactly what i did, and it worked. here is the source code i used if anyone is interested:

void main() {
object oLocker = GetItemPossessor(GetObjectByTag("a_band_c01"));
if (GetIsObjectValid(oLocker)) {
CreateItemOnObject("battle_armor", oLocker);
}
}

just replace "battle_armor" with the name of the object you are putting in the locker.

ciao for now
Page: 1 of 1