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

    • OpenCV bot working for all l2 clients... but need special set for each server
    • Use l2tower for free, or try adrenaline. @Alex K.
    • 🎁 Double the Impact, Half the Cost! from 25/10/2025 until 25/12/2025 Buy or Renew your Donation Panel now and save 50% because supporting others should reward you too. 💡 Use code BLACKFRIDAY at checkout! https://hopzone.eu/store/product/26-donate-panel-v5/   About Donate Panel v5 PAYMENT IN EASY 5 STEPS Login with your character name. Select the donation service (Paypal Stripe Payeer MercadoPago 🆕). Select the amount of payment. Pay. 😎 Automatically recieve the reward ingame (and yes) while he is online! 🤯 PAYMENT METHODS Paypal Stripe accepts credit cards, debit cards, ACH transfers, Apple Pay, Google Pay, Microsoft Pay, and various local payment methods from around the world. Payeer accepts BTC, LTC, ETH, DASH, BCH, USD, EUR, RUB wallets MercadoPago accepts ARS, BRL, CLP, MXN, COP, PEN, UYU. PROTECTION Full SSL website (can be forced by htaccess) XSS Protection just in case. Remove vulnerability headers in htaccess level Session Validation COOKIE, POST, GET global inputs are sanitized SQL Injection protection Query String protetion Prepared statements of PDO driver (no sql injection there) Google Invisible Captcha v3 (NEW) Last but not least security through obscurity SEO & PUBLIC MANAGEMENT SEO Friendly urls (in htaccess level) Google Analytics and GTAG Code ready. Terms of use ready to go Refund policy ready to go Contact All the TERMS text are showing config dynamic item images/text with server's name and more OPTIMIZATION AND SPEED Zip Content (faster load) Memory save (unloading global vars) Using CDN’s for bootstrap Scripts are loaded in footer Images are soft to max 10kb Small and smart organized code style FUNCTIONALITIES Multilanguage (4 languages so far) EN ES NL EL (Easy to add more) Payment methods Paypal, Stripe, Payeer and MercadoPago After payment or cancel the user is redirected back to “Thank you” page. TECHNOLOGIES Bootstrap 5x CSS PHP 5.6+ (for l2off) and PHP 7.4+ (for java) Extensions for php: MySQL (L2Java), pdo_dblib(L2OFF), pdo_sqlsrv(L2OFF), mssql_connect (L2OFF) and PDO Drivers that support MariaDB, MySQL, MsSQL. SYSTEMS Stripe and MercadoPago supports sandbox and live. Detailed and seperated Logs (ERROR, DEVELOPER, INFO, WARNING, PAYMENT) for website and Rest APIs. Detailed Log in database for Payments and services used. Google Analytics (You know when players are in the panel and if they pay) Google Captcha V3 Dynamic Icons to show according your Donate Item ID Multiple servers L2OFF or L2JAVA servers can be added together as server network     BE AWARE: Leaked versions of old v2 panels (year 2018 with bugs) are still out sold by scammers without support or knowledge of the files.
    • I work with Kenrix and he is a  next level coder. Hugely Recommended.
    • Follow our Telegram channel, because exciting events are coming very soon! Halloween, 11.11, and also a giveaway related to 3000 subscribers in our Telegram channel are ahead! What do you think we have prepared? Subscribe to our Telegram channel and stay updated on all the news: https://t.me/accsforyou_shop Active links to SOCNET stores: Digital goods store (Website): Go Telegram store bot: Go – convenient access to the store via Telegram messenger. Telegram Stars purchasing bot: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to introduce you to the current list of promotions and special offers for purchasing products and services of our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) in October! You can also use a promo code for the first purchase: SOCNET (15% discount) 2. Get $1 to your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write it in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel — just open a ticket with the topic “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts & Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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