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

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.



  • Posts

    • Hello everyone I'm Albert, Starting now with the dream on have a L2 server, I'm having several issues with RS and I need someone help to Create an skill and implement to the correct class ID and make it work. Skill Required from me is  Festival Sweep  Skill or Item with the ability. I really need help guys and then after if possible i would need NPC and skins with .dressme        
    • Changeset 410 (3371)   Makers, NpcAi / Desires, Cursed Weapon rework, Bugfixes, Admincommands, Movement, Organization   Makers Fix ghost corpses. Introduce task manager for MultiSpawn spawn schedule. Introduce task managers for Npc respawn and despawn tasks. Add missing random treasurebox maker. NpcAi / Desires AttackableAttack > NpcAttack, allowing ATTACK_FINISHED event over Npc. Merge all reduceWeight from NpcAI operations. Don't broadcast MoveToPawn packet for cast hold scenarii. CH and CP managers use hold cast. Probably way more to add. Rework DesireQueue#addOrUpdate to avoid to generate a List. Drop _isInHitAnimation, avoid twice runAI calls upon attack end animation, save a ThreadPool. Implement Desire#isInvalid, used over the main loop to clean invalid Desires. All sided getDesires().removeIf are dropped, notably over AggroList/HateList. Cursed Weapon rework Fix potential task scheduling issues, reworking the whole layers. Reduce code by 1/3. Use L2OFF formulas/data for item drop rate, staging process. CW end duration now decreases when killing other Players. Bugfixes Revert schedule part from ThreadPool. Fix Pet inventory IU. Ty Denzel for the report. Fix Pet item timestamp reuse delay. Ty artemis for the fix. Disable automatic beastshots when his owner dies. Ty Root for the report. Player cannot craft while casting a skill, nor trade. Ty Root for the report. Add missing weight checks for player/summon pickup, and player craft. Ty Root for the report. Implement /graduatelist command, which displays a list of clan academy graduates for the past week. Ty RooT for the report. Fix PLAYING_FOR_LONG_TIME concept ; rest message is server related, not Player related. Ty RooT for the report. Player should stop movement when opening store. Fix Q351 occurences of itemId 4310 by 4407 one + slight fix. Fix Q365 missing memoState + poison skillId. Ty Root for the report. Fix Q417 Torai despawn over cond 11. Fix Q216 4 missing npcIds. Ty Karudin for the report. Fix the invalid comment of DeleteCharAfterDays Config. Fix NPC drop penalty level calculation. Ty Bandnentans for the report. Items are now dropped in a 30/45 donut shape around dropper. Ty Bandnentans for the report. PartyMatch fixes Don't show Party members or CW holder as available waiting members. You can't show overall List or join a PartyMatch room as CW holder. CW owner, upon acquisition, leave PartyMatch system. PartyMatch window is now automatically closed upon Player#removeMeFromPartyMatch. Remove Player from PartyMatch if Player and newly joined Party leader PartyMatch rooms differ. You can't join or be invited in a PartyMatch room if already partying/CW holding. Fix ShowLicence config when set to false. Ty artemis for the fix. Fix maximum number of macros. Ty artemis for the fix. Fix invalid IU update over //enchant. Ty artemis for the fix. Fix Castle Mass Gatekeeper HTMs. Ty kingNik0n for the fix. Drop _disabledItems implementation. Won't be used by next refactors. Ty artemis for the report. Fix loading handlers under debug. Ty Keku for the fix. Fix character_macroses table structure (commands = 12x32 chars minimum). Admincommands Merge all old spawn admincommands (//list_spawns, //spawn, //unspawnall, //respawnall, //delete) to //spawn and //unspawn (previously //delete). Generate //help. //unspawn works over all ASpawn. Merge all old fence admincommands (//spawnfence, //deletefence, //listfence) to //fence [add|remove], generate AdminFence. They now use proper Pagination. You can also teleport to it. Implementation of //show manor. Implementation of //set quest <id> [cond]. Related items must be hand-given. Implementation of //set henna [page] [add|remove symbolId]. The hennas are still bound to game logic (slots, canBeUsedBy). Movement - Ty LaRoja, Bandnentans Fix Boats IOOBE. Adapt getHeight logic from L2OFF. Introduce back WASD movement, handle boat board/unboard. Fix WATER/FLY movement logic. Avoid to pathfind diagonal cells with detected obstacle. Organization Addition of QuestVars class, holding all related variables from quests (itemIds, npcIds, questNames, sounds, etc), allowing to reduce length of each script while reusing variables. 100+ cloned variables were deleted. Refactor geometry package and Territory. Territory is now a unique 3D shape, holding any type of 2D geometry.  Remove few useless Location#clone uses. Implementation of ItemContainer#forEachItem. Clean many unused FrequentSkill. The whole enum is questionable. Drop MathUtil#checkIfInRange, implement WorldObject#isInStrictRadius (involve collision of that WorldObject, and potential WorldObject parameter). WorldObject#isIn2DRadius parameter is now a Point2D, not a Location (since a Location inherits Point2D, Location are still usable as parameter). Rework Pagination#generatePages to handle page number > 1000. Use Pagination over Tryskell SchemeBuffer. Ty CUCU23 for the share.
    • It's a custom instance used as Event not retail - like. You can re-create it easily.
    • GRAND OPENING TODAY !!! FROM - 16/05/2025, FRIDAY, 20:00 +3 GMT !
  • Topics

×
×
  • Create New...