rokaHakor 171 Share Posted October 5, 2016 It should be if (Tree != null) { getInventory().get("Knife").useOn(Tree); } Link to comment Share on other sites More sharing options...
Hashtag 8694 Share Posted October 6, 2016 It should be if (Tree != null) { getInventory().get("Knife").useOn(Tree); } I believe it throws a null pointer exception if your inventory does not contain a knife. GameObject tree = getGameObjects().closest("Tree"); Item knife = getInventory().get("Knife"); if (tree != null && knife != null) knife.useOn(tree);//why would you use a knife on a tree? Link to comment Share on other sites More sharing options...
triblion 56 Author Share Posted October 6, 2016 I believe it throws a null pointer exception if your inventory does not contain a knife. GameObject tree = getGameObjects().closest("Tree"); Item knife = getInventory().get("Knife"); if (tree != null && knife != null) knife.useOn(tree);//why would you use a knife on a tree? Hm I will try this and see if it works, thanks. It's not a normal tree that will have the knife used on it. It worked, thanks Hashtag Link to comment Share on other sites More sharing options...
Cardozz 46 Share Posted October 8, 2016 "knife.useOn(tree);//why would you use a knife on a tree?" This lol. New woodcutting update Link to comment Share on other sites More sharing options...
triblion 56 Author Share Posted October 8, 2016 "knife.useOn(tree);//why would you use a knife on a tree?" This lol. New woodcutting update xD yeah, it was for sapping an evergreen, but the buckets of sap were overcharged on the GE their real value was 6gp each and a bucket is about 36 gp each Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.