Mabinogi World Wiki is brought to you by Coty C., 808idiotz, our other patrons, and contributors like you!!
Want to make the wiki better? Contribute towards getting larger projects done on our Patreon!

Pet AI Editor

From Mabinogi World Wiki

Basic Information

  • Pet Artificial Intelligence, often abbreviated as Pet AI, is a built intelligence for Pets or Partners to respond to certain reactions.
  • When summoned, Pets/Partners are set to the last AI that was manually selected, meaning that using Pet Commands for setting an AI will not change the AI after the next summon.
  • Only changing the AI manually through the "Behavior Setting" options, or the "AI Settings" in the Pet Window, will affect the AI on the next summon.
    • Changing the AI from the "Behavior Setting" or "AI Settings" window will only affect the current pet that is out.
  • Custom AIs can be created using the in game Pet AI Editor, which can be accessed by going into the 'Character Info' dialog, selecting 'Pet' tab, and selecting 'AI Settings' button.
    • Any saved changes made to any pet AI will take effect immediately, even if pet is in process of using it. (not recommended to change an AI while it is in use.)
  • Custom pet AIs does not get saved on any server nor is it tied to specific accounts, and is instead saved in your local system files
    • This means that when playing Mabinogi from a new computer, pet AI's will need to be rewritten or copied over.

Default AI's

Default AIs can be switched to by either using the dialog window, or by typing special keywords into the chat box. The default AIs have a '*' symbol in front of their name. These cannot be directly modified, but players can create a duplicate of them and edit the copy.
These are the default AI's you can select:

  • Auto Attack Mode - Pet will target and battle enemies nearby on its own.
  • Collaborative Mode - Pet will attack with the master.
  • Healing Mode - Pet continuously uses Healing on its master.
  • Command Mode - Pet does nothing until commanded. See Pet Commands.

The three parts of an AI rule set

  1. Event: Event defines why to activate a rule set.
  2. Condition: Condition defines specific situations required for the rule set to be used.
  3. Act: Act defines the actions the pet will perform when the rule set is activated.
  • Both event and condition must be true for the act to be processed.
  • Either the acts or the conditions can be omitted, but the event must always be defined.

List of Events

Trigger Name Alternates Usage Details
Pet finds the enemy. 0 If the pet recognizes an enemy, the pet will use this rule set.
  • The type of recognize does not matter.
  • This trigger will not activate if pet has a target.
Pet is targeting the enemy. 0 If the pet is in combat, this rule set will be triggered.
  • This can be used with a large variety of conditions.
Pet attacks the enemy. 9 If the pets attacks an enemy, this rule set is used.
  • The type of attack can be specified.
Pet is recognized by the enemy. 2 If an enemy targets the pet for the first time.
  • Can get activated more than once in a single interval.
Pet's enemy uses Ranged Attack. 0 If the pet's target uses ranged attack.
  • The enemy target can be anyone.
Pet's enemy uses Melee Attack. 0 If the pet's target does melee.
  • The enemy target can be anyone.
Pet's enemy uses Magic Attack. 0 If the pet's target uses magical attack.
  • The enemy target can be anyone.
  • The specific magic attack is not defined.
Pet blocks the attack with Defense. 11 If the pet succeeds in blocking an attack with defense skill.
  • Variety of attacks can be specified.
Pet is attacked by the enemy. 17 If the pet is attacked by an enemy.
  • The pet's target will change when this event takes place.
Master is recognized by the enemy. 2 If the pet's master is targeted by an enemy for the first time.
  • The targeting enemy is targeted by pet when this event activates.
  • Pet's current target is changed.
Master's enemy uses Ranged Attack. 0 If the Master's target uses ranged attack.
  • Pet's target will switch to master's.
Master's enemy uses Melee Attack. 0 If the Master's target uses melee.
  • Pet's target will switch to master's.
Master's enemy uses Magic Attack. 0 If the Master's target does magic attack.
  • Pet's target will switch to master's.
  • Magic attack cannot be specified.
Master blocks the attack with Defense. 11 If the Master succeeds in blocking an attack with defense skill.
  • Pet's target will switch to master's.
  • Type of attack must be specified.
Master is attacked by the enemy. 34 If the master is struck by an enemy.
  • Type of deflection is defined.
  • Type of attack is defined.
Master prepares a skill. 19 If the master prepares a skill for use.
  • Only activates when skill has been fully prepared.
  • Not all skills can be defined using the editor.
Master attacks. 17 If the master strikes an enemy with an attack.
  • Not all skills can be defined.
  • Pet's target will switch to master's.

List of Conditions

Condition Name Alternates Usage Details
Not Selected. 0 This gives the rule set with no condition rule.
  • Used when condition not desired for rule set.
Enemy Condition. 8 This condition defines the behavior of the enemy for activation.
Enemy Distance. 225 This condition defines enemy distance from pet for activation.
  • Distance parameter can be crossed, with unknown effects.
  • Wording of condition could be backwards. (not sure)
Skill Availability. 15 This condition limits the rule set to Pet with specified skill.
  • Acts as a filter for pet rule set activation. (example doesn't have the skill, no activation)
  • Not all pet skills can be defined with editor.
If the master's lost HP is above a certain number. 10 Activates if master has specified HP damage.
  • Ignores wound count. (needs be verified)
  • With editor, can only define 10 specific values.

List of Actions

Action Name Alternates Usage Details
Not Selected 0 Used to give an event and condition no action by pet.
  • Used for blank rule sets.
  • Used for temporary place holder to have rule sets defined for later edit.
Wait for the enemy 100 Causes pet to wait for a specific time.
  • Waiting time can be randomized.
  • Times can be crossed, with unknown effects.
Run away from the enemy for a set amount of distance. 24 Move away from the enemy for a specific amount of time.
  • Wording and definition of the act are not consistent.
  • Rule set will fail to save when adding this act.
Chase the enemy. 48 Causes the pet to move towards it's target.
  • Can be used to move towards master, rather than target.
Hover around the enemy. 480 The pet will do circles around its target.
  • Can be used to provoke enemies.
Attack the enemy using Melee Attack. 12 The pet will attempt to make melee strike on its target.
  • Will fail if skill is prepped, unless it's an attack skill, where the skill will be used instead of the melee.
Attack the enemy using Magic Attack. 4 The pet will charge, then use the magic.
  • Not all pet magic attacks can be defined using editor.
Prepare skill. 15 The pet will prepare a skill ready for use.
  • Not all skills can be defined using editor.
Charging a magic skill. 4 The pet will charge up a skill to the specified amount.
  • Not all magic attacks can be defined with editor.
  • Does not initiate the attack.
Use a prepared skill. 6 This will activate on the defined location, or target.
  • Can use master as target.
  • Can use distance from target or master.
Cancel skill 0 This will cause pet to cancel any prepared skill or magic.
Use Rest 2 This will either start or stop the rest skill.
  • Can be used to start, or end resting.

Tips and tricks

  • Sometimes a new rule set can be triggered, breaking out of the currently unfinished rule set.
    • An example is a pet charging firebolt, which then uses it, but before finishing is struck by the enemy.
    • The pet has a trigger rule for being hit by melee, which causes the pet to cancel the current ruleset and begin the other.
  • It's good practice to put 'cancel skill' at the beginning of all action rules in any rule set. A pet might try to complete a rule set, but fails because of a prepped skill.
  • More than one rule set can be defined with the same trigger and condition.
  • Duplicate rule sets with different names are possible.
  • It is possible to create rule sets that only have a trigger, and no conditions or actions.
  • The source code can be edited outside of the game AI editor.
  • It is possible to have pets output text. (currently not implemented using the in game pet AI editor.)
  • If the pet is sitting down, the pet will not perform the actions defined by the selected pet AI. The pet AI will still be processed. However a rule set to end the rest skill can be defined.
  • Pets can receive Pet Commands from the player's chat box.
  • The procedure of the Action Prepare Skill followed by Use a prepared skill sounds ideal yet will fail to execute or to use the certain specific skills.
    • Use a prepared skill is preferable with executing Counter and Windmill, however:
      • Prepare skill: Windmill > Wait for the enemy: 3 to 5 sec > Use a prepared skill: My location > Cancel skill
      • Prepare skill: Counter > Wait for enemy: 5 to 7 sec > Cancel skill
      • Adding the Action Cancel Skill at the end will help or hurt depending on the situation. Having to wait too long can deplete Stamina with some skills while cancelling a defensive skill too soon may get the pet hurt. The skill should still be cancelled for a tactical balance, especially if there is no more target around.
    • Specific melee skills like Basic Attack and Smash will automatically be executed if the Prepare Skill to Attack the enemy using Melee Attack is used, which also applies to specific magic skills like Icebolt and Thunder with Prepare Skill to Attack the enemy using Magic Attack were used instead.
      • Prepare skill: Smash Retry: 1x Time: None > Attack the enemy using Melee Attack: Time: None
      • Prepare skill: Basic Attack Retry: 1x Time: None > Attack the enemy using Melee Attack: Time 5 sec
      • Prepare skill: Icebolt Retry: 1x Time: None > Attack the enemy using Magic Attack: Time: None
      • Including the amount of Retry and including how much Time the attack procedure has left will cause the whole thing to cancel out or move onto the next phase of the battle. Having the Retry set to 1x is preferable when the enemy changes tactics or attacks the pet which can cancel out the entire procedure. Adding the amount of Time can also cause the pet to stand still waiting like a sitting-duck. It is much better to put the amount of Time in with the Action Attack the enemy using Magic Attack/Melee Attack or with Use a prepared skill where it is by the end of the whole procedure.

Sharing, backup and restore

To share, backup, or restore a pet AI the clipboard is used. (copy and paste)

  1. With the AI open in the AI editor, select the button, 'see source'.
  2. With the source in view you can choose copy or paste.
  • Press copy to have the source code inserted into your clip board ready for pasting.
  • Press paste to have the source code inside the clip board inserted into the pet AI. This will erase any current AI.

A backup can be created by saving the copy and paste into a text document.
Sharing with a friend can be done by uploading a text document of the copy and paste using an instant messenger.

An example pet AI

  • The following code block is an example AI, created using the Pet AI Editor.
    • It's suggested to copy and paste it into the game's Pet AI Editor for viewing.
  • This AI is useful against weak mobs, exposing mimics, along with assaulting archers.
  • It gives the pet one specific action, and that is melee.
  • There is room to improve or customize it.
  • Public domain but is subject to 'Mabinogi' rules, and 'Mabinogi' copyright laws
<rules>
	<rule name="See it, attack it">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="0"/>
			</sequence>
		</pattern>
		<event name="seek_target"/>
	</rule>
	<rule name="Seen, attack it">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="0"/>
			</sequence>
		</pattern>
		<event name="targeted" targeting_type="alert"/>
	</rule>
	<rule name="hit! Attack it">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="0"/>
			</sequence>
		</pattern>
		<event name="attacked" master_skill="all" down="false"/>
	</rule>
	<rule name="hit! Attack it 2">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="0"/>
			</sequence>
		</pattern>
		<event name="attacked" master_skill="all" down="true"/>
	</rule>
	<rule name="Just attack">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="0"/>
			</sequence>
		</pattern>
		<event name="now_targeting"/>
	</rule>
</rules>

Known glitches or bugs

  • The pet AI rule set will fail to save when including, 'run away from enemy'.
    • This can be worked around by creating a duplicate of the healing AI, and making changes with out changing the 'run away from enemy' rule. The set time can be changed, and rules can be created around it.
  • Sometimes having undefined events can cause pets to behave as if they are doing things by random.
    • A work around is to include the event in the pet AI.
  • After the pet's target is defeated and there are no more enemies around, the pet might still have a skill prepped such as defend or counter. The pet will not cancel the skill until commanded by the master.
    • This bug can be worked around by including, 'cancel skill' at the end of any rule set that might be used last by the pet.
    • Another fix can be to include a hot key for command the pet to sit down, or come over to the master. Either will cause the pet to cancel a prepped skill.
    • One more fix is to type a command to cause the pet to sit, stand, or come.
  • After selecting the option to create a new rule set, if the name of the rule set is inputted before defining the rule set, the name will be lost.
    • to work around this, it is best to wait until the rule set is complete, and then define it's name. The name stays preserved when putting an AI in edit mode.