A Project for Chronicle 4 based on L2JServer.


    SearchingMaster AI

    Share
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    SearchingMaster AI

    Post  Karakan on 31st August 2017, 13:44

    Certain group monsters will attack the summoner instead of the summon. (ex. under giants cave)
    Here is a the script.
    Tested and working.  Cool



    Code:

    /*
    2 * This program is free software: you can redistribute it and/or modify it under
    3 * the terms of the GNU General Public License as published by the Free Software
    4 * Foundation, either version 3 of the License, or (at your option) any later
    5 * version.
    6 *
    7 * This program is distributed in the hope that it will be useful, but WITHOUT
    8 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    9 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    10 * details.
    11 *
    12 * You should have received a copy of the GNU General Public License along with
    13 * this program. If not, see <http://www.gnu.org/licenses/>.
     */
    // By Karakan for L2jLisvus
    package ai.group_template;

    import net.sf.l2j.gameserver.ai.CtrlIntention;
    import net.sf.l2j.gameserver.model.L2Attackable;
    import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.quest.Quest;

    public class SearchingMaster extends Quest
    {
            private static final int[] MOBS =
            {
                    960,961,962,963,964,965,966,967,968,969,970,971,972,973
            };
          
            public SearchingMaster(int questId, String name, String descr)
            {
                    super(questId, name, descr);
     registerMobs(MOBS);
            }
          
            @Override
            public String onAttack(L2NpcInstance npc, L2PcInstance player, int damage, boolean isPet)
            {
                    if (player == null)
                            return null;
                  
                    npc.setIsRunning(true);
                    ((L2Attackable) npc).addDamageHate(player, 0, 100);
                    npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
                  
                    return super.onAttack(npc, player, damage, isPet);
            }
          
            public static void main(String[] args)
            {
                    new SearchingMaster(-1, "SearchingMaster", "ai/group_template");
            }
    }

    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: SearchingMaster AI

    Post  DnR on 4th September 2017, 11:04

    Added to project. Thanks for sharing. Wink

      Current date/time is 20th September 2017, 15:46