Page 1 of 1

Shadow Master's AI Micro-Compendium

Posted: Fri Mar 08, 2019 2:42 pm
by Ogodei
Hello guys :) ,

Here's a micro guide I wanted to share with the community about the Shadow Master's AI. By seeing this guide I've been inspired to study this AI in depth. Here are my findings :)

In Monstats.txt

- AIP1(H): it's the chance to perform a regular melee attack. Keep in mind, though, that this AI is hardcoded to perform it sometimes, regardless of this param.

- AIP2: handles the AIType 5 skills usage

- AIP2(N): Determines the unit's awareness radius. Therefore the unit will only engage enemies within AIP2(N).

- AIP2(H): Concerns the combat leashing. Should the distance from its owner exceed AIP2(H), the unit will disengage and run\warp back to him.

- AIP3: Difficulty dependant. It's the chance to keep fighting if there are 6 or more enemies near the unit. If the roll fails, then the unit will flee, or else it'll perform a regular attack. (i.e 100: never flee ; 0 : always attempt to flee). Keep in mind that the unit will only flee if there is enough space to run away.

- AIP8: Tells the AI which skill ID to look for in the formula that handles the skill levels calculations for the Shadow Master. The skills affected by this AIParam are the character-specific skills and they follow the formula Current Player sLvl / 2 + Current (AIP8) sLvl of the player / 2.

in Skills.txt

The Shadow Master's AI is coded to use every possible skill she has in her skill list. this means that your Shadow Master's AI using pets are actually able to use skills from MonStats, Skills.txt(see sumskill# columns), MonProp and MonEquip. There's only a requirement, though, which is setting the AIType column of each skill you want them to use with a specific value. Here is the list of all the avaliable AIType values. Passive skills work even without a proper AIType.
On a side note, keep in mind that the Shadow Master's AI gets every player class skill when the minion is summoned, so unless you plan to create a replica of your character, avoid AITyping your class skills and make cloned skills instead.

AIType 1: it is used for the skills you want your pet to cast while disengaged. In order to be used, you need to assign an AuraState to the skill. It also seems to check for the "group" column in States.txt, and this might be the reason for which the vanilla Shadow Master doesn't get stuck on casting burst of speed and fade all the time.

AIType 2: Skills of AIType 2 are the equivalent of AIType 1, but they are using in combat. There is one major difference, though, because these skills can be used to make your minions cast debuffs(i.e curses) against the enemies.
Self Buffs with AIType 2 require an AuraState, while Curses and debuffs require an AuraTargetState. The AI also checks the state applied upon the targeted enemy, and therefore will void casting the same spell twice on the same enemy.

AIType 3: used for traps and summons

AIType 4 and 5 : Used the former for melee skills and the latter for ranged skills, although they are sometimes used interchangeably

AIType 6: non-existent. In the code, it calls the "default case" (i.e use "Attack" skill).

AIType 7: it is used to make the unit cast the skill on self while under or at 66% health

AIType 8: non-existent. In the code, it calls the "default case" (i.e use "Attack" skill).

AIType 9: non-existent. In the code, it calls the "default case" (i.e use "Attack" skill).

AIType 10: used for Passive skills. This AIType is totally useless, because, as described above, the Shadow Master's AI will benefit from every kind of skills, even passives.

AIType 11: It is uses when fighting against mobs composed by 2 or more enemies.
*warning* it is meant for offensive skills, so avoid using it to set up your curse skills, or the pet will keep cursing the same enemies non-stop (for curses, refer to AIType 2)

AIType 12: In theory it casts these skills when low on health.

AIType 13: The minion will treat these spells as if they were AIType 4 or 5, but occasionally it will cast the skill against the closest monster to its owner.

Re: Shadow Master's AI Micro-Compendium

Posted: Tue Jun 25, 2019 9:54 pm
by csguak
Hello, thank you for sharing the in-depht analysis.
Is it possible to make enemy boss or monsters to use shadow warrior or master A.I. to hunt down players??
My mod has these monsters that try to assasinate player characters. They operate with Duriel A.I., but it seems to ignore skill "delay" column in skills.txt. :-|

Re: Shadow Master's AI Micro-Compendium

Posted: Wed Jun 26, 2019 7:19 am
by Ogodei

Not without code edits, because one of the first things the Shadow Master does is calling the GetOwner function to retrieve its owner, and it assumes it's a player. Also, there are no check for when the owner isn't found, and this leads to a crash if you happen to simply place a shadowmaster-monster via levels.txt (because it will have no owner).
As for the delay column, IIRC that is meant specifically for players. Monsters usually don't have skill cooldowns, with the exception of a few ones, such as the Oblivion Knight (which has an AIParam - in monstats - that acts as a timer for using MonCurseCast).