triblion 56 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
slasso 27 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
triblion 56 Author Posted October 5, 2016 Thanks I will try this when I get back, yeah I check for !=null
Diddy 265 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
triblion 56 Author 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
triblion 56 Author 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)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.