A Project for Chronicle 4 based on L2JServer.


    Honey Bear AI (c2-c4 retail like)

    Share
    avatar
    Karakan

    Posts : 428
    Join date : 2013-10-04

    Honey Bear AI (c2-c4 retail like)

    Post  Karakan on 24th March 2016, 17:55

    Npc lines are taken from retail files
    Have fun hunting them^^


    Site Note : Im working on more "oldschool" c1-c4 monters AI's , stay tuned.



    Code:

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

    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;
    import net.sf.l2j.gameserver.serverpackets.CreatureSay;
    import net.sf.l2j.util.Rnd;

    /**
     * @by Karakan for L2JLisvus
     */
    public class HoneyBear extends Quest
    {
     private static final int HONEY_BEAR = 5058;
     
     public HoneyBear (int questId, String name, String descr)
     {
     super(questId, name, descr);
     int[] mobs = {HONEY_BEAR};
     registerMobs(mobs);
     }

     @Override
     public String onSpawn(L2NpcInstance npc)
     {
     if (npc.getNpcId() == HONEY_BEAR && Rnd.get(10) == 0)
     {
     npc.broadcastPacket(new CreatureSay(npc.getObjectId(),1,npc.getName(),"What does honey of this place taste like?!"));
     }
     else
     {
     npc.broadcastPacket(new CreatureSay(npc.getObjectId(),1,npc.getName(),"Give me some sweet, delicious golden honey!"));
     }
     return super.onSpawn(npc);
     }

     @Override
        public String onAttack (L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
        {
            if (npc.getCurrentHp() / npc.getMaxHp() > 0.99) //to prevent chat spamming
            {
     npc.broadcastPacket(new CreatureSay(npc.getObjectId(),1,npc.getName(),"If you give me some honey, I'll at least spare your life..."));
            }
     return super.onAttack(npc, attacker, damage, isPet);
        }

     @Override
     public String onKill (L2NpcInstance npc, L2PcInstance killer, boolean isPet)
     {
     if (npc.getNpcId() == HONEY_BEAR)
     {
     npc.broadcastPacket(new CreatureSay(npc.getObjectId(),1,npc.getName(),"Only for lack of honey did I lose to the likes of you."));
     }
     return super.onKill(npc,killer,isPet);
     }

     public static void main(String[] args)
     {
     // now call the constructor (starts up the ai)
     new HoneyBear(-1, "honeybear", "ai/individual");
     }
    }

    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: Honey Bear AI (c2-c4 retail like)

    Post  DnR on 9th April 2016, 10:03

    Added to datapack. Thanks. Smile

      Current date/time is 19th November 2017, 14:07