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
  • Can't find Zaff in GameObject list?


    crazykid080

    Recommended Posts

    I've been trying to grab a reference to Zaff in Varrock but for some reason it keeps returning null even when I'm in his shop. I've tried filtering by name and ID, but neither works, am I missing something? For reference this is my filter code 

    Entity zaff = GameObjects.closest(check -> check.getName().contains("Zaff"));

     

    Link to comment
    Share on other sites

    6 minutes ago, crazykid080 said:

    I've been trying to grab a reference to Zaff in Varrock but for some reason it keeps returning null even when I'm in his shop. I've tried filtering by name and ID, but neither works, am I missing something? For reference this is my filter code 

    
    Entity zaff = GameObjects.closest(check -> check.getName().contains("Zaff"));

     

    Also, why are you using GameObject? Zaff is an NPC/Shop, not an object.

    NPC Zaff = NPCs.closest("Zaff"));

    if(Zaff ! = null){

    interact();

    }

    This is pretty basic stuff, I'd recommend checking out some scripting tutorials :)

    Link to comment
    Share on other sites

    11 minutes ago, crazykid080 said:

    I'm not 100% sure what you mean by null checking the check, I assume it's not as simple as just adding check != null correct?

    Yes, he meant that.

    NPC zaff = NPCs.closest(check -> check != null && check.getName().contains("Zaff"));

    Then you can interact by doing:

    zaff.interact("Trade"); - if you wanted to trade him.

     

    Link to comment
    Share on other sites

    9 minutes ago, AsBakedAsCake said:

    Also, why are you using GameObject? Zaff is an NPC/Shop, not an object.

    I knew I was missing something! I've looked at some of the tutorials but I didn't see anything about NPCs, probably just missed it

    Link to comment
    Share on other sites

    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.