Clayplug Posted September 7, 2022 Share Posted September 7, 2022 Hello all! I'm writing a basic fishing script. When I set it up the first time it was working decently. Now I'm trying to map it over to a behavior tree (Task based script). I have this issue where in a Task that checks if the player is at a spot, the myPosition() method keeps giving me a NullPointerException. It says the issue is at org.osbot.rs07.script.MethodProvider.myPlayer(xe:677) and (xe:679). I've narrowed it down here. The MethodProvider is not null, the getInventory is not null, which means that other methods on the MethodProvider work. The only thing that's returning as null is the myPosition method. Does anyone have any advice? Quote Link to comment Share on other sites More sharing options...
ExtraBotz Posted September 7, 2022 Share Posted September 7, 2022 How do you know that the MethodProvider is not null? log(myPosition()); I'd recommend trying the code above in your onStart method. If this works, your method provider may not be instantiated correctly. You need to use the main class as the method provider. Quote Link to comment Share on other sites More sharing options...
Clayplug Posted September 8, 2022 Author Share Posted September 8, 2022 2 hours ago, ExtraBotz said: How do you know that the MethodProvider is not null? log(myPosition()); I'd recommend trying the code above in your onStart method. If this works, your method provider may not be instantiated correctly. You need to use the main class as the method provider. Hey thanks a lot for the suggestion. I determined the MethodProvider wasn't null by having it log something if it != null. The mistake I made was not using the main class as the provider and instead instantiating a new MethodProvider entirely. Your suggestion helped me debug the issue, and now I have my first properly implemented behavior tree! Thanks 1 Quote Link to comment Share on other sites More sharing options...