Sign in to follow this  
Alby89

Personal item mod

Recommended Posts

Hi,

i recently had an idea that I’d like to build on the ultimate personal items mod for KotOR 2, that sees the addition of a few nice items and a couple of lightsabers. I have never created a mod before but I would like to know how difficult it is to create an empty container and place it anywhere in the game I.e the ebon hawk or the harbinger. My original ideas were to create a few more personal items and take the lightsabers out and replace them with the original quest lightsaber parts needed to create one so that it fits in with the game a little more. Is this a very difficult thing to do?

Share this post


Link to post
Share on other sites

Saw your other thread. I'll lay out the basic tasks and tools required to perform such a task and we'll take it from there.

1. Get in-game coordinates. Personally using the whereami armband. Works fine for me. Make sure you're looking at the right tab (feedback) in the messages log. There's a mention of a Handy Force Powers mod in this thread. Don't know about it, but it might be worth a look if you can't get the whereami armband to work (conflicting spells.2da, maybe?).

https://deadlystream.com/topic/4656-kotor-tsl-where-am-i-armband/

2. Create a custom placeable. Extract an existing utc file with the Kotor Tool (BIFS/Templates/Placeables), get rid of its vanilla game inventory (more of a KOTOR1 thing, though) and/or loot-spawning script (Scripts tab), give it a new Template ResRef (Advanced tab - mandatory), and Tag/Appearance (Basic tab). Make sure the "Has Inventory/PartyInteract/Usable" items are checked in the Advanced tab. I strongly recommend using the PlasticCrate_cylinder or MetalBox_octogonal appearance (Basic tab) so you won't have to worry about the placeable's orientation.

3. Write/Compile a script  in which you'll spawn the custom placeable at a specific location. The Kotor Scripting Tool is very, very newbie-friendly and will more than suffice for this task. I'll provide a script sample with actual Ebon Hawk coordinates in my next post. I strongly recommend to use the script to spawn both the placeable and its inventory so you'll never have to worry about/manually edit the placeable's utc file ever again. Also, you could theoretically spawn multiple containers and edit their loot across an entire module with a single script.

https://deadlystream.com/files/file/191-kotor-scripting-tool/

4. Extract/Edit a dialog file you'll use to launch the script. For the task you have in mind, extract 003Atton from ERFS/Modules/003EBO_dlg.erf/0.  Once that's done, get the DLGEditor tool. Much easier to look for specific dialogue than with the Kotor Tool's built-in editor. You'll have to find a line of dialogue that cannot be skipped and has a free Script #1/#2 slot (Somebody shut that trash compactor up!"). Type in the name (without the .ncs part) of your script and make sure to click on another line of dialogue so the modification will register.

https://deadlystream.com/files/file/750-dlg-editor/

 

Scripting Time, Part 1

Copy/paste this puppy in the Kotor Scripting Tool and you're good to go. I placed the container in the cargo hold in the corner opposite from the Handmaiden's location. Edit the loot to your heart's content. Don't forget to modify the zzz_HwkBox01 to whatever Template ResRef you'll give to your custom placeable.

Spoiler

void main()
{

///This script uses in-game coordinates to set up a location in which to spawn a custom placeable and its loot.


///Entering coordinates

        float x=32.95f;  
        float y=36.79f;
        float z=1.755f;
        float r=0.0f;

///Converting coordinates in a specific location. The bolded/italic sparts are custom names. Keep it simple. Do not alter anything else.

        vector ModVector = Vector(x,y,z);
        location ModLocation = Location(ModVector, 0.0);


///Creating the custom placeable. Once again, the bolded/italic parts are custom names.
///The zzz_HwkBox01 is the custom placeable's Template ResRef from its utc file. Make sure they match.

        object oHwkBox01=CreateObject(OBJECT_TYPE_PLACEABLE, "zzz_HwkBox01", ModLocation);


///Adding items to the placeable's inventory. Items usually have the same Template ResRef and Tag. Stick to that formula while creating your own custom items.

        CreateItemOnObject("lspart01", oHwkBox01);
        CreateItemOnObject("lspart02", oHwkBox01);
        CreateItemOnObject("lspart03", oHwkBox01);


///Multiple instances of the same item. I've been getting odd results while using other types of credits stacks, so I'm giving you this one that works as a reference.

        CreateItemOnObject("g_i_credits001", oHwkBox01, 1000);


}

 

Scripting Time, Part 2

This one's actually a lot simpler, but if you ever feel like it, this is how you add loot to an existing container. More of a KOTOR1 thing, though. As a bonus, I've thrown in lines that show you how to give unique loot to each of the starting classes. Just don't forget that compiling this thing and dumping it into your override folder won't do a thing unless you've edited a dlg file so the script can be fired.

Spoiler


void main()
{

///This script adds loot to an already existing container.

///The bolded/italic sparts are custom names.
///The zzz_HwkBox01 is the custom placeable's Template ResRef from its utc file. Make sure they match.

    object oHwkBox01=GetObjectByTag("zzz_HwkBox01");    

 

//Basic inventory: credits along with red/purple crystals

        CreateItemOnObject("g_i_credits001", oHwkBox01, 1500);
        CreateItemOnObject("u_l_colo_04", oHwkBox01, 5);
        CreateItemOnObject("u_l_colo_05", oHwkBox01, 5);


///Guardian-specific equipment: blue crystals
    if (GetLevelByClass(CLASS_TYPE_JEDIGUARDIAN,GetPCSpeaker()))
    {
        CreateItemOnObject("u_l_colo_01", oHwkBox01, 5);
    }

///Sentinel-specific equipment: yellow crystals
    else if (GetLevelByClass(CLASS_TYPE_JEDISENTINEL,GetPCSpeaker()))
    {
        CreateItemOnObject("u_l_colo_03", oHwkBox01, 5);
    }

///Consular-specific equipment: green crystals
    else if (GetLevelByClass(CLASS_TYPE_JEDICONSULAR,GetPCSpeaker()))
    {
        CreateItemOnObject("u_l_colo_02", oHwkBox01, 5);
    }

}

 

Edited by FluffyHK47
  • Light Side Points 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this