A Project for Chronicle 4 based on L2JServer.


    AI_INTENTION_ATTACK

    Share
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    AI_INTENTION_ATTACK

    Post  Karakan on 14th September 2015, 15:11

    Trying to fix Porta/Perum teleport skill.

    Just encoutering a little problem.
    Monster teleports you without a problem but looses its aggro right after.

    Any help is appreciated.

    Guess its missing "AI_INTENTION_ATTACK" ?


    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 net.sf.l2j.gameserver.handler.skillhandlers;

    import net.sf.l2j.gameserver.handler.ISkillHandler;
    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.L2Skill.SkillType;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.serverpackets.ValidateLocation;
    import net.sf.l2j.util.Rnd;

    /**
     * Mobs can teleport players to them.
     */
    public class GetPlayer implements ISkillHandler
    {
       private static final SkillType[] SKILL_IDS = {SkillType.GET_PLAYER};

        @Override
       public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
        {
            if (activeChar.isAlikeDead()) return;
            for (L2Object target : targets)
            {
              if (target instanceof L2PcInstance)
              {
                L2PcInstance trg = (L2PcInstance)target;
                if (trg.isAlikeDead()) continue;
                trg.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), true);
                trg.setXYZ(activeChar.getX()+Rnd.get(-10,10), activeChar.getY()+Rnd.get(-10,10), activeChar.getZ());
                trg.sendPacket(new ValidateLocation(trg));
              }
            }
        }   

        public SkillType[] getSkillIds()
        {
            return SKILL_IDS;
        }
    }
    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: AI_INTENTION_ATTACK

    Post  DnR on 21st September 2015, 23:33

    This line has a bad effect on this skill type.
    Code:

    trg.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), true);
    Actually, l2j has removed it since the implementation of this handler.
    I believe you have your reasons to use it, though.
    I can't see how ValidateLocation works as a teleport. >_<
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    Re: AI_INTENTION_ATTACK

    Post  Karakan on 21st September 2015, 23:44

    Did lot of trial and errors.
    Actually this was the only way to make to monster teleport my character.
    Rest just didnt do anything after casting "skilltype=GET_PLAYER".

    It works perfect , just missing the hate damage on the mob.
    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: AI_INTENTION_ATTACK

    Post  DnR on 22nd September 2015, 00:05

    I already have a thought of how to make it work flawlessly.
    It's going to be easy, unless errors occur.
    If everything is alright, i'm going to merge it to trunk and implement Summon PC skill.
    Just try to be a little more patient until tomorrow. Smile
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    Re: AI_INTENTION_ATTACK

    Post  Karakan on 22nd September 2015, 00:12

    I'll try to mess around with ai scripts till tomorrow then.
    A good time killer Very Happy
    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: AI_INTENTION_ATTACK

    Post  DnR on 23rd September 2015, 22:04

    I used a not so good way to help mob remain aggro.
    Now, it can even see through silent moving after teleportation.
    I believe it's a good start. Smile
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    Re: AI_INTENTION_ATTACK

    Post  Karakan on 24th September 2015, 01:18

    This looks awesome!!!^^
    Gonna test is tomorrow when im back home.

    Thanks for adding this feature!! Smile

    Edit : Just tested, works flawless!^^

    Sponsored content

    Re: AI_INTENTION_ATTACK

    Post  Sponsored content


      Current date/time is 23rd September 2017, 03:09