[Fix] No more cm.dispose();

Ooo, shiny!
Decennium
Joined
Feb 23, 2008
Messages
507
Reaction score
361
I coded this a few months ago and I decided to release a fix to completely obliterate cm.dispose() problems.

Put this in NPCTalkHandler under "int oid = slea.readInt();"

PHP:
        if(NPCScriptManager.getInstance().getCM(c) != null){
        dispose(c);
        }
Here's the dispose method:
PHP:
    public void dispose(MapleClient c){
        c.announce(MaplePacketCreator.enableActions());
        NPCScriptManager.getInstance().getCM(c).dispose();
    }
If you decide to migrate this release anywhere else, please provide credits. If you don't, then you're a poopoo head.







 
If it's the second option then I'll love you


---------- Post added at 02:51 AM ---------- Previous post was at 02:49 AM ----------

Sorry on double post but before I had something similar to this and it caused some errors on npcs
 
I believed I was the first to release something similar to this on my old account( shall not mention who) :D
 
Last edited:
The way you put the title -> No more cm.dispose() make makes everyone think that you do not need the cm.dispose() for the NPC. This is just a temporary fix, but you still need the cm.dispose() for your NPC. If you didn't do so, your NPC will keep on talking till the last time of the code. Means you won't be able to have different status.
 
I've seriously never had this npc dispose problem, unless it was like a super crappy script. But nice job anyways :P
 
I'm pretty sure that even with this fix you can't go around removing all the cm.dispose()'s from your NPC scripts.

The REAL fix is to just learn to code proper NPC scripts.

You actually can remove all the cm.dispose()'s from your scripts.

The REAL fix will never happen. People will always make the same mistakes.
 
Okay so I feel no one of you we're getting what it does.
It will first dispose any NPC chats you had, then open
a new one, what fixing the problem when you clicked an npc
2 times and got a d/c (cant' handle 2 windows).
 
@Aurox and Sparky: No, this does remove any need for cm.dispose. Yes, you can add a return to the mode definitions, but otherwise it removes the cm.dispose dependency. When you first talk to an NPC, it checks if your "stuck" and disposes you, then it launches the NPC, exactly as he stated.

@Everyone else (you know who you are): Keep the mindless chit-chat out of here please.
 
@Aurox and Sparky: No, this does remove any need for cm.dispose. Yes, you can add a return to the mode definitions, but otherwise it removes the cm.dispose dependency. When you first talk to an NPC, it checks if your "stuck" and disposes you, then it launches the NPC, exactly as he stated.

@Everyone else (you know who you are): Keep the mindless chit-chat out of here please.

No it doesn't.
It will only work if the player clicked the NPC, but if you're using a command to open the npc it won't work.
to really fix it you have to go to NPCConversationManager, find the start method, and put this:
PHP:
  if (cms.containsKey(c)) {
            dispose(c);
        }
in the beggining of the method.
 
Back