Trying to create a spell priority system

I’ve been tinkering around with the SAI system most of the day but have had no luck developing an action priority system. For example, by priority in a single phase:

1 - if health < 15%, then flee

2- if health < 30%, cast BIG HEAL

3 - if health < 80%, cast HOT if not already active

4 - if not in casting range, move into casting range

5 - if in casting range, cast ENEMY DEBUFF if not already active
6 - if in melee range, cast SELF MELEE BUFF if not already active

7 - cast SELF BUFF if not already active
8 - if in casting range, cast ENEMY DOT if not already active

9 - if in casting range, cast DPS

10 - if not in melee range, move to melee range

11 - melee attack

The problem seems to be that, at any given time, multiple of these are in effect. In this case, I would like the topmost action to be performed. I tried ordering them, but that didn’t have the desired result.

Is there any way a priority system can be defined with SAI?

For priority-based AI it’s usually better to use BehaviorTrees, but since SAI is not based on them it will be a bit harder to achieve this, you could also bloat your scripts with conditions so two actions won’t happen at the same time.

ya…use mangos EAI and u can do all of that

No, it can’t. SAI and EAI (notice that we still use both) have similar flaws; SAI being an improved version of EAI.

baric: any reason not to use event phases? I didn’t understand if you did use multiple phases or just one