how would you go about making
1 platinum token give back 1000 coins
i've done it so 1000 coins gives 1 platinum token,
|
Very simple to do, kind of nice to have an additional currency that many stakers should be familiar with being introduced into the economy.
Modify to your needs.
Anyways. Add this into your Items.json file.
In your UseItemPacketListener class, itemOnObject methodCode:{ "id": 13204, "name": "Platinum Tokens", "examine": "Shiny currency, could be useful to some.", "value": 1000, "stackable": true, "noted": false, "noteId": -1, "tradeable": true, "sellable": false, "dropable": true },
Code:if (itemId == 995 && gameObject.getDefinition().getName().contains("Bank")) { final int size = player.getInventory().getAmount(995); player.getInventory().delete(new Item(995, size)); player.getInventory().add(new Item(13204, size / 2)); player.getPacketSender().sendMessage("You exchange " + Misc.format(size) + " Coins for " + Misc.format(player.getInventory().getAmount(13204)) + " Platinum tokens."); }
The way you're doing it, you just print out the number of platinum tokens in the inventory. If there is already more tokens in the inventory this won't work as intended.
You should, instead, make a separate variable for the tokens that tracks the amount of coins in your inventory and divides by two, as such:
Code:int tokens = size / 2;
simple but thanks anyway !!!
Code:} if (itemId == 13307 && gameObject.getDefinition().getName().contains("Bank")) { final int size = player.getInventory().getAmount(13307); player.getInventory().delete(new Item(13307, size)); player.getInventory().add(new Item(13204, size / 2)); player.getPacketSender().sendMessage("You exchange " + Misc.format(size) + " Blood money for " + Misc.format(player.getInventory().getAmount(13204)) + " Platinum tokens."); } if (itemId == 13204 && gameObject.getDefinition().getName().contains("Bank")) { final int size = player.getInventory().getAmount(13204); player.getInventory().delete(new Item(13204, size)); player.getInventory().add(new Item(13307, size * 2)); player.getPacketSender().sendMessage("You exchange " + Misc.format(size) + " Platinum tokens for " + Misc.format(player.getInventory().getAmount(13307)) + " Blood money."); } }
Okay i need help i tried to add it to the game but still give me error... Any of you can help me?
Token id=12852
Coin id=995
Token value=1,000,000
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |