With Elona Custom 1.51.4, two new systems will be added to the game - the first true additions to the Custom version that are anything more than simple code tweaks.

The first is customizable AI - the ability to fine-tune your pet's AI routine to your liking. The second is the ability to teach pets spells and abilities that you already know.

Did that get your attention? Then keep reading below to find out all about it!

Contents show]

Starting Out

To instruct your pet on how to act, you'll need to (i)nteract with one of your pets, select Talk, and then choose the option "Let's talk about tactics." This will bring up a window that will be referred to from now on as the "Tactical Configuration Menu". The first time you open it, it'll look a little something like this: Image(Dropbox)

In the bottom right, you'll see some statistics that will be displayed in every step of this menu. They're fairly self-explanatory, but here is what they mean in more detail:

Currently using <x> AI.This displays which AI routine your pet is currently using: Elona's default or a custom routine.

Currently available slots: <x>. This displays the number of tactical slots your pet has unlocked. This is calculated by the lower of the pet's LER/5 or your LER/5. There is a minimum of 3 slots, and a maximum of 15.

Currently Learning: <x>. This displays the ability or spell that your pet is currently attempting to learn.

Current Progress: <x>. This displays the progress your pet has made towards learning the above spell or ability.

Now, if you've played a game like Final Fantasy XII or Dragon Age Origins, you probably have a pretty good idea of how this AI system works just from that screenshot. But let's go into more details for those who may not be quite familar with it. We'll talk about setting up tactics first, and then talk about how teaching your pets new spells and abilities works.

Customizeable AI

Tactic Explanations

As you can see from the menu, a tactic is comprised of five different parts:

An entity to base the action on. This can be Player, Ally, Self, or Target. Please be aware that this does NOT set the target of the action you tell your pet to perform! By default, it is ONLY the entity on which the condition and value is checked against.

A statistic or condition to base the action on. This can be HP, MP, Distance, Buff, Gauge, or Class.

A way to compare the condition to a value. This can be < (less than), > (greater than), = (equals to), != (does not equal), >= (greater than or equals), or <= (less than or equals).

A value to compare against. This can be 1-10 (for distance), percentages in steps of 10 and 25% (for HP, MP, or Gauge), any non-special class names (for Class), or a buff or debuff (for Buff).

An action to use. This can be either Attack (Melee), Attack (Ranged), Move (Towards), Move (Away), "And" (for multiple-line instructions), or any of the pet's known spells or abilities.

Available comparators and values are filtered based on the condition that you choose. Also please note that "Buff" includes all buffs and debuffs, and uses = to mean "has" and != to mean "does not have".





Configuration

From the Tactical Configuration Menu, you'll see two options - "Configure" and "Teach a spell or ability". By selecting "Configure", you will proceed to a new window that will allow you to customize any of the available tactical slots, toggle between Elona's default AI and the customized AI you have set, or re-initialize your pet's moves if it is needed.

When you choose a slot from the list, you'll be presented with a list of the five pieces of the tactic, as well as an extra option termed "Preserve Entity As Target". Choosing one of the components of a tactic will present to you a list of available values for that component. Choosing the last option - "Preserve Entity As Target" - will force the entity specified in this tactic to be your pet's target for that action. Otherwise, all actions will default against the pet's target (which will not hamper things that default to the caster, such as buffs). Please note that for multiple-line instructions, the last line with this option set will be the one that your pet will follow.

Some examples:

Entity Condition Comparator Value Action Explanation Self Buff !- Holy Shield Holy Shield Cast "Holy Shield" if I don't have the Holy Shield buff. Target Distance > 1 Attack (Ranged) Perform a ranged attack if my target is greater than 1 space away. Ally (Preserved Target) Health < 50% And If an ally's health is less than 50%, AND that ally is one space away, then cast Healing Touch on that ally. Ally Distance = 1 Healing Touch

Spell/Ability System

Initial Move List

When you first open your pet's Tactical Configuration Menu, your pet's move list will be initialized. This pulls from the NPC's actions, subactions, and critical health action IDs. Leold's AP skills & feats are also supported. Abilities and Spells from evolution should also be supported, though there may be some missing (contact me if that's the case). Other abilities that may be tied to NPC ID are not supported.

Please note that AP actions gained after the move list has been initialized will (currently) not add those moves to your pet's move list. However, by choosing "Re-Initialize Actions" in the configure window, you will have the opportunity to re-initialize your pet's abilities, which will add those to the move list. If you do so, please be aware of the following:

Moves are initialized in this order: Evolution spells/abilities, main action spells/abilities, critical health spells/abilities, AP spells/abilities, taught spells/abilities. A pet can only know a maximum of 20 spells or abilities at once. If your pet knows 20 moves before this process is finished, the remaining moves will not be learned.

This will clear the "action" slot in each of your pet's tactical instructions.

"Energy" values for every known ability will be reset to 0.





Teaching a Spell or Ability

By selecting "Teach a spell or ability" from the Tactical Configuration Menu, you'll be presented with three rather self-explanatory options: teach a spell, teach an ability, or forget a spell or ability.

"Teach a spell" allows you to have your pet begin to learn a spell. The conditions are: 1) You must have leveled the spell to at least 50. 2) The pet's Casting skill level must be greater than the difficulty of the spell divided by 15. Spell difficulty is ignored for magic dart and heal light spells.

"Teach an ability" allows you to have your pet begin to learn an ability. The conditions are: 1) You must know the ability. 2) Your pet's primary attribute for that ability must be at least 2x the stamina requirement for the ability.

"Forget a spell or ability" allows you delete an action from your pet's move list.

Teaching a pet takes time - an average of about 4500 attempted uses (if my math is correct). A pet's chance to successfully use an ability or spell that they are learning is Progress/2, with a maximum of 20 and a minimum of 1. Then, for every successful use, there is a 25% chance that their progress will increase by 1.

Progress will not increase when in combat with a sand bagged target - nor will setting the learned skill as the attempted action in multiple tactical slots allow you to gain multiple points of progress per round.

Please note that applicable spells and abilities are part of a whitelist. Non-whitelisted spells/abilities cannot be taught.

In Use

So now you've got all of this set up. How does it actually function though?

First, all tactical instructions are processed from the first slot down. The first instruction that evaluates to be true is the one that will be executed. If an instruction evaluates to false, or if the action in that instruction is the spell/ability the pet is attempting to learn and they fail to use it, then evaluation will proceed to the next instruction. If all instructions evaluate to false, the pet will skip their turn, and a message will be displayed.

Secondly, since pets do not use stamina, every ability that your pet knows has a resource associated with it. You could consider it something like "energy", and it functions to limit how often your pet can use a specific ability. The maximum energy for any specific ability is 5 * (stamina cost/10), with a cap of 20. The energy use for every action is max(1, stamina cost/10)+1. Every time that your pet enters the customized AI routine, it will regenerate 1 point of energy for every ability that it knows.

Please be aware that this only applies for abilities. Since spells properly use MP, nothing has been done to them.

There are some things you should be aware of:

It is possible for an instruction to evaluate to true but not be executable. Ranged Attacks, for example, have a maximum distance of 5 for pets (I can remove this check, but have not done so). If you tell your pet to use ranged attacks on a target that is more than 5 spaces away, then despite that tactic being chosen, your pet will perform no actions and the error message will be displayed.

All entities are also checked for visibility - this can make a tactical instruction fail despite all the conditions being true. In other words, if you instruct your pet to move towards their target when it's more than 1 space away, if they can't see that target, then the instruction will not evaluate to true, even if the target IS more than 1 space away.

By default, pets will sometimes waste their turn and gain MP when their MP is less than 1/7. This has been removed for the customized AI routine - which could be a good or a bad thing, depending.

Unless you specifically instruct them to, pets will not care about their mana vs the MP cost of a spell. It is very possible to make a pet kill themselves from overcasting.

Troubleshooting

I get an error message along the lines of "<pet> doesn't know how to repond to the situation based on the instructions you've given her!". What's going on?

There is no fallback when all AI instructions evaluate to false. In other words, if none of the instructions you gave your pet are applicable, she will be confused and will waste her turn. You may find it useful to put an instruction that will evaluate to true 100% of the time in your pet's last instruction slot.

I know there's no way that all of my pet's instruction evaluated to false, but I still get the error message about her not knowing what to do. What gives?

There are two possible situations that could cause this. The first - and probably more likely - is that your instruction is disallowed by the game. Told your pet to use "fire a volley" at any time? It's going to fail when your pet doesn't have enough gauge % to fire it off. Tried to decapitate an enemy at 80% health? It's not going to work, because it's only available at 15% or lower.. In short, case number one is that you've given your pet an instruction that she's trying to follow, but the game is saying "that's not possible". The second case is that your pet doesn't have enough energy to use the abilities listed in the tactical instructions (in which case you'll only see this message intermittently). If you want to entirely prevent this, make sure the final instruction is something that doesn't require energy to use (such as a ranged or melee attack).

I tried to set my pet up to cast healing touch on me when I get lower than a certain percentage, but she's casting it on the enemy instead! Why?

All actions are performed against your pet's target by default. This doesn't matter for non-targeted abilities (buffs, AoE spells, etc.), but can present issues for targeted abilities such as healing touch, supposing you want them to be used on someone else other than the target. To prevent this, you MUST set the "Preserve Entity as Target" option in the instruction configuration. This will temporarily overwrite your pet's target to whomever is listed in the "Entity" field.

I left my pet in the doujou so that I could pay to raise her potentials, but she lost all of the abilities and spells I had taught her! Is this a glitch?

No, this is not a glitch, but an unfortunate result of having to create a new save file for this system. Because the AI data is not tied directly to specific pets (but rather ID slots), the information has to be wiped when a pet is removed from your party to prevent exploits. Otherwise, you could teach one pet multiple actions/spells, leave that pet at the doujo, and then pick up another pet that would keep the taught actions and spells of the original. There is no way to work around this without modifying the already existing files for Elona's save, which I'm not willing to do. There are a few things I could do to mitigate it (such as a temporary cache for a few npcs), but in the end, it's more trouble than it's worth. Simply be aware that if you do something that causes your pet to be removed from your ally list (doujou, abandon ranch), then you will lose all of their progress as far as taught spells and abilities are concerned.

Warnings

Here are some things to keep in mind when using this sytem:

This is the initial implementation - there are likely bugs. Nothing should ruin your save game, but I'd advise that you make a backup just in case. If you're playing on a difficulty that penalizes you for quitting without saving, you may wish to hold out until any potential crashes are discovered and fixed.

Leaving your pet at a discard ranch or the doujo will wipe out all of their AI data.

Known Bugs

The highlight for the tactic instruction selection doesn't go across the entire page. This is actually the lesser of two evils; when the maximum highlight length is expanded, it leaves a white bar on the screen above your character, which appears to persist until restart. This won't be fixed until I find out how to take care of that.

For smaller screen resolutions, the menu may draw on top of the log and status bar at the bottom. When exiting the menu, the graphic may persist. This can be easily "fixed" by exiting the map. Once I know how to make the information at the bottom of the screen redraw, I'll fix this.

Final Thoughts

I've spent quite a few hours coding this and working on fixing various bugs and crashes that arose. There are still some things that I'd like to add or tweak, but I'm satisfied with its current state - and I hope that you will be too. I know that it raises potential balance concerns, but I'll attempt to balance things as I can so long as it doesn't completely neuter the system - the "energy" resource for abilities was a step towards that.

These features will launch this Friday, November 27. Look forward to it!