August 7, 20178 yr 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.
August 7, 20178 yr 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, 20178 yr by Apaec
August 8, 20178 yr Author 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!
Create an account or sign in to comment