RobyGon

Modify an existing Force Power

Recommended Posts

Hi, I am a guy new to modding Kotor 2. I'm trying to create a mod that balance the vanilla game to a more focused and rewarding experience. Part of the mod is the modification of a lot of the existing force powers. For example, i wanted to modify Force Aura and make it so that it increases your Strenght by 2 and your vitality points by +1 per level (pretty much the same as the Marauder Fury force power minus the saves increase and the defense decrease). I opened the k_inc_force.nss and edited the code of the force power to (hopefully) do what it is supposed to do. Now though, i'm stuck at what to do next. I've read that you need to compile k_inc_generics. I  saved the modified k_inc_force.nss, then opened k_inc_generics and compiled it. I put k_inc_force in a folder named Source and then i dumped this folder + the k_inc_generics into the Override folder. I tried the power ingame and it doesn't work (still gives you the savingthrow stuff).

 

What did i do wrong?

 

this is the part of the code that i modified:

FORCE AURA
        */
        case FORCE_POWER_FORCE_AURA:
        {

            float fDuration = Sp_CalcDuration( 20.0 );
            int nFinalVP = GetHitDice( OBJECT_SELF ) * 1;

            // Remove any lower level or equal versions of this power.
            Sp_RemoveRelatedPowers( OBJECT_SELF, FORCE_POWER_FORCE_AURA );

            // Do not apply the effects of this power if a more powerful
            // version is already attached to the target.
            if( !Sp_BetterRelatedPowerExists( OBJECT_SELF, FORCE_POWER_FORCE_AURA ) ) {

                SWFP_HARMFUL = FALSE;
                eLink1 = EffectTemporaryHitpoints( nFinalVP );
                eLink1 = EffectLinkEffects(eLink1, EffectAbilityIncrease( ABILITY_STRENGTH, 2 ) );
                eLink1 = SetEffectIcon(eLink1, 8);
                eLink2 = EffectVisualEffect(VFX_PRO_FORCE_AURA);

                Sp_ApplyEffects(FALSE, OBJECT_SELF, 0.0, 1, eLink1, fDuration, eLink2, 3.0);
            }

Share this post


Link to post
Share on other sites

AFAIK you need to have the modified k_inc_force.nss in your Override folder when you compile the k_inc_generics. Subfolders might work in TSL but definetly not in K1 so I'd just drop it directly to the override (before compiling!).

Share this post


Link to post
Share on other sites

So i've dumped k_inc_force.nss into the Override folder, i opened Kotor Tool and then opened the k_inc_generics.nss file. Then i clicked on compile and compiled right into the Override folder. The force power still doesn't work though. Same old stuff of increasing saving throws. If the code was wrong the power wouldn't do anything i suppose but the fact that works like in vanilla means that i'm stupid and i keep screwing up something when i compile.

Share this post


Link to post
Share on other sites

Uhm, I'm really not an expert when it comes to this part of KotOR modding but going from the name "k_INC_generics" I assume that this is probably also an include script. IIRC there is a unique script for every force power that probably has the "k_inc_generics" included. Try opening spells.2da and check which script is actually fired for the force power you try to edit. (You can open .2da files directly with KotOR Tool and there should be a column for the script somewhere in spells.2da.)

Then you probably need to find and decompile that script, place both your edited k_inc_force and the vanilla k_inc_generics in your Override and compile the force power script. But as I said, all of that is just my guess. I've never done anything force power related.

Share this post


Link to post
Share on other sites

What Kex said is true, k_inc_generic.nss is also an include script and is not meant to be compiled. You need to compile k_sp1_generic.nss with your new k_inc_force.nss in the override.

 

Here's how I figured this out. The game considers force powers, grenades, droid items, etc.. (anything special you click on in the gui to be used in battle) a spell. So, you go  and check spells.2da, and there is a column 'impact script'. That tells you which script is fired. For force powers, it's k_sp1_generic. If you ever wanted to modify something else (like grenades), check the script in spells.2da,

Edited by bead-v

Share this post


Link to post
Share on other sites

You don't need to use k_sp1_generic for Force powers, though. You could copy the appropriate code to a new script, provided that you edit the 2DA properly. It shouldn't affect any other Force powers, and will be better for compatibility.

  • Like 1

Share this post


Link to post
Share on other sites

You guys are right it's sp1_generics not the inc_generics, i'm dumb i even checked the impact script from the spell.2da but i was sure that it was inc_generics. The thing is that i compile the k_sp1_generics in the override folder (with the k_inc_force into it already), i get the k_sp1_generics.ncs and it still doesn't work. 

 

I don't get what JCarter426 is trying to say though. Like sure, if i had to script an entire new power it would make sense to create it in a new script instead of messing with the k_inc_force.nss but here, i'm just trying to modify (slightly) something that already exist.

 

I'm sorry if i'm being annoying with this simple stuff but i'm really stubborn when something doesn't work and i want to understand why.

Share this post


Link to post
Share on other sites

You're trying to modify an existing power, but to do so you have to compile the whole script for all the Force powers, with all its include scripts, and then if you do that it will be incompatible with any other mod that does the same. But you can pretend it's a new Force power, copy the code from the original script into a new one, and then change the impact script to run yours instead of the original generic one. That way the only game file you are editing is the 2DA and we have TSLPatcher for that.

Share this post


Link to post
Share on other sites

JCs method is definetly the better way to go but if you want to continue with k_sp1_generics, make sure that both k_inc_force and k_inc_generics are in your override as uncompiled files.

Share this post


Link to post
Share on other sites

You guys are right it's sp1_generics not the inc_generics, i'm dumb i even checked the impact script from the spell.2da but i was sure that it was inc_generics. The thing is that i compile the k_sp1_generics in the override folder (with the k_inc_force into it already), i get the k_sp1_generics.ncs and it still doesn't work.

 

It's k_sp1_generic.ncs, without the s.

Share this post


Link to post
Share on other sites

Uh i give up. I restarted this morning from scratch, this time i just changed the duration of the power from 20 secs to 2, just to make sure that my code wasn't problem. I compile k_sp1_generic.nss in the same folder as my modified (uncompiled) k_inc_force.nss, i get the k_sp1_generic.ncs, paste it in the override folder with k_inc_force.nss and it doesn't work.

Share this post


Link to post
Share on other sites

Don't give up! If k_inc_force.nss wasn't in the override when you compiled, then it would have loaded the default one instead, which would explain why you don't see any changes. The include files have to be in the override, and you can compile wherever, and then move the .ncs into the override. By that point, the .ncs already contains the include script, so you could take it out of the override and it should still work.

  • Like 1

Share this post


Link to post
Share on other sites

Uh i give up. I restarted this morning from scratch, this time i just changed the duration of the power from 20 secs to 2, just to make sure that my code wasn't problem. I compile k_sp1_generic.nss in the same folder as my modified (uncompiled) k_inc_force.nss, i get the k_sp1_generic.ncs, paste it in the override folder with k_inc_force.nss and it doesn't work.

I'd suggest trying the new script and 2da method. It might work better, and, as people already said, will be more compatible.

Share this post


Link to post
Share on other sites

Previous post removed

 

 

Edit: Guys i've solved the problem. I'm... uhm dumb. The problem was that i split my kotor 2 installation into another folder, for testing purposes. The problem is that kotor tool, while compiling, was still referring to the old overidde folder thus meaning that me coping k_inc_force into the override was entirelly useless! Now i copied it in the "old" override and it works! I'm sorry for bugging you all with this and thanks!

  • Like 3

Share this post


Link to post
Share on other sites

I'm glad you got it to work :) But stop saying you're dumb, it's happened to all of us, we're all dumb, but if we keep trying we learn :)

  • Like 1
  • 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.