triblion 56 Share Posted October 4, 2016 I am trying to get my script to click an item in my inventory then use it on a game object, I have tried using interact in it's different forms but it will not click it Link to comment Share on other sites More sharing options...
Hashtag 8688 Share Posted October 4, 2016 getInventory().get("Food").useOn(entityNamedHashtag); Link to comment Share on other sites More sharing options...
Mad 86 Share Posted October 5, 2016 is that null safe is that null safe Link to comment Share on other sites More sharing options...
slasso 27 Share Posted October 5, 2016 is that null safe is that null safe Are you null safe? If food doesn't exist in the inventory then it will NPE Link to comment Share on other sites More sharing options...
Hashtag 8688 Share Posted October 5, 2016 I assume he does null checks Link to comment Share on other sites More sharing options...
triblion 56 Author Share Posted October 5, 2016 Thanks I will try this when I get back, yeah I check for !=null Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted October 5, 2016 Thanks I will try this when I get back, yeah I check for !=null you could check for getInventory().contains(food filter) though Link to comment Share on other sites More sharing options...
triblion 56 Author Share Posted October 5, 2016 you could check for getInventory().contains(food filter) though I used contains I just couldn't figure out how to get it to actually select the item, I will try what has been suggested when I get the chance Link to comment Share on other sites More sharing options...
slasso 27 Share Posted October 5, 2016 if(contains()) get() Link to comment Share on other sites More sharing options...
triblion 56 Author Share Posted October 5, 2016 getInventory().get("Food").useOn(entityNamedHashtag); GameObject Tree = getGameObjects().closest(GameObject -> GameObject != null && GameObject.getID() == 2092); if (Tree != null) { getInventory().get("Knife").useOn(2092); getInventory().get("Knife").useOn(2091); I tried this way I also tried getInvetory inside the () and I cannot get it to click on the knife and use it on anything (the thing is a GameObject in this case) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.