Jump to content

Cast telegrab on an item?


H0rn

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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