<aidescdata>
<template>
<imports>
<import file="data/db/ai/local/common_pet.xml" />
</imports>
<var_decl>
<var name="visualfield_radius" default="600" />
<var name="audio_range" default="400" />
</var_decl>
<sensor visualfield_radius="%visualfield_radius" visualfield_angle="90" audio_range="%audio_range" />
<!--
펫이 올바르게 작동하기 위해서는 다음 속성들이 수정되어서는 안됩니다.
- return_to_startpoint : false면 ai가 시작지점으로 돌아가려 시도하지 않음
- auto_respawn : false면 죽어도 리스폰을 요청하지 않음
- target_type : 반드시 "always"이어야 함
- support_type : 반드시 "none"이어야 함
-->
<character return_to_startpoint="false" auto_respawn="false" target_type="always" support_type="none">
<!--race stringid="*/wolf/*" type="hate" / -->
</character>
<patterns>
<pattern name="wander">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@master_movestate == 0">
<then>
<!-- 애교 모션 -->
<if condition="expr" expr="@random > 0.5">
<then>
<cmd name="set_emotion" target="1" index="1" />
<cmd name="wait" min="15000" max="20000" />
</then>
<else>
<cmd name="set_emotion" target="1" index="0" />
<cmd name="wait" min="3000" max="5000" />
</else>
</if>
<if condition="expr" expr="15>@food">
<!-- 배고프면 밥달라고 함 -->
<then>
<cmd name="follow" distance="150" run="false" continue="false" timeout="5000" />
<cmd name="wait" min="2000" max="3000" />
</then>
<!-- 배가 안고플 경우 -->
<else>
<if condition="expr" expr="@is_usable_skill(10004) and @random>0.5">
<then>
<cmd name="skill_relax" on="true" />
<cmd name="wait" min="7000" max="10000" />
<cmd name="skill_relax" on="false" />
<cmd name="wait" min="3000" max="5000" />
</then>
</if>
<if condition="expr" expr="@random>0.5">
<then>
<cmd name="move_random" radius="400" run="false" timeout="3000" />
</then>
</if>
<cmd name="wait" min="4000" max="7000" />
</else>
</if>
</then>
<else>
<if condition="expr" expr="@master_movestate == 1">
<then>
<cmd name="follow_target" target="1" distance="200" run="false" continue="false" timeout="5000" />
</then>
<else>
<cmd name="follow_target" target="1" distance="200" run="true" continue="false" timeout="5000" />
</else>
</if>
</else>
</if>
</sequence>
</pattern>
<pattern name="command:cute_trick">
<param_decl>
</param_decl>
<sequence>
<cmd name="chase" target="1" />
<cmd name="set_emotion" target="1" index="1" />
<cmd name="wait" min="15000" max="20000" />
</sequence>
</pattern>
<pattern name="command:sitdown">
<param_decl>
</param_decl>
<sequence>
<cmd name="skill_relax" on="true" />
<cmd name="stop" />
</sequence>
</pattern>
<pattern name="command:standup">
<param_decl>
</param_decl>
<sequence>
<cmd name="skill_relax" on="false" />
</sequence>
</pattern>
<pattern name="command:defense">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(20001) and @stamina>4">
<then>
<cmd name="prepare_skill" skill_id="20001" try_cnt="3" />
<cmd name="wait" min="10000" max="10000" />
<cmd name="cancel_skill" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.21]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:smash">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(20002) and @stamina>8">
<then>
<cmd name="prepare_skill" skill_id="20002" try_cnt="3" />
<cmd name="melee_attack" combo="1" timeout="6000" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.22]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:counter">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(20003) and @stamina>5">
<then>
<cmd name="prepare_skill" skill_id="20003" try_cnt="3" />
<cmd name="wait" min="10000" max="10000" />
<cmd name="cancel_skill" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.23]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:call">
<param_decl>
</param_decl>
<sequence>
<cmd name="say_to_all" text="_LT[xml.ai_local.24]" />
<cmd name="wait" min="500" max="1000" />
<cmd name="chase" target="1" />
</sequence>
</pattern>
<pattern name="command:firebolt">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(30201)">
<then>
<cmd name="stackmagic_attack" skill_id="30201" charge="1" timeout="10000" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.25]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:icebolt">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(30301)">
<then>
<cmd name="stackmagic_attack" skill_id="30301" charge="5" timeout="10000" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.26]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:lightningbolt">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(30101)">
<then>
<cmd name="stackmagic_attack" skill_id="30101" charge="1" timeout="10000" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.27]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:healing">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_usable_skill(30006) and @mana>20">
<then>
<cmd name="chase" target="1" />
<cmd name="prepare_skill" skill_id="30006" try_cnt="3" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.184]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="command:first_aid">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@is_preparable_skill(10009)">
<then>
<cmd name="chase" target="1" />
<cmd name="prepare_skill" skill_id="10009" try_cnt="3" />
<cmd name="process_skill" target="5" />
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.185]" />
</else>
</if>
</sequence>
</pattern>
<pattern name="attack">
<param_decl>
</param_decl>
<sequence>
<if condition="expr" expr="@stamina>8">
<!--암것도 못할 상황이 아니라면 전투 -->
<then>
<cmd name="melee_attack" combo="3" timeout="4000" />
<switch type="random">
<case rate="17">
<!--공격 -->
<cmd name="melee_attack" combo="3" timeout="4000" />
<!--공격 후 공격 or 마법 -->
<switch type="random">
<case rate="30">
<!--마법을 쓰는 경우-->
<if condition="expr" expr="@is_usable_skill(30201) and @mana>10">
<then>
<cmd name="move_against" distance="700" run="true" timeout="3000" />
<cmd name="stackmagic_attack" skill_id="30201" charge="1" timeout="10000" />
</then>
</if>
</case>
<case rate="10">
<!--후속타 -->
<cmd name="melee_attack" combo="3" timeout="3000" />
</case>
<case rate="15">
<!--디펜스 걸고 후퇴-->
<cmd name="prepare_skill" skill_id="20001" />
<!-- 방어 -->
<cmd name="move_against" distance="500" run="false" timeout="3000" />
<cmd name="cancel_skill" />
</case>
<case rate="30">
<!--달려서 후퇴-->
<cmd name="move_against" distance="500" run="true" timeout="2000" />
</case>
</switch>
</case>
<case rate="30">
<!-- 마법 -->
<if condition="expr" expr="@is_usable_skill(30201) and @mana>10">
<then>
<cmd name="move_against" distance="700" run="true" timeout="3000" />
<cmd name="stackmagic_attack" skill_id="30201" charge="1" timeout="10000" />
</then>
</if>
</case>
<case rate="8">
<cmd name="prepare_skill" skill_id="20002" />
<!-- 스매시 -->
<cmd name="melee_attack" combo="1" timeout="4000" />
</case>
<case rate="10">
<!-- 디펜스 -->
<cmd name="prepare_skill" skill_id="20001" />
<if condition="expr" expr="0.5>@life/@life_max">
<!--생명력이 절반 남았으면 물러난다-->
<then>
<cmd name="move_against" distance="600" run="true" timeout="5000" />
</then>
<else>
<!--만만하면 주위를 돈다 -->
<switch type="random">
<case rate="50">
<cmd name="move_around" radius="400" clockwise="true" run="false" timeout="2000" />
</case>
<case rate="50">
<cmd name="move_around" radius="400" clockwise="false" run="false" timeout="2000" />
</case>
</switch>
</else>
</if>
<cmd name="cancel_skill" />
</case>
<case rate="30">
<!-- 이동 -->
<switch type="random">
<case rate="30">
<cmd name="move_around" radius="400" clockwise="true" run="true" timeout="2000" />
</case>
<case rate="30">
<cmd name="move_around" radius="400" clockwise="false" run="true" timeout="2000" />
</case>
<case rate="20">
<cmd name="follow" distance="400" run="true" timeout="2000" />
</case>
<case rate="20">
<cmd name="move_against" distance="500" run="true" timeout="1000" />
</case>
</switch>
</case>
<case rate="5">
<!-- 카운터 -->
<cmd name="prepare_skill" skill_id="20003" />
<cmd name="wait" min="1000" max="10000" />
<cmd name="cancel_skill" />
</case>
</switch>
</then>
<else>
<cmd name="say_to_all" text="_LT[xml.ai_local.29]" />
<cmd name="move_around" radius="600" clockwise="true|false|" run="true|false|" timeout="3000" />
</else>
</if>
</sequence>
</pattern>
<pattern name="support">
<param_decl>
</param_decl>
<sequence>
<!-- 힐링 -->
<if condition="expr" expr="@is_usable_skill(30006) and @mana>20 and 0.9>@master_life/@master_life_max">
<then>
<cmd name="prepare_skill" skill_id="30006" try_cnt="3" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
<cmd name="process_skill" target="5" />
<cmd name="wait" min="800" max="800" />
</then>
</if>
<cmd name="wait" min="1000" max="1000" />
</sequence>
</pattern>
<pattern name="event_defence_success">
<param_decl>
<param name="delay" />
</param_decl>
<sequence>
<cmd name="melee_attack" combo="3" />
</sequence>
</pattern>
<pattern name="event_blowhit">
<param_decl>
<param name="delay" />
</param_decl>
<sequence>
<switch type="random">
<case rate="60">
<if condition="expr" expr="@is_usable_skill(20003)">
<then>
<!-- 카운터 -->
<cmd name="prepare_skill" skill_id="20003" />
<cmd name="wait" min="1000" max="10000" />
<cmd name="cancel_skill" />
</then>
</if>
</case>
<case rate="40">
<!-- 디펜스 -->
<cmd name="prepare_skill" skill_id="20001" />
<switch type="random">
<case rate="60">
<cmd name="move_around" radius="400|500|" clockwise="true|false|" run="false" timeout="5000" />
</case>
<case rate="40">
<cmd name="follow" distance="400" run="false" timeout="4000" />
</case>
</switch>
<cmd name="cancel_skill" />
<if condition="random" rate="50">
<then>
<cmd name="move_around" radius="800" clockwise="true" run="false" timeout="5000" />
</then>
<else>
<cmd name="melee_attack" combo="3" timeout="5000" />
</else>
</if>
</case>
</switch>
</sequence>
</pattern>
</patterns>
<strategy>
<!-- 주인과 max_radius거리만큼 멀어지면 follow_radius거리안으로 주인에게 다가감 -->
<idle type="idle_pet" max_radius="500" follow_radius="100">
<pattern name="wander" />
<pattern id="attack" name="attack" radius="400" />
<pattern id="support" name="support" radius="500" />
<pattern id="submission" name="submission" />
<event name="blowhit">
<pattern name="event_blowhit" delay="0" />
</event>
<event name="defence">
<pattern name="event_defence_success" delay="0" />
</event>
</idle>
</strategy>
</template>
<definition race="aidescdata_pet_horse">
<var_def>
<var name="visualfield_radius" value="800" />
<var name="audio_range" value="800" />
</var_def>
</definition>
</aidescdata>
Thats the code for the horse AI. i understand most of it. you can say how many times you want them to charge ice or fire and shit. but nowhere do i see master and rest together. i suck at coding by the way, but i cant find the rest thing. and if i were to look for it in another ai like infamy said where do i paste it?
EDIT: looked in the stock ai's none of them have that rule you were talkin about. matter of fact the command one has 3 rules and 2 of them are counter-related. i am lost someone help! D: