Jump to content

Cast telegrab on an item?


Recommended Posts

Posted (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 by Apaec
  • Like 2
Posted
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!

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...