Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • NPE


    Stormscythe

    Recommended Posts

    Posted

    Hello

     

    I get this NPE occassionally with my Monk Killer. In the client, there is no info about the NPE (apart from saying there is a NPE, no details about it though) but the console logs the following. What could be the cause of this?

     

     

     

    java.lang.NullPointerException
    
    at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
    
    at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source)
    
    at java.lang.reflect.Field.get(Unknown Source)
    
    at org.dreambot.core.b.a.b.a(b.java:47)
    
    at org.dreambot.core.b.a.b.a(b.java:40)
    
    at org.dreambot.api.wrappers.interactive.NPC.getReflectComposite(NPC.jav
    
    a:42)
    
    at org.dreambot.api.wrappers.interactive.NPC.getID(NPC.java:53)
    
    at org.dreambot.api.wrappers.interactive.NPC.getRealID(NPC.java:83)
    
    at org.dreambot.api.wrappers.interactive.NPC.getComposite(NPC.java:35)
    
    at org.dreambot.api.wrappers.interactive.NPC.getActions(NPC.java:48)
    
    at org.dreambot.api.wrappers.interactive.Character.isInCombat(Character.
    
    java:423)
    
    at dreamBotMonkKiller.getState(dreamBotMonkKiller.java:49)
    
    at dreamBotMonkKiller.onLoop(dreamBotMonkKiller.java:57)
    
    at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:167)
    
    at java.lang.Thread.run(Unknown Source)
    
    java.lang.NullPointerException
    
    at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
    
    at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source)
    
    at java.lang.reflect.Field.get(Unknown Source)
    
    at org.dreambot.core.b.a.b.a(b.java:47)
    
    at org.dreambot.core.b.a.b.a(b.java:40)
    
    at org.dreambot.api.wrappers.interactive.NPC.getReflectComposite(NPC.jav
    
    a:42)
    
    at org.dreambot.api.wrappers.interactive.NPC.getID(NPC.java:53)
    
    at org.dreambot.api.wrappers.interactive.NPC.getRealID(NPC.java:83)
    
    at org.dreambot.api.wrappers.interactive.NPC.getComposite(NPC.java:35)
    
    at org.dreambot.api.wrappers.interactive.NPC.getActions(NPC.java:48)
    
    at org.dreambot.api.wrappers.interactive.Character.isInCombat(Character.
    
    java:423)
    
    at dreamBotMonkKiller.getState(dreamBotMonkKiller.java:49)
    
    at dreamBotMonkKiller.onLoop(dreamBotMonkKiller.java:57)
    
    at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:167)
    
    at java.lang.Thread.run(Unknown Source)
    
    java.lang.NullPointerException
    
    at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
    
    at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source)
    
    at java.lang.reflect.Field.get(Unknown Source)
    
    at org.dreambot.core.b.a.b.a(b.java:47)
    
    at org.dreambot.core.b.a.b.a(b.java:40)
    
    at org.dreambot.api.wrappers.interactive.NPC.getReflectComposite(NPC.jav
    
    a:42)
    
    at org.dreambot.api.wrappers.interactive.NPC.getID(NPC.java:53)
    
    at org.dreambot.api.wrappers.interactive.NPC.getRealID(NPC.java:83)
    
    at org.dreambot.api.wrappers.interactive.NPC.getComposite(NPC.java:35)
    
    at org.dreambot.api.wrappers.interactive.NPC.getActions(NPC.java:48)
    
    at org.dreambot.api.wrappers.interactive.Character.isInCombat(Character.
    
    java:423)
    
    at dreamBotMonkKiller.getState(dreamBotMonkKiller.java:49)
    
    at dreamBotMonkKiller.onLoop(dreamBotMonkKiller.java:57)
    
    at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:167)
    
    at java.lang.Thread.run(Unknown Source)

     

     

     

    The two lines of my script is:

     private State getState() {
                    if(getPlayers().myPlayer().getHealthPercent() <= 30)
    48:                     return State.HEALING;
    49:                if(!getLocalPlayer().isInCombat() && getPlayers().myPlayer().getHealthPercent() >= 30)
    50:                return State.ATTACK;
                    return State.FIGHTING;
            }

     

     

     

    55:     public int onLoop() {
    56:       
    57:        switch(getState()){
    58:        case HEALING:
    59:         status = "Healing!";

     

     

    Posted

    I experience this occasionally also. Does it happen at login? Could be because the player object isn't ready when you're trying to run it. When I get home today, I'll look into it, if it hasn't by then. Just got to work :P

    Posted

    I experience this occasionally also. Does it happen at login? Could be because the player object isn't ready when you're trying to run it. When I get home today, I'll look into it, if it hasn't by then. Just got to work :P

     

    No, this happens at random times while the script is running, and logs me out due to inactivity.

    Posted

    Try using getPlayers().myPlayer() instead of getLocalPlayer() for now. I believe that's an ongoing issue at the moment

    Posted

    Try using getPlayers().myPlayer() instead of getLocalPlayer() for now. I believe that's an ongoing issue at the moment

    They both throw the NPE. I originally used getPlayers().myPlayer() but I changed it to getLocalPlayer() to see if that fixed it. 

    Posted

    It's a cache issue. It's trying to find a composite in the cache, and is failing to find it.

    I may or may not know the issue already, but I'll take a look into it later (If Chris doesn't get a chance to)

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    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.