Jump to content

Question

Posted (edited)

Hello recently i played star wars old republic and i got inspired an idea of the pet / summon

that it auto-attack the target that you attack.

 

Tried to do a code in L2Character (btw use F & High5)

like

final L2Summon pet = this.getPet();

 

doAttack(L2Character target)

{

 

if (!(pet == null))

{

  pet.getAi().getIntention(CTRL.INTENTION.DOAttack. target)

}

 

 

something like this but it give error 

any way on how to control attack of our summon / pet to attack the enemy even if is L2MonsterInstance or L2PcInstance object?

Thanks a lot

 

 

Ps. i'm not starter in java so speak freely, any answer i would appreciate it i just stuck.

 

2h8dedl.png

Edited by AccessDenied

Recommended Posts

  • 0
Posted

 

I'm taking your sister, period.

    @Override
    public void doAttack(L2Character target)
    {
        final L2Summon pet = getPet();
        
        if (pet != null)
            pet.getAI().setIntention(CtrlIntention.ATTACK, target);
        
        super.doAttack(target);
        clearRecentFakeDeath();
    }

Yeap this is what i wrote in the first place and it give error 

 

java.lang.NullPointerException
        at com.l2jserver.gameserver.model.actor.L2Character.doAttack(L2Character
.java:738)
        at com.l2jserver.gameserver.model.actor.L2Character$AIAccessor.doAttack(
L2Character.java:3747)
        at com.l2jserver.gameserver.ai.L2SummonAI.thinkAttack(L2SummonAI.java:93
)
        at com.l2jserver.gameserver.ai.L2SummonAI.onEvtThink(L2SummonAI.java:144
)
        at com.l2jserver.gameserver.ai.L2CharacterAI.onEvtArrived(L2CharacterAI.
java:706)
        at com.l2jserver.gameserver.ai.AbstractAI.notifyEvent(AbstractAI.java:45
9)
        at com.l2jserver.gameserver.ai.AbstractAI.notifyEvent(AbstractAI.java:34
6)
        at com.l2jserver.gameserver.GameTimeController$MovingObjectArrived.run(G
ameTimeController.java:209)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
  • 0
Posted

hasAi() check too, even if there is no reason you don't have AI anymore. And as I said, you miss all checks so don't expect it works fine for particular cases.

I know i miss many checks but i just want to test first.. i really dont get why this error 

 

java.lang.NullPointerException
        at com.l2jserver.gameserver.model.actor.L2Character.doAttack(L2Character
.java:738)
        at com.l2jserver.gameserver.model.actor.L2Character$AIAccessor.doAttack(
L2Character.java:3747)
        at com.l2jserver.gameserver.ai.L2SummonAI.thinkAttack(L2SummonAI.java:93
)
        at com.l2jserver.gameserver.ai.L2SummonAI.onEvtThink(L2SummonAI.java:144
)
        at com.l2jserver.gameserver.ai.L2CharacterAI.onEvtArrived(L2CharacterAI.
java:706)
        at com.l2jserver.gameserver.ai.AbstractAI.notifyEvent(AbstractAI.java:45
9)
        at com.l2jserver.gameserver.ai.AbstractAI.notifyEvent(AbstractAI.java:34
6)
        at com.l2jserver.gameserver.GameTimeController$MovingObjectArrived.run(G
ameTimeController.java:209)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
  • 0
Posted (edited)

What pet are you testing? With strider its working fine. Also, which is your 738 line?

Edited by SweeTs
  • 0
Posted

What pet are you testing? With strider its working fine. Also, which is your 738 line?

Im testing with wolf (the little one)

Wolf collar 

also my 738 line in L2Character is

if (EventEngine.areTogether(getObjectId(), getTarget().getObjectId()))
sendPacket(ActionFailed.STATIC_PACKET);
 
which is a check for an event engine but i dont get why since event engine is off or they dont participate..
  • 0
Posted (edited)

This line creates the NPE, so it's not from this pet addon :D Also, for me, on aCis Int, it's working fine, with any pet.

Edited by SweeTs
  • 0
Posted

This line creates the NPE, so it's not from this pet addon :D Also, for me, on aCis Int, it's working fine, with any pet.

Ok ill make it comment and try now sec

  • 0
Posted

:OOOOOO it worked <3 SweetS you earned my sister... 

i love youuuuu <3 

idk why it created problem :/ this boolean check also if the engine is running .. but since it works thanks

Also thanks to Tryskel.

Guest
This topic is now closed to further replies.


  • Posts

    • CLEAR BRIEF – ZERO SURPRISES The client requested an Illinois Driver License with custom data. Task – scannable front/back and photos suitable for upload. He provided data and portrait. Timeline agreed – 30+ minutes. Then everything followed engineering logic: – built the document for the specific state – checked structure and fields – prepared both sides – provided additional dark-background photos upon request No changing requirements. No “let’s redo it differently”. When the brief is clear – the case is controllable. When the process is disciplined – the result is predictable. Want the same smooth process without chaos and endless revisions? Message us – we’ll structure the task before it even starts. › TG: https://t.me/mustang_service ( https:// t.me/ mustang_service ) › Channel: https://t.me/+JPpJCETg-xM1NjNl ( https:// t.me/ +JPpJCETg-xM1NjNl ) #MustangService #verification #documents #case #antifraud #rendering
    • i know some things from java and eclipse about coding but for sure i take one programmer to make the hard work. thank you very much for your replying 🙂
    • Forum Post:   🛡️ L2Genesis Closed Beta — Test With Us, Launch With Exclusive Rewards Join the community: https://discord.gg/mcuHsQzNCm Website: https://l2genesis.com/ Join Beta: https://cbt.l2genesis.com/     Hey everyone, We're L2Genesis — an Interlude Classic server being built with one core belief: every player matters. Not just the top clans, not just the donators — everyone. We've spent months developing, refining, and listening to community feedback. Now we're opening up our Closed Beta and we need your help to make sure this server launches rock-solid. Registration is open for one week only — after that, the doors close. Every tester who puts in the work walks into launch day with exclusive rewards that won't be available again.     Why Genesis? We're not rushing to open doors and hope for the best. We're building a community-first server where player feedback directly shapes the final product. No pay-to-win, no shortcuts — just a clean Interlude experience with thoughtful quality-of-life improvements. If you've been burned by servers that promise the world and deliver a cash shop, this one's for you. What you can expect to see on our server: - x4 rate - Player buff trade shop - Crystallization shop - Arena mode for FUN PvP     Closed Beta Rewards Rewards are tied to real participation — no freebies for just showing up. 🥉 Tier 1 The test server runs at x100 rates with a gear shop, so you won't be grinding for days just to start testing. Requirements: Register, level to S-grade, complete 3rd profession, and join one of the organized beta clans.   Launch Rewards: - Exclusive "Genesis Start" Discord rank - Beta Box — unique hat (won't be available after launch) + big-head potions, fireworks & more   Optional: Participate in the Bug Hunt for additional rewards (details below). You will have one week from CBT server launch to complete Tier 1 🥇 Tier 2 Requirements: Complete Tier 1 + participate in at least 3 events like Clan Wars, Siege and others, they will be stated during CBT in Discord. Launch Rewards: - Everything from Tier 1 - 1 Month of VIP status — quality-of-life perks handed to you for free on day one     🐛 Bug Hunt — Bonus Rewards Throughout the beta we're running a Bug Hunt — find and report bugs to earn 1 Genesis Coin (donation currency) for every confirmed bug. We'll share full details and focus areas once you're in.     Get Involved This is your chance to shape a server before it launches, not complain about it after. The testers who show up now are the ones who'll feel the difference on day one — and they'll have the exclusive rewards to prove it. Sign Up for beta test and drop in to Discord, and let's build something worth logging into. Even if you're not ready to test but you're a veteran L2 player — join the community anyway. Your experience and perspective are worth a lot to us. See you in Aden.  
    • l2jlucera the source code is not public and is not for sale. If you're going to use L2jMobius or L2jAcis, you need to know how to program or have a basic understanding, and you can ask for help from a bot, which usually won't be 100% helpful. Or you can pay a programmer to do the work for you.  
    • You need for sure some knowledge to make a good start and dont get scammed.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..