L2JLisvus

Would you like to react to this message? Create an account in a few clicks or log in to continue.

2 posters

    Devil's Isle spawnlist and AI [COMMITED]

    Karakan
    Karakan


    Posts : 756
    Join date : 2013-10-04

    Devil's Isle spawnlist and AI [COMMITED] Empty Devil's Isle spawnlist and AI [COMMITED]

    Post  Karakan 10th May 2017, 18:30

    Since the first L2j c3 revision devils isle spawnlist is all messed up.
    High level monsters mixed up with lower level monsters in a room for example.

    Even in their latest HighFive pack they didnt bother fixing it.

    Here is a cleaned up spawnlist with corrected monster locations (mostly taken from l2off files).

    Did few run-throughs and everything till Zakens door looks fine.



    The AI.
    Devils Isle monsters have a chance to respawnOnAttack on retail.
    No info about the chance is given. (I set it to 5%).



    The AI script  -->


    Here is the fixed spawnlist --->  


    Delete from spawnlist first :

    Code:
    DELETE FROM spawnlist WHERE npc_templateid=832;
    DELETE FROM spawnlist WHERE npc_templateid=833;
    DELETE FROM spawnlist WHERE npc_templateid=834;
    DELETE FROM spawnlist WHERE npc_templateid=835;
    DELETE FROM spawnlist WHERE npc_templateid=836;
    DELETE FROM spawnlist WHERE npc_templateid=839;
    DELETE FROM spawnlist WHERE npc_templateid=840;
    DELETE FROM spawnlist WHERE npc_templateid=841;
    DELETE FROM spawnlist WHERE npc_templateid=842;
    DELETE FROM spawnlist WHERE npc_templateid=843;
    DELETE FROM spawnlist WHERE npc_templateid=844;
    DELETE FROM spawnlist WHERE npc_templateid=845;
    DELETE FROM spawnlist WHERE npc_templateid=846;
    DELETE FROM spawnlist WHERE npc_templateid=847;
    DELETE FROM spawnlist WHERE npc_templateid=986;


    Last edited by Karakan on 12th July 2019, 15:39; edited 3 times in total
    DnR
    DnR
    Admin
    Admin


    Posts : 1475
    Join date : 2012-12-03
    Age : 34

    Devil's Isle spawnlist and AI [COMMITED] Empty Re: Devil's Isle spawnlist and AI [COMMITED]

    Post  DnR 26th August 2017, 15:07

    Good work! Merged to trunk.
    Karakan
    Karakan


    Posts : 756
    Join date : 2013-10-04

    Devil's Isle spawnlist and AI [COMMITED] Empty Re: Devil's Isle spawnlist and AI [COMMITED]

    Post  Karakan 18th July 2019, 15:18

    Made several updates to the original script.

    - ReCreated script in java.
    - Corrected polymorphing mobIds
    - Added missing npc_strings


    Enjoy.  Cool


    scripts.cfg

    Code:

    Index: scripts.cfg
    ===================================================================
    --- scripts.cfg (revision 627)
    +++ scripts.cfg (working copy)
    @@ -7,17 +7,17 @@
     
     # AI Section

    -ai/group_template/devils_isle.py
    +ai/group_template/DevilsIsle.java
     ai/group_template/feedable_beasts.py



    DevilsIsle.java

    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.group_template;

    import java.util.HashMap;
    import java.util.Map;

    import net.sf.l2j.gameserver.ai.CtrlIntention;
    import net.sf.l2j.gameserver.model.L2Attackable;
    import net.sf.l2j.gameserver.model.L2Character;
    import net.sf.l2j.gameserver.model.L2Object;
    import net.sf.l2j.gameserver.model.L2Skill;
    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.network.serverpackets.CreatureSay;
    import net.sf.l2j.util.Rnd;

    public class DevilsIsle extends Quest
    {
       private static final Map<Integer,Integer[]> POLYMORPHING_SPAWNS = new HashMap<>();

       static
      {
          //C4 - confirmed polymorphs
          POLYMORPHING_SPAWNS.put(833, new Integer[] { 1605, 10 }); // Zaken's Archer -> Zaken's Archer
          POLYMORPHING_SPAWNS.put(1605, new Integer[] { 1606, 5 }); // Zaken's Archer -> Zaken's Archer
          POLYMORPHING_SPAWNS.put(835, new Integer[] { 1608, 10 }); // Zaken's Seer -> Zaken's Watchman
          POLYMORPHING_SPAWNS.put(1608, new Integer[] { 1609, 5 }); // Zaken's Watchman -> Zaken's Watchman
          POLYMORPHING_SPAWNS.put(839, new Integer[] { 1611, 10 }); // Unpleasant Humming -> Unpleasant Humming
          POLYMORPHING_SPAWNS.put(1611, new Integer[] { 1612, 5 }); // Unpleasant Humming -> Unpleasant Humming
          POLYMORPHING_SPAWNS.put(840, new Integer[] { 1614, 10 }); // Death Flyer -> Death Flyer
          POLYMORPHING_SPAWNS.put(1614, new Integer[] { 1615, 5 }); // Death Flyer -> Death Flyer
          POLYMORPHING_SPAWNS.put(832, new Integer[] { 1602, 10 }); // Zaken's Pikeman -> Zaken's Pikeman
          POLYMORPHING_SPAWNS.put(1602, new Integer[] { 1603, 5 }); // Zaken's Pikeman -> Zaken's Pikeman
          POLYMORPHING_SPAWNS.put(842, new Integer[] { 1620, 10 }); // Musveren ->Musveren
          POLYMORPHING_SPAWNS.put(1620, new Integer[] { 1621, 5 }); // Musveren ->Musveren
          POLYMORPHING_SPAWNS.put(841, new Integer[]{1617, 10});  // Fiend Archer -> Fiend Archer
          POLYMORPHING_SPAWNS.put(1617, new Integer[]{1618, 5});  // Fiend Archer -> Fiend Archer
          POLYMORPHING_SPAWNS.put(844, new Integer[] { 1626, 10 }); // Kaim Vanul -> Kaim Vanul
          POLYMORPHING_SPAWNS.put(1626, new Integer[] { 1627, 5 }); // Kaim Vanul -> Kaim Vanul
          POLYMORPHING_SPAWNS.put(845, new Integer[] { 1629, 10 }); // Pirate's Zombie Captain -> Pirate's Zombie Captain
          POLYMORPHING_SPAWNS.put(1629, new Integer[] { 1630, 5 }); // Pirate's Zombie Captain -> Pirate's Zombie Captain
          POLYMORPHING_SPAWNS.put(846, new Integer[] { 1632, 10 }); // Doll Blader -> Doll Blader
          POLYMORPHING_SPAWNS.put(1632, new Integer[] { 1633, 5 }); // Doll Blader -> Doll Blader
          POLYMORPHING_SPAWNS.put(847, new Integer[] { 1635, 10 }); // Vale Master -> Vale Master
          POLYMORPHING_SPAWNS.put(1635, new Integer[] { 1636, 5 }); // Vale Master -> Vale Master
          //Need to check : 1623 Zaken's Guard - 1624 Zaken's Guard - 1625 Zaken's Elite Guard
      }
       
       private static final String[] NPC_STRING =
       {
          "Now the battle begins!",
          "You have more skills than i thought!",
          "You idiot i have just been toying with you.",
          "Witness my true power!"
       };

       public DevilsIsle (int questId, String name, String descr)
       {
          super(questId, name, descr);
            int[] mobs = { 833, 1605, 835, 1608, 839, 1611, 840, 1614, 832, 1602, 842, 1620, 841, 1617, 844, 1626, 845, 1629, 846, 1632, 847, 1635 };   
            registerMobs(mobs);
       }

       @Override
       public String onSkillSee(L2NpcInstance npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
       {
          if (skill.isOffensive() && targets[0] == npc)
          {
                Integer[] spawnData = POLYMORPHING_SPAWNS.get(npc.getNpcId());
                if (POLYMORPHING_SPAWNS.containsKey(npc.getNpcId()) && Rnd.get(100) <= spawnData[1] && npc.getCurrentHp() / npc.getMaxHp() < 0.5)
                {
                   npc.onDecay();
                   L2Attackable newNpc = (L2Attackable) addSpawn (spawnData[0], npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0);

                   newNpc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), (NPC_STRING[Rnd.get(4)])));

                   if (caster.getTarget() == npc)
                   {
                      newNpc.onAction(caster);
                   }

                   newNpc.setRunning();

                   L2Character originalCaster = isPet ? caster.getPet() : caster;
                   if (originalCaster != null)
                   {
                      newNpc.addDamageHate(originalCaster, 0, 100);
                      newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalCaster);
                   }
                }
             }

          return super.onSkillSee(npc, caster, skill, targets, isPet);
       }

       @Override
        public String onAttack (L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
       {
          Integer[] spawnData = POLYMORPHING_SPAWNS.get(npc.getNpcId());
          if (POLYMORPHING_SPAWNS.containsKey(npc.getNpcId()) && Rnd.get(100) <= spawnData[1] && npc.getCurrentHp() / npc.getMaxHp() < 0.5)
          {
                npc.onDecay();
                L2Attackable newNpc = (L2Attackable) addSpawn (spawnData[0], npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0);

                newNpc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), (NPC_STRING[Rnd.get(4)])));

                if (attacker.getTarget() == npc)
                {
                   newNpc.onAction(attacker);
                }

                newNpc.setRunning();

                L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
                if (originalAttacker != null)
                {
                   newNpc.addDamageHate(originalAttacker, 0, 100);
                   newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
                }
          }

          return super.onAttack(npc, attacker, damage, isPet);
       }

        public static void main(String[] args)
        {
            // Quest class and state definition
            new DevilsIsle(-1, "devilsisle", "ai/group_template");
        }
    }

    Sponsored content


    Devil's Isle spawnlist and AI [COMMITED] Empty Re: Devil's Isle spawnlist and AI [COMMITED]

    Post  Sponsored content


      Current date/time is 19th May 2024, 10:19