Author Topic: Yet another henchman struggle - a druid keeps on changing shapes  (Read 695 times)

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« on: February 17, 2014, 05:49:54 pm »


               I've frankly had enough with henchmen already, but oh well, I gotta finish what I started.
Probably the last problem I have (or at least I hope so) lies with the druid henchman.

He keeps on changing shapes when fighting. He does it so often he sometimes will change it right after he already did. He's much easier to defeat due to this (after all, he spends a huge part of his fighting time on shapeshifting).

I guess it would be easy to fix with a normal NPC, by just removing all shapeshifting feats apart from the one you want him to use. But what can be done about a henchman so that he would, for example, go for one specific shape (dependant on level) and keep it?
               
               

               


                     Modifié par Grani, 17 février 2014 - 05:51 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #1 on: February 18, 2014, 08:24:13 am »


               That would need specific coding in AI for this case. The biggest issue with this is method/decision how and what such henchman use.
               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #2 on: February 18, 2014, 11:27:15 am »


               I had exactly this problem in EI2. The companion Chabo was supposed to be an avatar of the wolf spirit, so I didn't want the other appearances. Fixing that also seemed to stop the endless shape-shifting during combat, making her a pretty good asset.

Here's my version of nw_s2_wildshape. There's just one custom code block, as the comments indicate, so you can just drop those lines into your version of the script.

EDIT : seems like the code tag is broken these days?
               
               

               


                     Modifié par Proleric1, 18 février 2014 - 11:42 .
                     
                  


            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #3 on: February 18, 2014, 11:46:25 am »


               That seems to be a good solution, indeed!
My concern is, will it work when the henchman has more than one shapeshifting feat?
At high levels, for example, he will have wild shape and elemental shape. Even if I add a block of code like yours to both scripts, so that using both feats would always result in, let's say, water elemental, won't he try to switch between shapes anyway?

Because that's the biggest problem - he switches between shapes instead of fighting, wasting time and getting killed.

I'll check it myself later today, but if you can answer it earlier, I'll appreciate it. '<img'>

ShaDoOoW wrote...

That would need specific coding in AI
for this case. The biggest issue with this is method/decision how and
what such henchman use.


A decision shouldn't be that bad. It shouldn't be difficult to make him use his "strongest" shapeshifting. If he has elemental shape, he shouldn't use wild shape, etc. This could be done with simple checks. What would be more difficult is making him choose a shape well-suited for a given situation. So that he would turn into a water elemental when facing a fire giant and not any other. But even without going so far, if he could just choose ANY shape and stay in it, it would already be a huge improvement.
               
               

               


                     Modifié par Grani, 18 février 2014 - 11:52 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #4 on: February 18, 2014, 12:34:34 pm »


               

Proleric1 wrote...

I had exactly this problem in EI2. The companion Chabo was supposed to be an avatar of the wolf spirit, so I didn't want the other appearances. Fixing that also seemed to stop the endless shape-shifting during combat, making her a pretty good asset.

Here's my version of nw_s2_wildshape. There's just one custom code block, as the comments indicate, so you can just drop those lines into your version of the script.

EDIT : seems like the code tag is broken these days?

This fixes nothing actually. Its just a clever workaroud.

The AI still choose the shapesthing feat and force creature to use it. This wont happen if the creature has only one feats (because she will be under that feat effect) but will happen if the creature has more than one shapeshifting feat which is the Grani's case.

But as long as you can control the creatures feats, your solution Proleric will work perfectly. But Grani cannot do that unless he will make the henchman blueprints for each level which is something that might be a workaround if he doesnt allow multiclassing.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #5 on: February 18, 2014, 12:35:45 pm »


               

Grani wrote...

A decision shouldn't be that bad. It shouldn't be difficult to make him use his "strongest" shapeshifting. If he has elemental shape, he shouldn't use wild shape, etc. This could be done with simple checks. What would be more difficult is making him choose a shape well-suited for a given situation. So that he would turn into a water elemental when facing a fire giant and not any other. But even without going so far, if he could just choose ANY shape and stay in it, it would already be a huge improvement.


you are right, I could bake something for this issue, will take a closer look into it
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #6 on: February 18, 2014, 01:06:03 pm »


               I can't make separate blueprints for each level because I have a randomized henchman system in which the player chooses a class to hire and a henchman is generated with random gender, race, face and hair/skin color. For that purpose, I already have 14 druid blueprints (every playable race and gender combination). If I were to use that method, I would end up with 560 blueprints of, in fact, a single henchman.

But please let me know if you come up with something, Shadooow.
               
               

               


                     Modifié par Grani, 18 février 2014 - 01:08 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #7 on: February 18, 2014, 04:10:17 pm »


               Ok I took deeper look and its bad, very bad.

I made a simple adjustment that is cause not to switch shapes. Easy to do really, still the polymorphing AI is critically bugged.

NPC in polymorph can stlll access all the spell related talents she have (and I suspect than when casting then it doesnt reduce their count) so she will polymorph into elemental and then just spaming spells like she was at normal shape. While this is not such a bad idea at all (since in DnD 3.5 there is a feat that allows that normally) its problematic due to the unlimited ammount of the spellcasting.

Also unlike my expectation she doesnt always automatically choose elemental shape but often animal shape instead (druid 40 tested). Dragon shape was ignored.

So what this would deserve is complete overhaul at least.

Here is my proposal:

1. Polymorphing will be allowed only when NPC runs out of the offensive spells.
2. When polymorphed, no spellcasting will be possible. (There might be few cases when the creature could be allowed to use the elemental pulses or dragon breath though.)

That means that creature will never unpolymorph willingly. Something to consider and decide.
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #8 on: February 18, 2014, 05:08:02 pm »


               Well then, looks like polymorphing AI is totally broken.

Actually, I wouldn't mind that much if an NPC could cast spells without limits while pomymorphed.

I just had a thought, though. Would it be possible to add NPC polymorph options accessible via conversation, in a similar way to spells? This means that PC would need to tell the henchman before battle which shape to use, which is a disadvantage, but on the other hand, it would allow for flexibility, would remove the problem of henchman using shapes inappropriate to given situations and would (maybe, because I'm not sure if it would) allow for easier fix of constant shapeshifting problem, by disabling shapeshifting at all in the AI and only allowing it via conversation.

What do you think about it, Shadooow? Could this be done?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #9 on: February 18, 2014, 05:28:10 pm »


               UPDATE: made those adjusments and turn out pretty good except the fact that polymorphed creatures doesnt use the special abilities form polymorph - I debugged this and found out that the engine simply doesnt grants them to NPCs. So any special shape attacks would have to be faked which is another problem. Solvable but...

Grani wrote...

Well then, looks like polymorphing AI is totally broken.

Actually, I wouldn't mind that much if an NPC could cast spells without limits while pomymorphed.

I just had a thought, though. Would it be possible to add NPC polymorph options accessible via conversation, in a similar way to spells? This means that PC would need to tell the henchman before battle which shape to use, which is a disadvantage, but on the other hand, it would allow for flexibility, would remove the problem of henchman using shapes inappropriate to given situations and would (maybe, because I'm not sure if it would) allow for easier fix of constant shapeshifting problem, by disabling shapeshifting at all in the AI and only allowing it via conversation.

What do you think about it, Shadooow? Could this be done?

Well most of the polymorphing was removed from AI or made unusable by NPCs (see tenser spellscript). Seems that the problems with polymorphing was well known to Bioware but they didnt had a time to fix it. I think that those feats that are useable by AI are just leftovers...

Anyway. Would that be possible? Yes of course its possible, but its something I have no desire in such option (or to be precise - im trying to help you because it might be something I could add into my patch project, however new henchman convo options aren't possible for my project) so it would be quite a lot of work for nothing actually. I do help peoples but you want too much.

Might be great addition to the Tony K AI if someone ever tries to update it/improve it.

And turns out that adding the code I just done into CPP is not possible due to the fact that already existing creatures in already made modules would be suddenly polymorph which would change gameplay significally in an undesired way...

for anyone who wants to continue with this, there is the coding Ive done and that partially fixes the most problems of the AI polymorphing:

x0_i0_talent, add anywhere, new function

int TalentShapechange(object oIntruder = OBJECT_INVALID)
{
    if(GetHasEffect(EFFECT_TYPE_POLYMORPH))
    {
        return FALSE;
    }
    if(GetHasFeat(FEAT_EPIC_WILD_SHAPE_DRAGON))
    {
        ActionUseFeat(FEAT_EPIC_WILD_SHAPE_DRAGON,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_WILD_SHAPE_UNDEAD))
    {
        ActionUseFeat(FEAT_EPIC_WILD_SHAPE_UNDEAD,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_OUTSIDER_SHAPE))
    {
        ActionUseFeat(FEAT_EPIC_OUTSIDER_SHAPE,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_CONSTRUCT_SHAPE))
    {
        ActionUseFeat(FEAT_EPIC_CONSTRUCT_SHAPE,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_HUMANOID_SHAPE))
    {
        ActionUseFeat(FEAT_HUMANOID_SHAPE,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_4))
    {
        ActionUseFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_4,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_3))
    {
        ActionUseFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_3,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_2))
    {
        ActionUseFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_2,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_1))
    {
        ActionUseFeat(FEAT_EPIC_SHIFTER_INFINITE_WILDSHAPE_1,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_ELEMENTAL_SHAPE))
    {
        ActionUseFeat(FEAT_ELEMENTAL_SHAPE,OBJECT_SELF);
        return TRUE;
    }
    else if(GetHasFeat(FEAT_WILD_SHAPE))
    {
        ActionUseFeat(FEAT_ELEMENTAL_SHAPE,OBJECT_SELF);
        return TRUE;
    }

    return FALSE;
}


nw_i0_generic

replace line:
if (GetHasFeatEffect(FEAT_BARBARIAN_RAGE) || GetShouldNotCastSpellsBecauseofArmor(OBJECT_SELF, nClass)
        || GetLocalInt(OBJECT_SELF, "X2_L_STOPCASTING") == 10 || GetHasFeatEffect(FEAT_MIGHTY_RAGE))

with

if (GetHasFeatEffect(FEAT_BARBARIAN_RAGE) || GetShouldNotCastSpellsBecauseofArmor(OBJECT_SELF, nClass)
        || GetLocalInt(OBJECT_SELF, "X2_L_STOPCASTING") == 10 || GetHasFeatEffect(FEAT_MIGHTY_RAGE) || GetHasEffect(EFFECT_TYPE_POLYMORPH))


nw_i0_generic

add between lines if (TalentDragonCombat(oIntruder) and if (TalentMeleeAttack(oIntruder)

    if (TalentShapechange(oIntruder)) {return 99;}


and then open and edit all the nw_c2_* and nw_ch_* scripts and recompile all scripts in module.
               
               

               


                     Modifié par ShaDoOoW, 18 février 2014 - 05:30 .
                     
                  


            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #10 on: February 18, 2014, 05:38:31 pm »


               Well, when I asked if it's possible, I actually meant simply disabling shapeshifting feats altogether in AI. Allowing shapeshifting via conversation seems to be easy enough to do.

If I won't do that, I'll most likely use the code you've provided, thanks for that.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #11 on: February 18, 2014, 05:42:02 pm »


               

Grani wrote...

Well, when I asked if it's possible, I actually meant simply disabling shapeshifting feats altogether in AI. Allowing shapeshifting via conversation seems to be easy enough to do.

If I won't do that, I'll most likely use the code you've provided, thanks for that.

Oh yes thats easy to do and I think I will include this in next CPP release. Its so broken that I dont see a problem with that...

If you cant wait this is how can you disable it:

in the feat.2da
find lines with the "shape" and set CATEGORY collumn to **** (I think its 10 by default for some of the shapes)

EDIT: actually I realized I can add this code into CPP afterall, just needs to limit it by a variable like 70_ALLOW_SHAPECHANGE int 1 on a creature.
               
               

               


                     Modifié par ShaDoOoW, 18 février 2014 - 05:46 .
                     
                  


            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #12 on: February 18, 2014, 08:20:14 pm »


               Just one more question!
I didn't find any function that would allow me to cancel a polymorph.
I'd rather players be able to order their henchmen to cancel their polymorph wthout having to wait until it wears out.

How can this be done?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #13 on: February 18, 2014, 08:31:05 pm »


               

Grani wrote...

Just one more question!
I didn't find any function that would allow me to cancel a polymorph.
I'd rather players be able to order their henchmen to cancel their polymorph wthout having to wait until it wears out.

How can this be done?


RemoveSpeficicEffect(EFFECT_TYPE_POLYMORPH,oHenchman);


needs the x0_i0_spells include or something like that

alternatively you can do that manually, you need to loop all effects on the target and remove any effect with type EFFECT_TYPE_POLYMORPH
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Yet another henchman struggle - a druid keeps on changing shapes
« Reply #14 on: February 18, 2014, 09:01:25 pm »


               Great, thanks a lot!