Author Topic: TalentSpellAttack() Function  (Read 487 times)

Legacy_eucletes

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
TalentSpellAttack() Function
« on: January 19, 2014, 02:33:42 am »


               Hi All,

I was playing my mod and didn't like the way my clerics were fighting especially at a low level i.e. 4th level. They did not cast any of the harmful memorized spells, especially the inflicting wounds. So I decided to take a look first at the nw_i0_generic.nss to see about the combat scripting. What I found was interesting that ta function called TalentSpellAttack()  determines what spell to attack with. Problem is a lot of it is not fully documented and I believe the problem with low level clerics or spell casters is it uses something called GETCRMAX(). This function I believe has a big impact on the AI behavior on spell casting.

Questions:

1. Anyone know exactly how GETCRMAX() works?
2. I'm I right about the function probably being the cause of bad AI spell selection and is there a work around?

I made a 10 level Battle Cleric and yes he used his spells and fought much better.

FYI
I'm aware that there's a variable call nMagic must be above 50 to cast spells. I hard coded in a value bigger than 50 and observed the result by a speakstring() command. Even though the nMagic was greater than 50 i.e. 100, the low level cleric refused to cast a offensive spell and only did a physical attack.

Any insight would be welcome.

Regards,
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
TalentSpellAttack() Function
« Reply #1 on: January 19, 2014, 02:56:12 am »


               getcrmax returns 20 everytime afaik

the value of 20 ensure that it will look up for every talent the creature has, the CR of a (spell) talent is (innate level*2)-1

so practically GetCRMax function does nothing and its useless as it is.

Q1: did you give him Combat Casting feat?
S1: try my unofficial patch if it helps the issue.
               
               

               
            

Legacy_eucletes

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
TalentSpellAttack() Function
« Reply #2 on: January 19, 2014, 09:48:08 pm »


               Hi ShaDoOoW,

After extensive testing I have come to the conclusion that yes a cleric will cast certain offensive spells that are defined within GetCreatureTalent(). I'm pretty positive that at minor, light and moderate inflict wounds is not part of that algorithm. So I changed the low level clerics spells to mostly buffs and aides which he uses nicely. Also I have given him a better nCompassion chance so he will heal his comrades more often.

Certain things you cant get around.

Regards,