Mabinogi Guru
MainMabiBlogForumsMabinogi WikiImage GalleryArcadeFlash Chat

Navbar Left Navbar Right


Reply
Tcat Left
 
LinkBack Thread Tools Display Modes
Thead Left Old 09-05-2008, 05:54 PM   #1 (permalink) Thead Left
Traveler of Dugald
 
MForey's Avatar
 
Join Date: Mar 2008
Posts: 62
Gold: 2,574
MForey is still learning the ropes
Default The Pet AI Thread

Since it seems we don't have one of these in the pet forum as yet, I thought I might as well start one up. This thread will be here to post your own custom AIs in, where they will then be reviewed, commented, and improved on.

So in this spirit, I will start with a "basic" magic counter (in this case, fire) script that I recently worked up for my dogs while proceeding through Runda. I have not as yet had a chance to see how the contingencies for anti-ranged and anti-magic hold up under pressure, nor (surprisingly) whether the manually corrected move_against command in the Phase 2b contingency rule (self-preservation against wall advantage) works as it is intended to. As a skeleton buster, however, the script as a whole seems to work quite well--if a little slowly.

The AI is currently designed to respond to stamina and mp shortages by entering defense and approaching the master for protection and resupply, but I've been pleasantly surprised to see that the pets' phenomenal natural recharge rates keep this contingency from being tripped too often.

Known AI faults:
1. The passive aggro rules do not like to respond when a new mob immediately switches to attack status after a weakened mob is finished off, possibly owing to the fact that the old one has not yet disappeared.
2. The AI is single-minded when attacking. If the "go aggressive" rule is triggered and an enemy that is not the original target enters attack mode before smash is completed, the pet will continue to attack the original target instead of switching focus.

And now, the code.

Code:
<rules>
	<rule name="Go aggressive">
		<conditions>
			<condition name="skill_preparable" pet_skill="smash"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="prepare_skill" pet_skill="smash" try_cnt="0" timeout="5000"/>
				<cmd name="melee_attack" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="seek_target"/>
	</rule>
	<rule name="Go passive 1-Intro to Loop">
		<conditions>
			<condition name="target_distance" min_distance="200" max_distance="1500"/>
			<condition name="skill_preparable" pet_skill="firebolt"/>
			<condition name="skill_preparable" pet_skill="counter"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="chase" chase_target="master" timeout="1000" run="true"/>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="3" timeout="5000"/>
				<cmd name="wait" min="10000" max="10000"/>
			</sequence>
		</pattern>
		<event name="targeted" targeting_type="attack"/>
	</rule>
	<rule name="Go passive 2-Assault">
		<conditions>
			<condition name="target_distance" min_distance="100" max_distance="200"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="melee_attack" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="targeted" targeting_type="attack"/>
	</rule>
	<rule name="Intro into FC loop">
		<conditions>
			<condition name="skill_preparable" pet_skill="firebolt"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="prepare_skill" pet_skill="defence" try_cnt="0" timeout="5000"/>
				<cmd name="chase" chase_target="master" timeout="5000" run="false"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="smash" down="true"/>
	</rule>
	<rule name="Loop Phase 1-Counter">
		<conditions>
			<condition name="skill_preparable" pet_skill="counter"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="0" timeout="5000"/>
				<cmd name="wait" min="10000" max="10000"/>
				<cmd name="prepare_skill" pet_skill="defence" try_cnt="0" timeout="5000"/>
				<cmd name="chase" chase_target="master" timeout="5000" run="true"/>
				<cmd name="wait" min="6000" max="6000"/>
				<cmd name="cancel_skill"/>
			</sequence>
		</pattern>

		<event name="attack" pet_attackable_skill="firebolt" down="true"/>
	</rule>
	<rule name="Loop Phase 2-Firebolt">
		<conditions>
			<condition name="skill_preparable" pet_skill="firebolt"/>
			<condition name="target_distance" min_distance="200" max_distance="1500"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="prepare_skill" pet_skill="defence" try_cnt="0" timeout="5000"/>
				<cmd name="chase" chase_target="master" timeout="5000" run="false"/>
				<cmd name="wait" min="6000" max="8000"/>
				<cmd name="cancel_skill"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="counter" down="true"/>
	</rule>
	<rule name="Loop Phase 2b-Wall Contingency">
		<conditions>
			<condition name="skill_preparable" pet_skill="firebolt"/>
			<condition name="target_distance" min_distance="100" max_distance="200"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="move_against" distance="300" run="true" timeout="5000"/>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="prepare_skill" pet_skill="defence" try_cnt="0" timeout="5000"/>
				<cmd name="chase" chase_target="master" timeout="5000" run="false"/>
				<cmd name="wait" min="6000" max="8000"/>
				<cmd name="cancel_skill"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="counter" down="true"/>
	</rule>
	<rule name="Retaliate, restart loop">
		<conditions>
			<condition name="skill_preparable" pet_skill="firebolt"/>
			<condition name="skill_preparable" pet_skill="counter"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="5000"/>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="5" timeout="5000"/>
				<cmd name="wait" min="10000" max="10000"/>
			</sequence>
		</pattern>
		<event name="defence" defence_enable_skill="all"/>
	</rule>
	<rule name="If melee, start loop">
		<conditions>
			<condition name="skill_preparable" pet_skill="counter"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="3" timeout="5000"/>
				<cmd name="wait" min="10000" max="10000"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="basic" down="true"/>
	</rule>
	<rule name="Take damage - Any">
		<conditions>
			<condition name="skill_preparable" pet_skill="counter"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="3" timeout="5000"/>
				<cmd name="wait" min="10000" max="10000"/>
			</sequence>
		</pattern>
		<event name="attacked" master_skill="all" down="true"/>
	</rule>
	<rule name="Proactive - AntiArchery">
		<conditions>
			<condition name="skill_preparable" pet_skill="firebolt"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="melee_attack" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="aimed"/>
	</rule>
	<rule name="Proactive - AntiMagic">
		<conditions>
			<condition name="skill_preparable" pet_skill="firebolt"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
				<cmd name="melee_attack" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="target_magic_prepare"/>
	</rule>
</rules>
__________________
IGN: Sonya (Mari)
Job: Rank C tailor, Rank C potion maker (and back into another set of grind reqs)
Drink Diet Peaca (Formula G3)... all the great-tasting Peaca death in a refreshing low-calorie package!
MForey is offline   Reply With Quote
Thead Left Old 09-06-2008, 11:44 AM   #2 (permalink) Thead Left
Osna Sailor
 
Join Date: Mar 2008
Posts: 314
Gold: 11,721
Kaxiyu is following the right trackKaxiyu is following the right track
Default

I haven't taken a look at your Fire Counter AI yet, but I just wanted to post this up incase you wanted it.

Code:
<rules>
	<rule name="Seek a Target and use Firebolt">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="seek_target"/>
	</rule>
	<rule name="After Attacking with Firebolt, Use Counter">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="0" timeout="6000"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="firebolt" down="true"/>
	</rule>
	<rule name="After Attacking with Counter, Use Firebolt">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="counter" down="true"/>
	</rule>
	<rule name="After Attacking with Normal Attacks, use Counter (Not Knocked Down)">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="0" timeout="6000"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="basic" down="true"/>
	</rule>
	<rule name="After Attacking with Normal Attacks, use Counter (Knocked Down)">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="0" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="attack" pet_attackable_skill="basic" down="true"/>
	</rule>
	<rule name="If attacked, use Counter (Not Knocked Down)">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="0" timeout="6000"/>
			</sequence>
		</pattern>
		<event name="attacked" master_skill="all" down="false"/>
	</rule>
	<rule name="If attacked, use Counter (Knocked Down)">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="counter" try_cnt="0" timeout="6000"/>
			</sequence>
		</pattern>
		<event name="attacked" master_skill="all" down="true"/>
	</rule>
	<rule name="If Enemy uses Ranged Attack... (Far Away)">
		<conditions>
			<condition name="target_distance" min_distance="800" max_distance="1500"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="stackmagic_attack" stack_magic="firebolt" charge="1" timeout="5000"/>
			</sequence>
		</pattern>
		<event name="aimed"/>
	</rule>
	<rule name="If Enemy uses Ranged Attack... (Close up)">
		<conditions>
			<condition name="target_distance" min_distance="100" max_distance="800"/>
		</conditions>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="cancel_skill"/>
				<cmd name="prepare_skill" pet_skill="defence" try_cnt="0" timeout="10000"/>
				<cmd name="chase" chase_target="enemy" timeout="8000" run="true"/>
			</sequence>
		</pattern>
		<event name="aimed"/>
	</rule>
	<rule name="If attacked with Ranged using Defense...">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="melee_attack" timeout="0"/>
			</sequence>
		</pattern>
		<event name="defence" defence_enable_skill="ranged_attack"/>
	</rule>
	<rule name="If attacked with Magnum using Defense...">
		<conditions/>
		<pattern>
			<param_decl/>
			<sequence>
				<cmd name="prepare_skill" pet_skill="defence" try_cnt="0" timeout="6000"/>
			</sequence>
		</pattern>
		<event name="defence" defence_enable_skill="magnum_shot"/>
	</rule>
</rules>
This one has less rules, mainly since I'm still tweaking it so it does have "Anti-Range and Anti-magic" precautions. The basic functions of using Fire and Counter work pretty well though. The only problem I've had with it so far was my pet spazzing, but I think that was due to the fact that two of the rules overlapped and 'caused my pet to freak out.
__________________
PROJECT CURRENTLY NOT IN PROGRESS! VOTE HERE PLEASE!
CURRENT PROJECT: G1 Video
Kaxiyu is offline   Reply With Quote
Bottom LeftBottom Right

Reply



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
vBCredits v1.4 Copyright ©2007, PixelFX Studios
Skin by CompletevB