Jump to content
  • 0

Stuck After Attacking The Npc


Question

Posted

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 ;)

Recommended Posts

  • 0
Posted

You both suck :troll:

 

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

  • 0
Posted

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.

  • 0
Posted

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

  • 0
Posted

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);
        }
    }

  

  • 0
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Rosyk or rusik or whatever u blaim me tha my mouth stinks but I assume you the one who stinks and your perfect pack will be now shared and you can suck a dick )  https://eu2.contabostorage.com/d4b39866f6bb4084b6c969ec8fe20063:kita/Lucera_Classic_Remaster/Lucera Classic Remaster Server and Datapack files.rar  https://eu2.contabostorage.com/d4b39866f6bb4084b6c969ec8fe20063:kita/Lucera_Classic_Remaster/Lucera Classic Remaster Eng Client.rar Drama link   
    • @Huggo Thank you for asking! When you join our Discord, on the Nexus Marketing section there is a #work-showcase channel. There you can see a little bit of what we are able to produce as a final ready-to-post product.  There is also this link in my new personal montage YouTube channel, in which I will be uploading every recent work: https://youtube.com/playlist?list=PLkzBKexKw8Wj8dC2diYndd5yOWOXUQCJW&si=-HGxlovqzvD4qqy2 Two more videos are coming up this week, and a #reviews channel has opened for our clients to let other people know about their experience working with us. Feel free to join our Hub in Discord, and for any inquries you might have don't hesitate to contact me or post your suggestion at #suggestions channel.  
    • Следи за своим вонючим языком, мудак.   Your mouth stinks, go wash your mouth, it's a dump) I don't know who you are or what you are, and I don't recommend buying anything from people outside of my network, as they may sell garbage under the guise of my work. There have been cases where my sales have been compromised. Additionally, reselling below the purchase price has been prohibited. I wish you all the best and peace. I kindly request that the moderators close this topic, as it is no longer relevant and the contact information is outdated.    
  • Topics

×
×
  • 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