ADVANCED AI CONDITIONS

RPG Maker VX Ace

This script allows the developper to exert better control on how the AI handles the enemies' action patterns.

Advanced AI Conditions


What is this?
This script allows the developper to exert better control on how the AI handles the enemies' action patterns. Script configuration is almost entirely made via noteboxes and no RGSS3 knowledge is required to use it.
 
Features and Instructions

PART 1: DEFAULT AI CONFIGURATION
 
- TGR settings
TGR determine the frequency a target will be chosen during random targeting rolls. The configuration module below allows you to set how damage and healing affects TGR to make a character more threatening to the eyes of the AI.
 
- Skill settings
Every skill can be given default AI *targeting* conditions all enemies will use. To do it, you have to create an "AI block" in the skill's notebox.
 
Notetags explanation:
<ai_conditions>

Explanation: You always start the block with this one.
 
target_hpgt: n
Explanation: The target HP must be greater or equal to n%.
 
target_hplt: n
Explanation: The target HP must be lesser or equal to n%.
 
target_states: n, n...
Explanation: The target must have the specified states already inflicted.
 
target_states_not: n, n...
Explanation: The target must NOT have the specified states already inflicted.
 
only_if_target
Explanation: If no suitable target is found, the skill won't be used AT ALL.
 
</ai_conditions>
Explanation: You always end the block with this one.

PART 2: ENEMY AI CONFIGURATION
 
On top on a default AI, you can setup individual AI conditions for every different enemy. In case of conflict with the default targeting AI, these settings will take precedence.
All these settings make use of the enemy's notebox.
 
NOTE: the term "action index" refers to the order of the action pattern you enter for enemies in the database. For instance, if your list is like this:
 
Attack
Fire II
Poison
 
Attack will be index 1, Fire II will be index 2 and Poison index 3. And so on.
 
Notetags explanation:
<ai_conditions: n, n...>

Explanation: One way of starting an AI block. n must be an action index and if you put more than one (separated by comma), the conditions will be applied to each of them.
 
<ai_conditions: n, n...> use_id
Explanation: Same as above, but instead of the action index, the skill ID will be used. n must be a valid skill ID in this case.
 
switches: n, n...
Condition: designated switches are ON.
 
variables: x, y, x, y...
Condition: the variables x have the value y.
 
states: n, n...
Condition: acting enemy is under the every of the designated states.
 
hpgt: n
Condition: acting enemy has hp greater or equal than n%.
 
hplt: n
Condition: acting enemy has hp lesser or equal than n%.
 
mpgt: n
Condition: acting enemy has mp greater or equal than n%.
 
mplt: n
Condition: acting enemy has mp lesser or equal than n%.
 
party_level: n
Condition: party level is greater than n.
 
turns_order: a+bx
Condition: it's exactly like in the database condition for turns.
 
target_hpgt: n
Condition: The target HP must be greater or equal to n%.
 
target_hplt: n
Condition: The target HP must be lesser or equal to n%.
 
target_states: n, n...
Condition: The target must have the specified states already inflicted.
 
target_states_not: n, n...
Condition: The target must NOT have the specified states already inflicted.
 
only_if_target
Condition: If no suitable target is found, the skill won't be used AT ALL.
 
</ai_conditions> 
Explanation: You must end the block with this one.

 
- Creating Turn Patterns
 
Turn patterns is a special AI setting which completely replace an action pattern with another one at the designated turns. During a turn pattern, the "normal" actions (the ones you entered into the database) won't be taken into consideration, ever. You need to create another block to make a Turn Pattern.
<turn_pattern: a+bx>

Used to define the pattern. a is the first turn and b the number of turns after the first.
 
skill: a, b
a is the skill id and b the rating.
 
</turn_pattern>
End the pattern.

  
NOTE 1: You can put as many skill tags as you want.
NOTE 2: In order to assign conditions to a skill inside a turn pattern, you have to create a new AI block with that skill's ID.
 
- Absolute Rating
 
The absolute rating is a special rating you assign to an action during databasing your enemy. An action with this rating will take absolute priority, ignoring all others (even higher ones) provided it can be used. If you have several actions with an absolute rating, one will be chosen randomly.
 

Posts

Pages: 1
Updated to version 1.0c
This A.I Script is great!

Pros: It makes your enemy's smart and makes them not flail around like a lunatic,
This is cool and a great idea!

Cons: It can be difficult to use and if you don't remember your exact skill numbers you have to go back and look.

Thats pretty much it! Keep up the good work!
Archeia_Nessiah,

First, thank you so much for the script. It is awesome, and does 90% of what I was hoping I could accomplish. Very easy to use, and extremely useful.

I did have one question, and was wondering if I'm just missing an option. In my game, many enemies have skills which apply a state to them (such as "attack boost"). I was hoping there would be a way to set it up so that if the enemy already had the state applied, they would not use the skill again.

The "states" option under Enemy AI Config, seems to do the opposite: when a state(s) is active, the enemy will use a specific skill. Is there a way to achieve the opposite? A way to set enemies to not recast a buff if they already have that buff applied--something like a "state_not"?

Thanks so much! And, if this is not in the script, I completely understand that this script is most likely as-is. I could always take the switch/variable route to achieve this.

YummyTiger
This is an excellent script, for reasons that shouldn't be understated; better control of enemy A.I. Thanks!
Pages: 1