H0rn Posted August 7, 2017 Share Posted August 7, 2017 Hey so I am new to scripting, have general knowledge in Java not too experienced. Was looking to check if some item exists on the floor and then telegrab it if it does, I just cant figure out how to use a spell on a ground item. Sorry for noob. Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 7, 2017 Share Posted August 7, 2017 (edited) Looking at the API, Since GroundItem implements Entity, you should be able to call Magic#castSpellOnEntity: GroundItem item = getGroundItems().closest("Egg"); MagicSpell spellToCast = NormalSpells.TELEGRAB; if (item != null && getMagic().canCast(spellToCast) if (getMagic().castSpellOnEntity(spellToCast, item)) log("Yay!"); Hopefully that works, wrote in reply box so i've not tested it... let me know if something isn't right! (: Apa Edited August 7, 2017 by Apaec 2 Quote Link to comment Share on other sites More sharing options...
dreameo Posted August 7, 2017 Share Posted August 7, 2017 getMagic().castSpellOnEntity(NormalSpells.TELEGRAB, item) Quote Link to comment Share on other sites More sharing options...
H0rn Posted August 8, 2017 Author Share Posted August 8, 2017 21 hours ago, Apaec said: Looking at the API, Since GroundItem implements Entity, you should be able to call Magic#castSpellOnEntity: GroundItem item = getGroundItems().closest("Egg"); MagicSpell spellToCast = NormalSpells.TELEGRAB; if (item != null && getMagic().canCast(spellToCast) if (getMagic().castSpellOnEntity(spellToCast, item)) log("Yay!"); Hopefully that works, wrote in reply box so i've not tested it... let me know if something isn't right! (: Apa Works a charm! thanks a lot! 1 Quote Link to comment Share on other sites More sharing options...