Touch attack AC

Discussion in 'General Modification' started by marc1967, Jan 3, 2018.

Remove all ads!
  1. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    Before I spend an evening making a script to compute the touch attack AC for a critter, is there an existing function to get such a thing? I've looked thru all the script files and object calls and can't find anything. The closest thing is obj.stat_level_get(stat_ac), which just give the base AC.

    If there is none, I'll have to compute it with a script, which can get complicated with all the various bonuses to account for like deflection bonuses and monk wisdom bonuses, +4 bonus for being prone, etc.

    I'll be using this in a script to get the best target for spell caster casting a ranged touch attack spell.

     
  2. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    4,943
    Likes Received:
    229
    Generally speaking, PC's with the largest difference between their total AC and touch AC will be fighter types who rely on heavy armor to make up for low dexterity scores.

    It's been a while since I've fiddled with the AI but perhaps you could target PC's with low dexterity scores/reflex saves for your ranged touch attack?
     
  3. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    567
    Likes Received:
    30
    That makes sense, and is probably most realistic from the point of view of the enemy spellcaster. He wouldn't know all the details of what protective items and buffs they have. He would just target one of the armored guys who probably has a touch AC of 10-12, as opposed to one the non-armored or lightly armored Rouge/Monk types who have a touch AC of 16+.

    Although I did write the function, and it figures the touch AC right most of the time. It takes into account:
    - Max Dex bonus from base dexterity, armor, shield, encumbrance, invisibility, flatfooted, blinded, stunned, consciousness, and uncanny dodge.
    - Size adjustment.
    - Monk AC bonus.
    - Prone giving +4.
    - Resistance bonus.​

    Along the way I found two TOEE "bugs" when the engine computed the AC, at least I think they are:
    1. During combat, the Resistance Bonus is added in for Shield of Faith, but not for Rings of Protection.
    2. The target never gets a +4 Cover bonus.​
     
Our Host!