View Full Version : Placing things

10-04-2005, 03:05 PM
I was thinking of putting my sabers from my Movie Saber mod (http://pcgamemods.com/mod/16417.html) inside the corpse like this person's mod (from the Holowan Plugin) did here (http://photobucket.com/albums/a264/SolidSnake19/?action=view&current=corpsels.jpg). Or maybe doing it like this (http://photobucket.com/albums/a264/SolidSnake19/?action=view&current=deaddude.jpg) and this (http://photobucket.com/albums/a264/SolidSnake19/?action=view&current=corpseguy.jpg) where I just put in a dead body. I was wondering how I would do this.

10-04-2005, 03:15 PM
Check the sticky tutorials:

Non-scripting method: http://lucasforums.com/showthread.php?t=134067 (note that you have to be sure that your .utc or .utp file is unique to use this method - use tk102's findrefs to search.)

Scripting method (safe): http://lucasforums.com/showthread.php?t=143536

10-04-2005, 03:15 PM
with TSL it gets tricky ;)

You'll need to do some scripting work. This thread should point you in the right direction :)


10-04-2005, 03:27 PM
*crying* I was hoping that it didn't have to have any scripting involved. Alas, its for the greater good, so I should be grateful :) (BTW Can anybody help me with the scripting?)

10-04-2005, 03:42 PM
Unless somebody beats me to it I'll try to throw an example script up for you tonight.

10-04-2005, 03:46 PM
J_k_707: A lot of people are scared by scripting but without reason. Trust me, scripting is not difficult.

Start reading the tutorial. It has quite a few exmaples in it and if you have questions just ask them.

Basically, the tutorial is just asking you to copy and paste the script, change the area name, the tag of the placeable and the template of your item and finally compile. Once you've done it once, you'll find it easy the next time :)

Give it a try and paste your final script here if you want us to review it.

Edit: basically, a simple script to place an object in a container or npc is:
void main()
//target the object on which you want to place the item
object oContainer=GetObjectByTag("container_tag");

//tell the game to create your item on the targetted container:

Replace container_ tag by the tag of the .utc or .utp on which you want to place the item and replace my_item_template by the template of your item.

The above code will work fine if you attach it to a unique dialogue branch that will not be repeated. However, if you attach it to a non unique dialogue branch or the area onenter event and don't set a variable as explained in tk102's post in the tutorial, a new item will be spawned each time the dialogue line is repeated or each time you enter the area.

10-04-2005, 04:18 PM
This is what I came up with by using RedHawke's script in the tut:

void main()
float x=0.00f; //Here is where you add the 'whereami' cheat coordinate 1.
float y=0.00f; //Here is where you add the 'whereami' cheat coordinate 2.
float z=0.00f; //Here is where you add the 'whereami' cheat coordinate 3.
float r=0.0f; // This is where you set the orientation of the placeable, set in degrees.
vector MyVec = Vector(x,y,z); //line 1
location MyLoc = Location(MyVec, r); //line 2
object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", MyLoc); //line3

CreateItemOnObject("anakin_saber", oLocker);
CreateItemOnObject("obiwan_saber", oLocker);
CreateItemOnObject("jinn_saber", oLocker, 2);
CreateItemOnObject("palpatine_saber", oLocker);
CreateItemOnObject("yoda_saber", oLocker);
CreateItemOnObject("maul_saber", oLocker);
CreateItemOnObject("windu_saber", oLocker);
CreateItemOnObject("luke_saber", oLocker);

As far as I can tell, all I need to change is the coordinate things. But I have never done a script, so I don't know.

EDIT: And here are the coordinate's I'm going to use:

10-04-2005, 04:24 PM
1. You can get the coordinates of where to place your container/corpse or wahtever with my wehreami armband: http://www.lucasforums.com/showthread.php?s=&threadid=144260

(edit: I see you already have the coordinates, just ignore the bearing - the script uses orientation - degrees.)

2. change footlker099 by the template of your custom container

3. In the lines where it says CreateItemOnObject("anakin_saber", oLocker)
replace anakin_saber by the template of your .uti

4. compile: http://lucasforums.com/showthread.php?t=143681

5. drop the .ncs (compiled script), .uti and .utp file in the override folder.

10-04-2005, 04:27 PM
(BTW Can anybody help me with the scripting?)

(Here is one variant of doing it. This is a modified script for opening the door to the morgue, a_doormor.nss, which will spawn two lightsabers at the corpse that holds the plasma torch. Since that corpse does not have an unique tag we check for the object that currently possesses the torch instead.)

// ST: a_doormor.nss

void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("CustomSaber", oCorpse);

Change where it says CustomSaber to the Resref (filename without .UTI suffix) of your custom saber.

Compile that script and save the resulting a_doormor.ncs file in Override, and the saber should spawn on the corpse when you use the medbay computer to unlock the morgue door.

10-04-2005, 04:29 PM
(This is for Darth's questions)
2. Can I simply name it footlker099 or do I HAVE TO change it? I just think that it would be easier with it like that.

3. anakin_saber is the name of m .uti file that I want to include

4. Ok

5. I didn't edit any .uti or .utp files

10-04-2005, 04:34 PM
Redhawke' s script will spawn a new custom container with your items in it.

You don't need to drop the .uti file in the override folder if the item is already in the .bifs but since it's your custom sabers, you'll have to point to your custom .uti files.

Give a try to stoffe's script :) If you need something more specific, a corpse or a container in particular, tell us which one exactly.

10-04-2005, 04:45 PM
Here's what I've got with stoffe's script:

void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("anakin_saber", oCorpse);
CreateItemOnObject("jinn_saber", oCorpse);
CreateItemOnObject("luke_saber", oCorpse);
CreateItemOnObject("maul_saber", oCorpse);
CreateItemOnObject("obiwan_saber", oCorpse);
CreateItemOnObject("palpatine_saber", oCorpse);
CreateItemOnObject("windu_saber", oCorpse);
CreateItemOnObject("yoda_saber", oCorpse);

All I need to do is compile it right?

10-04-2005, 04:55 PM
looks good :)

10-04-2005, 05:03 PM
It looks good, but alas something is wrong. It won't open the morgue door, even when I tell it to. Any idea's why?

10-04-2005, 05:25 PM
It looks good, but alas something is wrong. It won't open the morgue door, even when I tell it to. Any idea's why?

Hmm, it works just fine here (after changing the resrefs to something I have), so you may have made some kind of mistake. How and with what did you compile the script? Did you name the script properly?

10-04-2005, 05:32 PM
I probably compiled it wrong. I named the script just as how you said to name it, and I stuck nwnnsscomp.exe in override, along with my script. Then I put in this nwnnsscomp -v1.00 *.nss too.

10-04-2005, 06:10 PM
which compiler are you using? With Fred's you have to specify the game : -g 2 for kotor 2

10-04-2005, 06:17 PM
Yes, I'm using Fred's. So how would I do it?

10-04-2005, 06:21 PM
read this: http://lucasforums.com/showthread.php?t=143681 in the part where it says: "B. How to use Fred Tetra's script compiler/decompiler"

You don't need the -v1.00 switch with Fred's compiler.

10-04-2005, 06:25 PM
Ok, I was wondering, do I place this nwnnsscomp -c -g 2 my_script.nss as a seperate notepad thingy, or in the same notepad as my script?

10-04-2005, 08:02 PM
neither: you use it when you run nwnnsscomp.exe (in the command prompt)

10-04-2005, 08:24 PM
I ran nsscomp, and it said ''Compilation complete: 1/1 file compiled" but there were no other files.

Det. Bart Lasiter
10-04-2005, 11:53 PM
Try injecting a script (http://lucasforums.com/showthread.php?t=137370). Just follow beancounter's instructions and execute an original copy of the script, although I would try compiling the script from KT's project manager first.

10-10-2005, 04:29 PM
I have found 2 unique places on peragus where I can put my items without scripting. I stiil search for more.
One of this is Kreia's corps on peragus morgue.
All you need to do is to open gencrps004.utp (2060) with kt (is located in 101PER_s.rim/Blueprint, Placeables.
Then check "Has Inventory" box on "Advanced" tab (http://q-net.netfirms.com/programing/07.html) and hit "Inventory" button (bottom left).
Add on inventory whatever items you want (also you can add custom datapad which is open right after take-him). Save this file in override dir and start a new game.
There are 2 gencrps004.utp in game. One on damaged Ebon Howk- tutorial part and this one from the morgue. This modification have no effect on Kreia's corpse on EH.
Just be sure to search Kreia's body before she wake-up. (http://q-net.netfirms.com/programing/08.html)

Good luck.