Sign in to follow this  
blinkyzero

GetCreatureHasTalent() and armband shields on Force-using classes

Recommended Posts

Hi folks. For the life of me, I can't figure out why GetCreatureHasTalent() won't recognize armband shields equipped on Force-using classes in KotOR1 (Guardians, Sentinels, and Consulars, obviously). It's almost as though these classes are locked out of accessing the shield entries in spells.2da (99 through 107 for organics, 110 through 115 for droids, though the latter wouldn't apply here, of course). Scouts, Scoundrels, Soldiers, the two droid classes, and even Minions pick up the shield use talents just fine, and in fact so do the Force-users if I add a mundane class to them with AddMultiClass() -- though this has the bizarre effect of throwing a bunch of XP at the player character too for some reason.

 

Is there a restriction buried somewhere in the .2da files that prevents pure Jedi classes from using shields?

Share this post


Link to post
Share on other sites

I don't know if I necessarily have answers for you, but I'm interested in what you're trying to do. I can try doing some investigation for you if you give me some more details. Are you trying to add shield talents to characters so they can use them without equipping the shield? I would be interested to see your code if you don't mind.

 

Anyway, I would not be surprised if there were something hardcoded about the Jedi classes. I don't know of any .2da files that deal with what you're talking about, though I'm not sure what exactly you are talking about. Jedi functionality as it relates to classes is hardcoded, so I would not be surprised if this was hardcoded as well.

Share this post


Link to post
Share on other sites

I don't know if I necessarily have answers for you, but I'm interested in what you're trying to do. I can try doing some investigation for you if you give me some more details. Are you trying to add shield talents to characters so they can use them without equipping the shield? I would be interested to see your code if you don't mind.

 

Anyway, I would not be surprised if there were something hardcoded about the Jedi classes. I don't know of any .2da files that deal with what you're talking about, though I'm not sure what exactly you are talking about. Jedi functionality as it relates to classes is hardcoded, so I would not be surprised if this was hardcoded as well.

 

It's part of a larger mod I'm making to make enemies tougher and a bit smarter. This particular part makes enemy shield use less dumb. As it is, most of those that have the units equipped in their UTC file will use them exactly once -- when combat begins -- and not again (by Bioware's design). I've rewritten some of the relevant code in the combat round calls and a couple places elsewhere to get them to use the shields repeatedly, like a player, and also to equip them from their inventories when a dynamic script distributes them. So far it works perfectly except for the Jedi classes. The failure point is here in GN_ActivateForceField() from k_inc_generic (which of course I have to recompile back into k_ai_master; that's no sweat though):

 

        int nCnt, nStop;

        int bValid = FALSE;

        talent tShield;

        if(GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DROID)

        {

            nCnt = 110;

            nStop = 115;

        }

        else

        {

            nCnt = 99;

            nStop = 107;

        }

 

        while(bValid == FALSE && nCnt <= nStop)

        {

            tShield = TalentSpell(nCnt);

            if(GetCreatureHasTalent(tShield))

            {

                bValid = TRUE;

            }

            else

            {

                nCnt++;

            }

        }

 

        if(GetCreatureHasTalent(tShield))

        {

            GN_MyPrintString("GENERIC DEBUG *************** Clear 1700");

            ClearAllActions();

            ActionUseTalentOnObject(tShield, OBJECT_SELF);

            GN_SetSpawnInCondition(SW_FLAG_SHIELD_USED);

            return TRUE;

        }

 

Quite simply, a pure Jedi class NPC fails to hit on anything during the while loop, even if the shield unit is already equipped in the UTC. The shield talent should be available to them, but they never get it.

Share this post


Link to post
Share on other sites

I'm not sure what's causing your problem. Is it just shields or do you have the same problem with grenades? One compromise you could try is adding some new rows to spells.2da of usertype 1 that call the shield script and then modify that accordingly. Then you could have the Jedi enemies activate shields as a force power. I haven't actually worked too much with talents on enemies, but this would be what I would try next.

Share this post


Link to post
Share on other sites
Guest R2-X2

Your idea sounds very interesting, blinkyzero, smarter enemies are the best way of increasing difficulty I think. :) And by using more of their energy shields, they also potentially reduce the supply of them that the player can loot. Really looking forward to your mod!

Share this post


Link to post
Share on other sites

I'm not sure what's causing your problem. Is it just shields or do you have the same problem with grenades? One compromise you could try is adding some new rows to spells.2da of usertype 1 that call the shield script and then modify that accordingly. Then you could have the Jedi enemies activate shields as a force power. I haven't actually worked too much with talents on enemies, but this would be what I would try next.

 

Yeah, I can't figure it out either. It's not hard to get the shield effect itself on the Jedi -- I can always just fake it by applying the effect and providing the animation -- but that doesn't eat up charges on the shield unit, and I don't think there's any way for a script to burn charges off an item without actually activating it. Suppose I could create a ton of copies that just have depleted charges, then keep track of how many pseudo activations the Jedi uses in order to swap in a faked unit on death...but it'd be ugly and inelegant. I might just skip the shields for them completely as they're already much tougher with the mod as it is right now.

 

Your idea sounds very interesting, blinkyzero, smarter enemies are the best way of increasing difficulty I think. :D And by using more of their energy shields, they also potentially reduce the supply of them that the player can loot. Really looking forward to your mod!

 

Yup, I agree. Right now it all seems to work really well, making combat more tactical (and much more difficult). My aim was to make enemies more equivalent to party members, so I have a dynamic script that adjusts attributes (and, accordingly, saves) to be in line with what a player of the NPC's level would have, alters (oftentimes dramatically) Vitality and Force points to be in line with the actual ruleset, hands out free medkits, shields, grenades, etc. I had to fix Bioware's medkit code -- it chokes on itself and often orders needless double or triple uses of medkits when enemies have more than one available in their inventory -- but it works really well after a few tweaks. It's both really cool and really frustrating to be fighting Sith soldiers now who routinely get down to 20% or so health, then pop a shield and a few medkits and get right back up to full health. I'm also working on a reinforcement system that allows wounded enemies to call for help, though I might scrap that as it's turning out there's a lot of scripted battles in KotOR that even a single additional enemy sort of messes up.

 

Once I get this done, I want to do the same thing with KotOR2, which has a lot of additional scripting power I'm sorely missing in KotOR1 -- like the ability to add feats on the fly without resorting to dumb armbands, the ability for NPCs to set mines, etc. etc.

Share this post


Link to post
Share on other sites
Guest R2-X2

Yup, I agree. Right now it all seems to work really well, making combat more tactical (and much more difficult). My aim was to make enemies more equivalent to party members, so I have a dynamic script that adjusts attributes (and, accordingly, saves) to be in line with what a player of the NPC's level would have, alters (oftentimes dramatically) Vitality and Force points to be in line with the actual ruleset, hands out free medkits, shields, grenades, etc. I had to fix Bioware's medkit code -- it chokes on itself and often orders needless double or triple uses of medkits when enemies have more than one available in their inventory -- but it works really well after a few tweaks. It's both really cool and really frustrating to be fighting Sith soldiers now who routinely get down to 20% or so health, then pop a shield and a few medkits and get right back up to full health. I'm also working on a reinforcement system that allows wounded enemies to call for help, though I might scrap that as it's turning out there's a lot of scripted battles in KotOR that even a single additional enemy sort of messes up.

 

Once I get this done, I want to do the same thing with KotOR2, which has a lot of additional scripting power I'm sorely missing in KotOR1 -- like the ability to add feats on the fly without resorting to dumb armbands, the ability for NPCs to set mines, etc. etc.

I think that Achilles is pretty much right here, saying that minor enemies shouldn't be of the same strength as the "bosses" or the player, and this quote pretty much sums up what I think about "generic" enemies:

"Not all NPCs are bosses, nor should they be. Cannon fodder is cannon fodder, and I really don't consider 15 rounds to kill a cannok "fun". Elite troopers, dark jedi, etc should take multiple rounds to kill (which they do), but since your PC is supposed to be the uber Jedi/Sith coming up on their own, then it doesn't make much sense that everyone else in the galaxy is just as uber as your PC (again, bosses excluded)."

Therefore, I think giving additional equipment (and making the enemies actually use it) is a really good way to not require every enemy to have godlike stats and still put up a challenging fight. You mention feats via armbands, will you use such armbands to give sith troopers feats like rapid/sniper/power shot? Would be nice to have more people than just major enemies actually use ranged feats. :P

 

I think your project has the potential to become the best difficulty mod... and actually make ion weapons useful with those re-used shields. :D

 

On reinforcements: I think they would work in a few areas such as the Leviathan or the Star Forge, where you are supposed to deal with huge amounts of troops anyway and there seem not to be a whole lot of things checking the NPCs you killed (or not). At least on the 2nd Deck each.

Share this post


Link to post
Share on other sites

I think that Achilles is pretty much right here, saying that minor enemies shouldn't be of the same strength as the "bosses" or the player, and this quote pretty much sums up what I think about "generic" enemies:

"Not all NPCs are bosses, nor should they be. Cannon fodder is cannon fodder, and I really don't consider 15 rounds to kill a cannok "fun". Elite troopers, dark jedi, etc should take multiple rounds to kill (which they do), but since your PC is supposed to be the uber Jedi/Sith coming up on their own, then it doesn't make much sense that everyone else in the galaxy is just as uber as your PC (again, bosses excluded)."

Therefore, I think giving additional equipment (and making the enemies actually use it) is a really good way to not require every enemy to have godlike stats and still put up a challenging fight. You mention feats via armbands, will you use such armbands to give sith troopers feats like rapid/sniper/power shot? Would be nice to have more people than just major enemies actually use ranged feats. :P

 

I think your project has the potential to become the best difficulty mod... and actually make ion weapons useful with those re-used shields. :D

 

On reinforcements: I think they would work in a few areas such as the Leviathan or the Star Forge, where you are supposed to deal with huge amounts of troops anyway and there seem not to be a whole lot of things checking the NPCs you killed (or not). At least on the 2nd Deck each.

 

Hmm, yeah, that's a good idea about the Leviathan and Star Forge. Also the Sith base on Taris and a few other places. I agree with Achilles, too; not every fight should be a boss fight, it's just that base KotOR1 (and KotOR2 even more so) gets ridiculously easy even on Difficult, which I at least find ruins some of the fun of becoming a powerful Jedi/Sith.

 

Making the ion guns and shield-breaker abilities more useful was one of my original motivations for tinkering with the shields, yup. And yeah, I've got custom armbands in the dynamic script system that give bonus feats like Rapid Fire and whatnot. Between that, the shields, the medkits, and the leveled playing field that the attribute adjustments provide, the Sith ground troops are actually pretty fearsome in the early game, which I feel they should be.

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