Jump to content

Home

how to plant player made items in the game


Commas

Recommended Posts

i just wanted to know what would be nessesary to put the player made items into the game, like putting t7's dark side lightsaber in naga sadow's tomb instead of the crappy sity saber and to put other items elsewhere so i dont have to use cheats and the game still flows nicely with the new items

Link to comment
Share on other sites

You can try to rename my saber to k39_itm_cersaber Which is the name for the sith Lightsaber. It might override the sith saber, I haven't tested this, but I think Shimaon has already done this very thing.

For it to work properly the upcrystals.2da will also have to changed.

 

If someone wants to test this that has a save right before going into the temple I would be intersted to know if it works. I tried using a warp cheat ,but that just brought me to the entrance and i couldn't enter.

Link to comment
Share on other sites

thanks for the reply, on not on korriban yet, but when i get there i'll let you know if it works, and i dont really mind if it replaces the sith saber, as long as i can still complete the quest with the new saber

 

also is there a way to place an item into any of the other foot lockers in the game without replacing something already in there, and also is it possible to add things to the replicater in the star forge (the one you get the star forge robes from) like for a specific number a spikes i can tell it to put your guardian of the light saber in the replicater bin along with my star forge robes?

 

basically i just downloaded a few cool mods, including t7's sabers and i want to find a way to add them into the game without using cheats, to keep the flow of the game coherent.

 

thanks again

Link to comment
Share on other sites

Originally posted by i like commas

also is there a way to place an item into any of the other foot lockers in the game without replacing something already in there,

 

Yes it is possible. Here I have uploaded a small compiled script file that do just that. It will put T7 lightsabers as well as Shimaon's lightsabers into the Metal box in the ebon hawk. All you have to do is go talk to Mission in the ebon hawk and ask to play pazaak. You still need T7 and Shim's mod files.

 

The source code is this:

void main()
{
   CreateItemOnObject("T7_w_dblsbr072", GetObjectByTag("MetalBox"));
   CreateItemOnObject("T7_w_lghtsbr74", GetObjectByTag("MetalBox"));
   CreateItemOnObject("T7_w_dblsbr070", GetObjectByTag("MetalBox"));
   CreateItemOnObject("T7_w_lghtsbr70", GetObjectByTag("MetalBox"));
   CreateItemOnObject("shi_a_robe01", GetObjectByTag("MetalBox"));
   CreateItemOnObject("shi_w_lghtsbr01", GetObjectByTag("MetalBox"));
}

 

You can replace those file names with any other new items that you want. Additionally, you can be more creative and place these items somewhere else in the game by changing the object Tag. Or, you can put the script file to be called from somewhere else, say like the Starforge computer that you mentioned.

Link to comment
Share on other sites

hey gameunlimited, Im a little confused. What is it that says that those objects are only in the metal box on the ebon hawk.

When it comes to scripting I barely have a clue.

 

Also another thing is if I want to make a new container and have an object to appear in a certain area or on a certain person or creature what would I need to do. Is it just a matter of writeing a script thats spawns an object or do I have to add the objects to the area git and have a script as well.

 

I have been trying to figure out how to do simple things like this, but I am at a loss. I pretty much understand what all the files are that makes up an area and how to add them. well sort of.

 

Can you recomend a good tutorial or site for writing scripts

:confused: I have gone though alot of what is at bioware about scripting, but those requirer the NWN which i do have it's just that the tool set takes short cuts that we aren't able to make yet.

 

Anyway you can help would be appreciated.

Link to comment
Share on other sites

What is it that says that those objects are only in the metal box on the ebon hawk.

 

It is because the script is being called in the ebon hawk module. The function "GetObjectByTag" will return an object in the current module. In fact, there are two metal boxes in the ebon hawk. This function will return one of it, randomly perhaps. If you need to select one container but not the other, maybe you can use the function "GetNearestObject".

 

Also another thing is if I want to make a new container and have an object to appear in a certain area or on a certain person or creature what would I need to do. Is it just a matter of writeing a script thats spawns an object or do I have to add the objects to the area git and have a script as well.

 

Whenever you write a script that spawns an object, it will modify the git file in your savegame. So one or the other will suffice. I think the best way to do this is to modify the git file and put a placable container with a unique tag. Then use the script like above to spawn whatever you want into that container. This way, I can have flexibility on what items I will put in the container, say depending on the player choices. Or (i have not tested this) if you know what item for sure you want to put, i think you can specify what items are in the container right from the .utp file itself. Under the node "Item List" or something, not sure about this one.

 

As for a good scripting tutorial, I usually take a look at those non compiled scripts to find these functions. The bioware forum seems a good place also.

Link to comment
Share on other sites

I thought I might as well throw out some common functions that is commonly used for spawning object for those who wants to try.

 

CreateItemOnFloor("ItemFileName", location);

 

CreateItemOnObject("ItemFileName", object target, int NumberOfItems);

 

GetFirstPC(); -->Returns the PC player, very useful if you want to put item directly in your inventory

 

GetNearestObjectByTag("Tag", object Target, int NthClosestObjectFromTarget);

 

So if I want to spawn three copies of item with file name "my_item" in a container second closest to me which has the tag "container001", the script would be:

 

CreateItemOnObject("my_item", GetNearestObjectByTag("container001", GetFirstPC(), 2), 3);

Link to comment
Share on other sites

Thanks i'll try and digest that. It sounds simple. ok forgive my ignorance, how do they work :confused: I think I am going to have to learn C/C++ :(

 

CreateItemOnFloor("ItemFileName", location);

 

ok so this is replaced with the name of the item "ItemFileName".

how does "location" work. do i leave it the way it is or do I need to add somthing like this to specify what location like location="area name" then

location Location(vector vPosition, float fOrientation)

 

I have pritty much the same questions for the rest that you posted.

 

maybe I am just overthinking this thing or im tired.

gameunlimited if you don't mind giving a detailed explenation of those scripts I would really appreciate it. Just think of me as a retarded baby, lol :D

Link to comment
Share on other sites

My bad if I did not make it that clear. :p

 

To create an object on the floor, I would suggest if you use the function "CreateObject" instead. The syntax is as follow:

 

CreateObject(int nObjectType, string sTemplate, location lLocation)

 

So this means, to call this function, you need to put forward 3 parameters, the first one is an integer, then a string, then a location. The first one, int nObjectType, should be replaced by either one of these:

 

OBJECT_TYPE_ITEM

OBJECT_TYPE_CREATURE

OBJECT_TYPE_PLACEABLE

OBJECT_TYPE_STORE

 

Pretty straight forward, if you want to spawn a creature, then replace "int nObjectType" with "OBJECT_TYPE_CREATURE".

 

The second parameter is the filename such as "g_w_lghtsbr01".

 

Now the location is little bit tricky. As you mentioned, a locations is declared as Location(vector vPosition, float fOrientation). However, to declare a location, you need to supply two more different parameter, vector vPosition and float fOrientation. A float is a standard variable, you can just put numbers like 3.1475315. However, a vector is tricky also, you have to declare it beforehand. The syntax is

 

vector Vector(float x=0.0f, float y=0.0f, float z=0.0f)

 

Perhaps it is easier if you take a look at this sample code

void main()
{
   vector MyVec = Vector(52.0, 42.0, 2.0);    //line 1
   location MyLoc = Location(MyVec, 0.0);     //line 2
   CreateObject(OBJECT_TYPE_PLACEABLE, "metalbox001", MyLoc); //line3
}

 

First, what I did is to declare a vector called "MyVec" in line 1. Those three numbers correspond to the x, y, and z coordinates. You can get this numbers by using the cheat command in the game "whereami". Go to whereever you want to spawn the object then type it to get the coordinates.

 

Next in line 2, I declare another variable, this time is a Location variable. I supply the "MyVec" vector variable into this function as a parameter. The second parameter of the Location function is a float number. (A float is simply a decimal number) It corresponds to the direction the object will be facing once spawned. Now you got yourself a location variable called MyLoc. Now you can use this for the CreateObject function.

 

Note: if you input a number, let say"1", into a function that required a float, you might get an error as the compiler will treat "1" as an integer. You have to use "1.0" instead to do this, as only floats can have decimals.

 

So basically, that script above will create an object with the filename "metalbox001" in the coordinate 52.0, 42.0, 2.0. (this coordinates correspond to the center room where T3 stands in the ebon hawk).

 

Save the above code as "k_act_mispaz.nss" then compile it. I usually use nwncompiler. This is the script that is called whenever you play pazaak with mission. Do that and a metal box will be spawned. :)

Link to comment
Share on other sites

As for the other function that I mentioned earlier, these are the more clear definitions of the as taken from the KotOR script itself.

 

 

object CreateItemOnObject(string sItemTemplate, object oTarget, int nStackSize)

 

object GetFirstPC() **highly useful**

 

object GetNearestObjectByTag(string sTag, object oTarget, int nNth)

 

location GetLocation(object oObject) **highly useful**

 

 

 

So for example, you have supply a string, an object, and an integer to call the function CreateItemOnObject. (If you leave some parameters blanks, sometimes the function will still work. It will assign a default value for itself). Meanwhile, the function GetFirstPC does not require you to supply anything.

 

Now unto the different types of variables:

 

String: A string can contains text in it. To supply a string DIRECTLY, you have to use the quotation mark. However, if you supple a variable name, you can not use quotation mark. Example: (these are not real ingame functions)

 

Print("Hello World") not Print(Hello World).

 

However, you can do it this way too:

 

string MyString = "Hello World";

Print(MyString);

 

 

Integer: Simply put an integer number, remember no decimals allowed.

 

Float: These are decimals. If you want to supply 100, either write it as 100.0 or 100f. The f tells that it is a float.

 

Object: Objects are that objects. It can be an item, a creature, a waypoint, or most other ingame objects. You can not define object from scratch. You should use some of the functions such as GetFirstPC() to return an object.

Example:

 

object MyObject = GetFirstPC();

 

That line means, create a variable MyObject, then assign the Main Character into it. There are many other functions that can assign different in game objects into a variable.

 

Location: See my previous post. Alternatively, there are some functions that return a location. The most common one is the GetLocation(object oTarget). Example:

 

location MyLocation = GetLocation(GetFirstPC());

 

Those are about the common ones that are found quite often. Hope this help.

Link to comment
Share on other sites

i'm glad someone is beginning to understand, lol

 

i know pretty much nothing about modding and had no idea how complicated these things got.

 

thanks for all of your help guys, you all rock

 

i really glad people like the idea of player made items being placed later in the game, as using the give item cheat kinda takes away from the game a little, especially which such powerful items, that would make the game a little two easy early on, but will help a lot later in the game, especially when using the hardcore mod like i plan to on my next couple games

 

good luck to the people trying to do this, i hope you post it if you guys figure it out :)

Link to comment
Share on other sites

  • 3 months later...

I'm knew to this entire thing. I've started downloading mods and creating my own only a few days ago, and I'm picking up pretty quickly. I'm not exactly sure how that scripting works though. I see you, gameunlimited, gave a had to give a location variable and you altered the file so that a custom item containing metal box would spawn in the center of the Ebon Hawk when you tried to play Pazakk with Mission. What I'd like to know is how you place similar custom items on the remains of enemies, like Davik or Brejik. I assume that the format would be similar, but that a different file would have to be altered and the location variables wouldn't be quite the same. Coudl you please explain how that would work.

 

I think I understand everything gameunlimited has done, but I'm not really sure. I get better as I try stuff, so I'll probably understand everything after I've messed with it a while. I'd still like to go ahead and ask incase I get stuck, but I will try it myself with the information you have given so far. Thanks.

Link to comment
Share on other sites

Originally posted by True_None

What I'd like to know is how you place similar custom items on the remains of enemies, like Davik or Brejik.

 

If you want items to appear on npc corpes all you have to do is find the utc for the npc and add the items to the item list so for Davik it would be tar08_davik082. you can find it @ RIMs-->Modules-->tar_m08aa_s.rim--> blueprint,Character.

 

Simply double click tar08_davik082 and the utc editor will pop up, then click the Inventory button in the lower left corner. Simply drag the item off the Game items tab to Pack Inventory . when your done click ok then save the file to override and when davik dies you will get to plunder the loot you added. *note, For this to work the area would have to be loadedfor the first time so that the game will load the file in override instead of the one in the module.

Link to comment
Share on other sites

Originally posted by T7nowhere

*note, For this to work the area would have to be loadedfor the first time so that the game will load the file in override instead of the one in the module.

 

What do you mean the first time. Do you mean before I enter Davik's Estate, or before I ever start a new game.

 

:fett:

Link to comment
Share on other sites

  • 5 months later...

hey gameunlimited i was just wondering if you know how to give a recuiteble npc a lightsaber with a costum made sabercrystle in it because i made a recuiteble npc and i made a light saber and a implant a robe and a crystle and i made it so my costum npc was holding them when you recruited him but the only problom is that i don't know how to get him to have my costum made sabercrystle in the lightsaber (or even just have them so you could just do a upgrade on your light saber that put it in the lightsaber but for some reason i can't get him to have it when i recruite him PLEASE HELP.

 

:firehead:lightning

 

:newbie:

Link to comment
Share on other sites

Simply edit the utc file with Kotor tool or GFF editor to add the item in your npc's inventory.

 

@ Darkender: on the contrary, I encourage Withguy to post his questions on the boards instead of using PM.

 

It benefits to other persons that may have the same questions, especially since the search function has been temporarily turned off. Also, it is to the advantage of the person who asks the question: many times there is more than one way of doing things. This community has been able to develop because people were sharing the info on the boards. If everyone would always work via PM, then Holowan labs would not exist and Kotor modding would be far less developped than it is and accessible only to a few.

 

...and this is not a dead thread: although Gameunlimited is no longer coming to the forums, I just pointed Withguy to t7's sticky Do you want to mod SW-Kotor? then start here. were there is a link to the present thread. Please leave forum policy issues to the moderators.

Link to comment
Share on other sites

________________________________________________

 

Originally posted by Darth333

 

Simply edit the utc file with Kotor tool or GFF editor to add the item in your npc's inventory.

________________________________________________

 

thanks Darkender and darth333 for the help but i all ready did what darth333 did and it still isn't there when i recruite him so either i messed up on my item or something or i just didn't do it right.

 

:firehead:lightning

 

:newbie:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...