Jump to content
  • 0

Stuck After Attacking The Npc


zuper

Question

Hello,

 

I have problem, when attacking NPC (not mob) with skill for example gatekeeper in random zone, character gets stuck. You cant move, use skills, use /unstuck command or escape scrolls you have to reconnect. Pack is L2jAcis.

 

Please, help me to sort out this problem, thank you ;)

Link to comment
Share on other sites

Recommended Posts

  • 0

You both suck :troll:

 

L2Playable is the correct place. About issue, probably missing action failed packet :D

Link to comment
Share on other sites

  • 0

To know the best possible fix, we must know what have you edited before. But to block hitting npc the check should be made @ L2Playable.

Link to comment
Share on other sites

  • 0

To know the best possible fix, we must know what have you edited before. But to block hitting npc the check should be made @ L2Playable.

 

 

a missing actionfailed packet doesnt lead to npe neither to such stucks, stucks from missing actionfailed are soft

Link to comment
Share on other sites

  • 0

Could you please help me and tell me what to edit to disable casting skills on NPC.

public void callSkill(L2Skill skill, L2Object[] targets)
    {
        try
        {
            // Get the skill handler corresponding to the skill type (PDAM, MDAM, SWEEP...) started in gameserver
            ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(skill.getSkillType());
            Weapon activeWeapon = getActiveWeaponItem();
            
            // Check if the toggle skill effects are already in progress on the L2Character
            if (skill.isToggle() && getFirstEffect(skill.getId()) != null)
                return;
            
            // Initial checks
            for (L2Object trg : targets)
            {
                if (trg instanceof L2Character)
                {
                    // Set some values inside target's instance for later use
                    L2Character target = (L2Character) trg;
                    
                    if (!Config.RAID_DISABLE_CURSE)
                    {
                        // Raidboss curse.
                        L2Character targetsAttackTarget = null;
                        
                        if (target.hasAI())
                            targetsAttackTarget = (L2Character) target.getAI().getTarget();
                        
                        if ((target.isRaid() && getLevel() > target.getLevel() + 8) || (!skill.isOffensive() && targetsAttackTarget != null && targetsAttackTarget.isRaid() && targetsAttackTarget.getAttackByList().contains(target) && getLevel() > targetsAttackTarget.getLevel() + 8))
                        {
                            L2Skill curse = FrequentSkill.RAID_CURSE.getSkill();
                            if (curse != null)
                            {
                                // Send visual and skill effects. Caster is the victim.
                                broadcastPacket(new MagicSkillUse(this, this, curse.getId(), curse.getLevel(), 300, 0));
                                curse.getEffects(this, this);
                            }
                            return;
                        }
                    }
                    
                    // Check if over-hit is possible
                    if (skill.isOverhit())
                    {
                        if (target instanceof L2Attackable)
                            ((L2Attackable) target).overhitEnabled(true);
                    }
                    
                    switch (skill.getSkillType())
                    {
                        case COMMON_CRAFT: // Crafting does not trigger any chance skills.
                        case DWARVEN_CRAFT:
                            break;
                        
                        default: // Launch weapon Special ability skill effect if available
                            if (activeWeapon != null && !target.isDead())
                            {
                                if (this instanceof L2PcInstance && !activeWeapon.getSkillEffects(this, target, skill).isEmpty())
                                    sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_ACTIVATED).addSkillName(skill));
                            }
                            
                            // Maybe launch chance skills on us
                            if (_chanceSkills != null)
                                _chanceSkills.onSkillHit(target, false, skill.isMagic(), skill.isOffensive(), skill.getElement());
                            
                            // Maybe launch chance skills on target
                            if (target.getChanceSkills() != null)
                                target.getChanceSkills().onSkillHit(this, true, skill.isMagic(), skill.isOffensive(), skill.getElement());
                    }
                }
            }
            
            // Launch the magic skill and calculate its effects
            if (handler != null)
                handler.useSkill(this, skill, targets);
            else
                skill.useSkill(this, targets);
            
            L2PcInstance player = getActingPlayer();
            if (player != null)
            {
                for (L2Object target : targets)
                {
                    // EVT_ATTACKED and PvPStatus
                    if (target instanceof L2Character)
                    {
                        if (skill.isOffensive())
                        {
                            if (target instanceof L2Playable)
                            {
                                // Signets are a special case, casted on target_self but don't harm self
                                if (skill.getSkillType() != L2SkillType.SIGNET && skill.getSkillType() != L2SkillType.SIGNET_CASTTIME)
                                {
                                    ((L2Character) target).getAI().clientStartAutoAttack();
                                    
                                    // attack of the own pet does not flag player
                                    if (player.getPet() != target)
                                        player.updatePvPStatus((L2Character) target);
                                }
                            }
                            else if (target instanceof L2Attackable)
                            {
                                switch (skill.getId())
                                {
                                    case 51: // Lure
                                    case 511: // Temptation
                                        break;
                                    default:
                                        // add attacker into list
                                        ((L2Character) target).addAttackerToAttackByList(this);
                                }
                            }
                            // notify target AI about the attack
                            if (((L2Character) target).hasAI())
                            {
                                switch (skill.getSkillType())
                                {
                                    case AGGREDUCE:
                                    case AGGREDUCE_CHAR:
                                    case AGGREMOVE:
                                        break;
                                    default:
                                        ((L2Character) target).getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, this);
                                }
                            }
                        }
                        else
                        {
                            if (target instanceof L2PcInstance)
                            {
                                // Casting non offensive skill on player with pvp flag set or with karma
                                if (!(target.equals(this) || target.equals(player)) && (((L2PcInstance) target).getPvpFlag() > 0 || ((L2PcInstance) target).getKarma() > 0))
                                    player.updatePvPStatus();
                            }
                            else if (target instanceof L2Attackable && !((L2Attackable) target).isGuard())
                            {
                                switch (skill.getSkillType())
                                {
                                    case SUMMON:
                                    case BEAST_FEED:
                                    case UNLOCK:
                                    case UNLOCK_SPECIAL:
                                    case DELUXE_KEY_UNLOCK:
                                        break;
                                    default:
                                        player.updatePvPStatus();
                                }
                            }
                        }
                        
                        switch (skill.getTargetType())
                        {
                            case TARGET_CORPSE_MOB:
                            case TARGET_AREA_CORPSE_MOB:
                                if (((L2Character) target).isDead())
                                    ((L2Npc) target).endDecayTask();
                                break;
                        }
                    }
                }
                
                // Mobs in range 1000 see spell
                for (L2Npc npcMob : player.getKnownList().getKnownTypeInRadius(L2Npc.class, 1000))
                {
                    List<Quest> quests = npcMob.getTemplate().getEventQuests(QuestEventType.ON_SKILL_SEE);
                    if (quests != null)
                        for (Quest quest : quests)
                            quest.notifySkillSee(npcMob, player, skill, targets, this instanceof L2Summon);
                }
            }
            
            // Notify AI
            if (skill.isOffensive())
            {
                switch (skill.getSkillType())
                {
                    case AGGREDUCE:
                    case AGGREDUCE_CHAR:
                    case AGGREMOVE:
                        break;
                    default:
                        for (L2Object target : targets)
                        {
                            // notify target AI about the attack
                            if (target instanceof L2Character && ((L2Character) target).hasAI())
                                ((L2Character) target).getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, this);
                        }
                        break;
                }
            }
        }
        catch (Exception e)
        {
            _log.log(Level.WARNING, getClass().getSimpleName() + ": callSkill() failed on skill id: " + skill.getId(), e);
        }
    }

  

Link to comment
Share on other sites

  • 0

your exception gives no info about the npe because its handled and catched from a try catch, probably the code piece you linked above. so your best chance is to remove the try-catch block and keep its content, try again and the npe and all its details will be debugged on your gameserver leading you to the excact line of npe.

 

Thats my npe trace, strategy if it fails then you have to debug it with messages, system.out.prinln("no error on line 1); etc

 

Good luck

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock