Kexikus

Adding Feats via Script in K1

Recommended Posts

As the title suggests, I'm looking for a way to give the PC a feat via script.

But all I found was that this is impossible in K1, as the GrantFeat function was introduced in TSL and doesn't work in K1. So now I'm wondering if there's any way around that.

 

My goal is to give the PC lightsaber proficiency for the duration of the training cutscene on Dantooine so that he can equip a lightsaber for the training duel with Bastila, but I don't see a way to do that without lightsaber proficiency. If anyone has an idea how to do that differently, let me know :)

Share this post


Link to post
Share on other sites

As the title suggests, I'm looking for a way to give the PC a feat via script.

But all I found was that this is impossible in K1, as the GrantFeat function was introduced in TSL and doesn't work in K1. So now I'm wondering if there's any way around that.

 

My goal is to give the PC lightsaber proficiency for the duration of the training cutscene on Dantooine so that he can equip a lightsaber for the training duel with Bastila, but I don't see a way to do that without lightsaber proficiency. If anyone has an idea how to do that differently, let me know :D

 

One thing you can do is edit one of the creature hide items (g_i_crhide001, for example) to give it a new template resref, tag, and just the property of bonus feat.

 

Then you'd use a script sort of like this (You'll need to add this global as a String in globalcat.2da):

 

void main()

{

    string sItemInSlot = "NULL";

    object oItemInSlot = GetItemInSlot(INVENTORY_SLOT_CARMOUR, GetFirstPC());

 

    if(GetIsObjectValid(oItemInSlot) == TRUE) //There is an item in the PC's Creature Armor slot

    {

        sItemInSlot = GetTag(oItemInSlot); // Set that string to the tag of the object (this is one reason why making the tag and template resref is important; we can get the tag via scripting, but not the file name or template resref...)

    }

 

    // Set the Global String for use later.

    SetGlobalString("FS_CreHide_Item", sItemInSlot);

 

    AssignCommand(GetFirstPC(), ActionEquipItem(CreateItemOnObject("", GetFirstPC()), INVENTORY_SLOT_CARMOUR, TRUE));

}

 

You'd need to replace the with the template resref of the item you make, and you can change the Global String to whatever you want.

 

Anyways, you'd run that before you tried to equip the lightsaber (so, a node or two ahead), and then you'd run this script at the end of the cutscene:

 

void main()

{

    sItem = GetGlobalString("FS_CreHide_Item");

    DestroyObject(GetItemInSlot(INVENTORY_SLOT_CARMOUR, GetFirstPC()));

 

    if(sItem != "NULL") // If the PC had an item in that slot before you ran the cutscene

    {

        AssignCommand(GetFirstPC(), ActionEquipItem(CreateItemOnObject(sItem, GetFirstPC()), INVENTORY_SLOT_CARMOUR, TRUE));

    }

}

  • Thanks 1

Share this post


Link to post
Share on other sites

When you open a UTC file in KotOR Tool, and you open the inventory, there are two menus. One is labeled Standard Items, the one you see in game, where you choose the gear the character is wearing. The other is labeled Natural Items, which is what Fair Strides talking about. You can't see this screen ingame. This menu shows the items that the developers put on some droids and other creatures throughout the game so that they would be immune or resistant to certain abilities.

 

These items are not considered equipped. They're considered a natural part of that creature. They don't override anything because the game puts absolutely nothing in those four slots. So if you want to give yourself a feat in KotOR, the easy way to do it is to make a new item, using one of the aforementioned natural items (Fair Strides mentioned g_i_crhide001.uti) as a base, and adding the proper parameter.

 

Then, following with the scripts Fair Strides has given, the end result should be the PC and Bastila dueling with lightsabers instead of swords.

Share this post


Link to post
Share on other sites

That kinda makes sense I guess.

 

But wouldn't that replace the armor for the duration of the cutscene? Or is there something I don't understand yet?

 

Yeah, Darth Tyren nailed the explanation dead-on. :)

When you open a UTC file in KotOR Tool, and you open the inventory, there are two menus. One is labeled Standard Items, the one you see in game, where you choose the gear the character is wearing. The other is labeled Natural Items, which is what Fair Strides talking about. You can't see this screen ingame. This menu shows the items that the developers put on some droids and other creatures throughout the game so that they would be immune or resistant to certain abilities.

 

These items are not considered equipped. They're considered a natural part of that creature. They don't override anything because the game puts absolutely nothing in those four slots. So if you want to give yourself a feat in KotOR, the easy way to do it is to make a new item, using one of the aforementioned natural items (Fair Strides mentioned g_i_crhide001.uti) as a base, and adding the proper parameter.

 

Then, following with the scripts Fair Strides has given, the end result should be the PC and Bastila dueling with lightsabers instead of swords.

 

Thanks for explaining all of this, DT. :) I had been in a bit of a rush to get it all typed up before the guy showed up to work on his transmission for his truck...

  • Like 1

Share this post


Link to post
Share on other sites

Sorry for the thread necro, but I have some additional questions on this subject^^

 

First of all, if I give a character a bonus feat using a (natural) item can this character choose the upgraded version of this feat when leveling up?

 

And as the second question: Is there a similar way to grant bonus powers using natural items (or scripts)? I wasn't able to find Bonus Spells as an item property so I doubt it but I figure I'd ask anyway :)

Share this post


Link to post
Share on other sites

As to the first question, I believe no, since equipping something like Davik's Visor (which I believe grants some blaster feats) doesn't allow you to suddenly get upgraded feats at level up. The bonus feat thing works just like in DnD: You get an extra feat. In the case of the Bonus Feat item property, you get the feat for free regardless of prerequisites for as long as the item granting the bonus feat is equipped.

 

As to the second question, sadly there is no way to do this in K1.

Share this post


Link to post
Share on other sites

Yeah, you're right. The bonus feat does not allow you to get the upgraded feats... I guess I'll need to figure out a way around that problem somehow.

 

And the second answer sadly shows once again why K1 modding can be so frustrating...

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.