L2JLisvus

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

2 posters

    FrenzyOnAttack [COMMITED]

    Karakan
    Karakan


    Posts : 756
    Join date : 2013-10-04

    FrenzyOnAttack [COMMITED] Empty FrenzyOnAttack [COMMITED]

    Post  Karakan 25th September 2015, 15:44

    Removed skill from npc_skills.sql.
    Now will be casted when monster hp < 25% only.

    Have Fun! Smile


    scripts.cfg

    Code:
    Index: scripts.cfg
    ===================================================================
    --- scripts.cfg (revision 551)
    +++ scripts.cfg (working copy)
    @@ -10,6 +10,7 @@
     ai/group_template/polymorphing_onAttack.py
     ai/group_template/chests.py
     ai/group_template/fairy_trees.py
    +ai/group_template/FrenzyOnAttack.java
     ai/group_template/feedable_beasts.py
     ai/group_template/polymorphing_angel.py




    \data\scripts\ai\group_template\FrenzyOnAttack.java

    http://pastebin.com/A3QQ7DRL




    Code:
    Index: npcskills.sql
    ===================================================================
    --- npcskills.sql (revision 551)
    +++ npcskills.sql (working copy)
    @@ -1069,7 +1069,6 @@
     -- Breka Orc Overlord
     (270, 4295, 1), -- Race
     (270, 4032, 3), -- NPC Strike
    -(270, 4318, 1), -- Ultimate Buff
     -- Breka Orc Warrior
     (271, 4295, 1), -- Race
     (271, 4032, 3), -- NPC Strike
    @@ -1847,7 +1846,6 @@
     -- Turek Orc Warlord
     (495, 4295, 1), -- Race
     (495, 4303, 1), -- Strong Type
    -(495, 4318, 1), -- Ultimate Buff
     -- Turek Orc Archer
     (496, 4295, 1), -- Race
     (496, 4303, 1), -- Strong Type
    @@ -2197,7 +2195,6 @@
     (588, 4090, 1), -- NPC Wolf Stun
     (588, 4091, 1), -- NPC Ogre Stun
     (588, 4092, 1), -- NPC Puma Stun
    -(588, 4318, 1), -- Ultimate Buff
     -- Fline
     (589, 4296, 1), -- Race
     (589, 4303, 1), -- Strong Type
    @@ -3033,7 +3030,6 @@
     (777, 4293, 1), -- Race
     -- Ragna Orc Overlord
     (778, 4295, 1), -- Race
    -(778, 4318, 1), -- Ultimate Buff
     -- Ragna Orc Seer
     (779, 4295, 1), -- Race
     -- Bloody Axe Elite
    @@ -4963,7 +4959,6 @@
     (1116, 4091, 1), -- NPC Ogre Stun
     (1116, 4033, 8), -- NPC Burn
     (1116, 4032, 8), -- NPC Strike
    -(1116, 4318, 1), -- Ultimate Buff
     -- Kasha Imp
     (1117, 4302, 1), -- Race
     -- Baar Dre Vanul
    @@ -7616,7 +7611,6 @@
     (1468, 4285, 4), -- Resist Sleep
     (1468, 4600, 6), -- Reducing P.Def Shock
     (1468, 4589, 6), -- Decrease Speed
    -(1468, 4318, 1), -- Ultimate Buff
     -- Alpen Kookaburra
     (1469, 4293, 1), -- Race
     (1469, 4305, 1), -- Strong Type
    @@ -7624,7 +7618,6 @@
     (1469, 4566, 6), -- NPC Eruption - Magic
     (1469, 4160, 6), -- NPC Aura Burn - Magic
     (1469, 4571, 6), -- NPC Blazing Circle
    -(1469, 4318, 1), -- Ultimate Buff
     (1469, 4657, 6), -- Hold
     -- Alpen Buffalo
     (1470, 4293, 1), -- Race
    @@ -7742,7 +7735,6 @@
     (1487, 4285, 4), -- Resist Sleep
     (1487, 4600, 6), -- Reducing P.Def Shock
     (1487, 4589, 6), -- Decrease Speed
    -(1487, 4318, 1), -- Ultimate Buff
     -- Alpen Buffalo
     (1488, 4293, 1), -- Race
     (1488, 4305, 1), -- Strong Type
    @@ -7750,7 +7742,6 @@
     (1488, 4566, 6), -- NPC Eruption - Magic
     (1488, 4160, 6), -- NPC Aura Burn - Magic
     (1488, 4571, 6), -- NPC Blazing Circle
    -(1488, 4318, 1), -- Ultimate Buff
     (1488, 4657, 6), -- Hold
     -- Alpen Cougar
     (1489, 4293, 1), -- Race
    @@ -7868,7 +7859,6 @@
     (1506, 4285, 4), -- Resist Sleep
     (1506, 4600, 6), -- Reducing P.Def Shock
     (1506, 4589, 6), -- Decrease Speed
    -(1506, 4318, 1), -- Ultimate Buff
     -- Alpen Cougar
     (1507, 4293, 1), -- Race
     (1507, 4305, 1), -- Strong Type
    @@ -7876,7 +7866,6 @@
     (1507, 4566, 6), -- NPC Eruption - Magic
     (1507, 4160, 6), -- NPC Aura Burn - Magic
     (1507, 4571, 6), -- NPC Blazing Circle
    -(1507, 4318, 1), -- Ultimate Buff
     (1507, 4657, 6), -- Hold
     -- Splinter Stakato
     (1508, 4301, 1), -- Race


    Last edited by Karakan on 12th July 2019, 15:34; edited 1 time in total
    DnR
    DnR
    Admin
    Admin


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

    FrenzyOnAttack [COMMITED] Empty Re: FrenzyOnAttack [COMMITED]

    Post  DnR 25th August 2017, 23:13

    Added to trunk. Cool
    Karakan
    Karakan


    Posts : 756
    Join date : 2013-10-04

    FrenzyOnAttack [COMMITED] Empty Re: FrenzyOnAttack [COMMITED]

    Post  Karakan 23rd June 2019, 17:15

    Updated code Cool



    Code:


    Index: FrenzyOnAttack.java
    ===================================================================
    --- FrenzyOnAttack.java  (revision 617)
    +++ FrenzyOnAttack.java  (working copy)
    @@ -14,7 +14,10 @@
      */
     package ai.group_template;
     
    +import net.sf.l2j.gameserver.ai.CtrlIntention;
     import net.sf.l2j.gameserver.datatables.SkillTable;
    +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;
    @@ -22,35 +25,39 @@
     import net.sf.l2j.util.Rnd;
     
     /**
    - * Frenzy behavior on low health. Few others monsters got that skillId too, need to check "retail C4" : and remove npc_skills for those too. Halisha's Officer Executioner of Halisha by Karakan for L2JLisvus
    + * Frenzy (Ultimate Buff) behavior on low health.
    + * By Karakan for L2JLisvus
      */
     public class FrenzyOnAttack extends Quest
     {
    -  private static final int BREKA_ORC_OVERLORD = 270;
    -  private static final int TUREK_ORC_OVERLORD = 495;
    -  private static final int TIMAK_ORC_OVERLORD = 588;
    -  private static final int RAGNA_ORC_OVERLORD = 778;
    -  private static final int HAMES_ORC_OVERLORD = 1116;
    -  private static final int ALPEN_KOOKABURRA = 1468;
    -  private static final int ALPEN_KOOKABURRA2 = 1469;
    -  private static final int ALPEN_BUFFALO = 1487;
    -  private static final int ALPEN_BUFFALO2 = 1488;
    -  private static final int ALPEN_COUGAR = 1506;
    -  private static final int ALPEN_COUGAR2 = 1507;
    -  // private static final int HALISHAS_OFFICER = 12955;
    -  // private static final int HALISHAS_OFFICER2 = 12961;
    -  // private static final int HALISHAS_OFFICER3 = 12964;
    -  // private static final int EXECUTIONER_OF_HALISHA = 12993;
    -  // private static final int EXECUTIONER_OF_HALISHA2 = 12994;
    -  // private static final int EXECUTIONER_OF_HALISHA3 = 12995;
    -  // private static final int EXECUTIONER_OF_HALISHA4 = 12996;
    -  // private static final int EXECUTIONER_OF_HALISHA5 = 12997;
    -  // private static final int EXECUTIONER_OF_HALISHA6 = 12998;
    -  // private static final int EXECUTIONER_OF_HALISHA7 = 12999;
    -  // private static final int EXECUTIONER_OF_HALISHA8 = 13000;

    -  private static final String[] ORCS_WORDS =
    +  public FrenzyOnAttack (int questId, String name, String descr)
        {
    +      super(questId, name, descr);
    +        int[] mobs =
    +      {
    +        270,
    +        495,
    +        588,
    +        778,
    +        1116,
    +        12955,
    +        12958,
    +        12961,
    +        12964,
    +        12993,
    +        12994,
    +        12995,
    +        12996,
    +        12997,
    +        12998,
    +        12999,
    +        13000
    +      };
    +        registerMobs(mobs);
    +  }
    +
    +  private static final String[] ORC_WORDS =
    +  {
          "Dear ultimate power!!!",
          "The battle has just begun!",
          "I never thought I'd use this against a novice!",
    @@ -57,54 +64,59 @@
          "You won't take me down easily."
        };
       
    -  public FrenzyOnAttack(int questId, String name, String descr)
    -  {
    -      super(questId, name, descr);
    -      int[] mobs =
    -      {
    -        BREKA_ORC_OVERLORD,
    -        TUREK_ORC_OVERLORD,
    -        TIMAK_ORC_OVERLORD,
    -        RAGNA_ORC_OVERLORD,
    -        HAMES_ORC_OVERLORD,
    -        ALPEN_KOOKABURRA,
    -        ALPEN_KOOKABURRA2,
    -        ALPEN_BUFFALO,
    -        ALPEN_BUFFALO2,
    -        ALPEN_COUGAR,
    -        ALPEN_COUGAR2
    -        // HALISHAS_OFFICER,
    -        // HALISHAS_OFFICER,
    -        // HALISHAS_OFFICER,
    -        // EXECUTIONER_OF_HALISHA,
    -        // EXECUTIONER_OF_HALISHA2,
    -        // EXECUTIONER_OF_HALISHA3,
    -        // EXECUTIONER_OF_HALISHA4,
    -        // EXECUTIONER_OF_HALISHA5,
    -        // EXECUTIONER_OF_HALISHA6,
    -        // EXECUTIONER_OF_HALISHA7,
    -        // EXECUTIONER_OF_HALISHA8
    -      };
    -      registerMobs(mobs);
    -  }

        @Override
    +    public String onSpawn(L2NpcInstance npc)
    +    {
    +      // Reset script value
    +        if (npc.getScriptValue() > 0)
    +        {
    +          npc.setScriptValue(0);
    +        }
    +        return super.onSpawn(npc);
    +    } 
    +
    +  @Override
        public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
        {
    -      // The only requirements are HP < 25%.
    -      if (((npc.getCurrentHp() / npc.getMaxHp()) < 0.25) && (Rnd.get(10) == 0))
    +      if (npc.getCurrentHp() / npc.getMaxHp() < 0.25 && Rnd.get(100) < 30 && npc.getScriptValue() == 0)
          {
    -        npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), (ORCS_WORDS[Rnd.get(ORCS_WORDS.length)])));
    +        if (npc.getNpcId() == 270 ||  npc.getNpcId() == 495 || npc.getNpcId() == 588 || npc.getNpcId() == 778 || npc.getNpcId() == 1116)
    +        {
    +            npc.broadcastPacket(new CreatureSay(npc.getObjectId(),0,npc.getName(),(ORC_WORDS[Rnd.get(ORC_WORDS.length)])));
    +        }
    +        npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
              npc.setTarget(npc);
    -        // ULTIMATE_BUFF
    -        npc.doCast(SkillTable.getInstance().getInfo(4318, 1));
    +        npc.doCast(SkillTable.getInstance().getInfo(4318,1));
    +        npc.setScriptValue(1);
          }
    +
          return super.onAttack(npc, attacker, damage, isPet);
        }
       
    -  public static void main(String[] args)
    +  @Override
    +  public String onSkillSee(L2NpcInstance npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
        {
    -      // Quest class and state definition
    -      new FrenzyOnAttack(-1, "frenzyonattack", "ai/group_template");
    -  }
    +      if (skill.isOffensive() && targets[0] == npc)
    +      { 
    +        if (npc.getCurrentHp() / npc.getMaxHp() < 0.25 && Rnd.get(100) < 30 && npc.getScriptValue() == 0)
    +        {
    +            if (npc.getNpcId() == 270 ||  npc.getNpcId() == 495 || npc.getNpcId() == 588 || npc.getNpcId() == 778 || npc.getNpcId() == 1116)
    +            {
    +              npc.broadcastPacket(new CreatureSay(npc.getObjectId(),0,npc.getName(),(ORC_WORDS[Rnd.get(ORC_WORDS.length)])));
    +            }
    +            npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
    +            npc.setTarget(npc);
    +            npc.doCast(SkillTable.getInstance().getInfo(4318,1));
    +            npc.setScriptValue(1);
    +        }
    +      } 
    +
    +      return super.onSkillSee(npc, caster, skill, targets, isPet);
    +  }     

    +    public static void main(String[] args)
    +    {
    +        // Quest class and state definition
    +        new FrenzyOnAttack(-1, "frenzyonattack", "ai/group_template");
    +    }
     }
    \ No newline at end of file

    Back to top

    DnR
    DnR
    Admin
    Admin


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

    FrenzyOnAttack [COMMITED] Empty Re: FrenzyOnAttack [COMMITED]

    Post  DnR 30th June 2019, 18:06

    Script updated. Thanks for your work. Wink

    Sponsored content


    FrenzyOnAttack [COMMITED] Empty Re: FrenzyOnAttack [COMMITED]

    Post  Sponsored content


      Current date/time is 19th May 2024, 07:37