Jump to content

Home

Placing things


JediKnight707

Recommended Posts

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:
CreateItemOnObject("my_item_template",oContainer);
}

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.

Link to comment
Share on other sites

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:

-26.33176

11.75565

9.11693

Orientation=138.02206

Bearing=2.40894

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

(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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...