let it check for an item and delete that item
|
Hey everyone, I am working on a dungeon minigame (not dungeoneering ) that you have to kill npcs and when they drop a key, you use portal and it will take you to next room.
How can I make it so you need the key to use portal?
Thanks I will rep + whoever helps
Pretty Simple :/
Example:
if ((c.getItems().playerHasItem(KEYCODE, 1)) && (c.key == 0)) {
c.redkey = 1;
c.sendMessage("You insert the key and release a magical spirit from the chest.");
c.startAnimation(9099);
c.gfx100(293);
c.getItems().deleteItem(KEYCODE, 1);
} else if (c.key == 1) {
c.sendMessage("You've already released this spirit.");
} else
c.sendMessage("You need key to release this spirit.");
}
well i am new coder, could some explain more and also, spikeyyy i dont want it to delete key.
Put it in the ActionHandler.Java Witch will make the portal non useable if you dont have the key in your bag
Sec Making the code easier.
Case PORTALID:
if ((c.getItems().playerHasItem(KEYCODE, 1)) {
c.sendMessage("You Opened The Portal And Proceed To The Next Cave.");
c.getPA().spellTeleport(CoordX, CoordY, 0);
} else
c.sendMessage("You Need A Key To Go Trough This Portal.");
}
perfect! thank you imma add now
glad to help, Rep ?
i repped but it not showing up on ur rep
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |