WASD Rupees


For Minecraft Version 1.14.4 to 1.15.2
WASD Rupees V1.0


WASD Rupees V1.0
For Minecraft 1.14.4 to 1.15.2!

The WASD Rupees Datapack is a mapmaker tool for people looking to make Zelda inspired content! The pack adds a configurable rupee system to obtain, display, and spend rupees in-game. Read the instructions below for how to implement different features of the pack into your world.

So, what features does this pack contain?

  • Rupees: Custom textures items that play a sound and increase the wallet count when picked up.
  • Wallet: The Wallet displays the number of rupees that either the player or group has, depending on the settings. This can be used by shops.
  • Enjoy: We hope you enjoy this little pack and that it is helpful in your mapmaking endeavors.

To install, follow the instructions contained in the “instructions.txt” file included in the download. If you are still having issues installing or want help knowing how to do something with the pack, ask for help on our discord.

Fully Multiplayer compatible!



How to use this pack:

Obtaining Rupees:

Rupees can be obtained by various means. If you click the [settings] button after running /reload, you can bring up the settings. This can also be done by running the following command:

/function wasd.rupee:settings

Once you have the settings open, you can determine what can drop rupees. The current options include allowing grass, such as tall_grass and ferns, flowers, such as poppies or rose_bushes or pots, which are pots.

If you want to give yourself rupees for some reason, such as placing the specific rupee in a chest or item frame, you can run this function:

/function wasd.rupee:give_items

Please note that the rupees will be added to your Wallet unless pause the rupee system in the settings.

Mobs can also be configured to drop rupees which is detailed under “Mob Loot Tables”.


Rupee Value:

Rupees have values based off of their worth in the Zelda games. They are as follows:

Green1
Blue5
Yellow10
Red20
Purple50
Gold100

Shops:

Creating shops is a bit complicated, however, the following should help make it much less difficult. Shops will need to be different depending on the settings you have. If rupees are set to shared or not shared changes what the code should look like. Make sure to use the correct code, otherwise, it will not work.

Basics:

Creating a rupee shop system with this datapack is quite simple. To get started, I would suggest that you create a separate function for each item you plan on selling. Your shop then needs to execute the function as the player that is purchasing the item. You can do this however you like, but we would suggest using a sign, as it removes the possibility of the wrong player executing the command. Here is an example of a sign with a click-event. It runs the command, which is the function. You will need to change this function to be the function inside your datapack.

/setblock ~ ~ ~ minecraft:acacia_sign{Text1:'{"text":"Shop!","clickEvent":{"action":"run_command","value":"/function datapack:shop/item"}}'} replace

A general principle behind the rupee shop system is that we never remove rupees from the player. Instead, you add rupees that they have spent, and then the datapack drains the amount from their balance. Because of this, we also never check the player’s rupee amount, as this could be inaccurate. Instead, there is a calculated scoreboard called true_rupee which is your total rupees minus any spent rupees. By using this value to determine if the player has enough money, we can ensure that they aren’t able to get below zero.

Shared:

To get started with the shared shop system, you need to detect if the players have enough money to make a purchase. To do this, we need to check if the fake_player has enough to make the purchase. The following code should all be placed into a single function that will be run executed as the player making the purchase. To do this, you will want to run the following command.

/execute as @p run function my_datapack:folder/function_name

This will run the function contained within the datapack called my_datapack inside the folder named folder with the function known as function_name. This should, of course, be changed to whatever your datapack name is, and you can come up with your own folder structure.

Inside the datapack, the first thing to do is ensure the fake_player has the money, so this command will do that. Make sure you place the commands listed in this article in the same order I list them, as that is very important.

/execute if score shop_total wasd.true_rupee matches 100.. run tag @s add has_rupees

The 100.. in the command is the cost of the item, so configure this to be what you want.

Next, we need to give the player whatever they are buying. To do this, simply execute as them to check if they have the has_rupees tag that we gave them. You can also execute as the player if they don’t have the has_rupees tag to tell them they don’t have enough money.

/execute as @s[tag=has_rupees] run give @s diamond

/execute as @s[tag=!has_rupees] run say Not Enough Money!

Now, we need to remove the money that they spent. To do this, we add the amount of money that they spent to a fake_player named Spent. Make sure to add the score instead of set the score, as by adding it you allow them to make multiple purchases at once, but with setting it you could break things badly.

/execute as @s[tag=has_rupees] run scoreboard players add Spent wasd.total_rupee 1

This will drain the money out of the wallet with a nice animation and sounds.

Finally, we need to reset the tag we gave the player so that when they go to buy another item, it won’t give it to them for free. To do this, simply run:

/tag @s[tag=has_rupees] remove has_rupees

That should be all there is to it. You can, of course, complicate it yourself by adding extra functionality.

Not Shared:

The get started, you need to detect if the buyer has enough rupees to make the purchase. You will want to run a function as the player so that all commands can be executed as them, which will make it run bug-free.

/execute as @p run function my_datapack:folder/function_name

This will run the function contained within the datapack called my_datapack inside the folder named folder with the function known as function_name. This should, of course, be changed to whatever your datapack name is, and you can come up with your own folder structure.

Next, we detect if the player actually has the money for the purchase. This command checks if they have 100 or more rupees, which is determined by the 100.. segment of code.

/execute if score @s wasd.true_rupee matches 100.. run tag @s add has_rupees

Next, we can determine what should happen if the player has enough money or not. We detect the player has the tag of has_rupees which we gave them if they have enough money. If this is true, give them what they bought and run any other commands that should occur.

/execute as @s[tag=has_rupees] run give @s diamond

We can also detect them not having enough money by checking if they don’t have the tag by placing an exclamation mark “!” in front of the tag.

/execute as @s[tag=!has_rupees] run say Not Enough Money!

Now, we need to remove the money that they spent. To do this, just set the number at the end to be whatever cost you set for the purchase above. However, instead of removing money directly from the player, we add the amount of money they “spent”, which will drain out of their account with a bit of animation.

/execute as @s[tag=has_rupees] run scoreboard players add @s wasd.spent_rupee 1

Finally, we just need to clean up the tag we gave them at the start, so just run this command.

/tag @s[tag=has_rupees] remove has_rupees


Mob Loot Tables:

Currently, no specific settings exist to dictate mob loot tables. However, you can easily set this up yourself with very little hassle.

To do this, we can set the DeathLootTable of mobs already spawned in the world to be a loot table that will drop rupees. Here is an example of the commands which will do the trick. The Tag is used to massively increase the performance, which is very important if done on a large scale. Run the commands in this order:

/execute as @e[type=<mob to get loot table>,tag=!has_table] run data merge entity @s {DeathLootTable:"wasd.rupee:basic"}

/tag @e[type= <mob to get loot table>,tag=!has_table] add has_table

Replace the <mob to get loot table> portion with the name of the mob you want to give the ability to drop rupees.

Depending on the difficulty of the mob, you might want it to drop a better rupees to reward the players better. This pack currently contains three rarities of loot tables to help you out there.

“wasd.rupee:basic” –can drop green, blue, and yellow rupees, weighted toward green.
“wasd.rupee:rare” —can drop blue, yellow, and red rupees, weighted toward blue.
“wasd.rupee:epic” —can drop red, purple, and gold rupees, slightly weighted toward red.



Chest Loot Tables:

Chest loot tables are quite simple. You likely won’t use this for mapmaking, however, as it very likely makes more sense to just put the specific reward rupee into the chest yourself. However, if you are planning on having a chest with a random reward, you can do so with the following command(s).

You can run a /setblock command to place a chest at a location:

/setblock <Location> minecraft:chest{LootTable:"wasd.rupee:basic"}

Or, you can use a /data modify command to set an existing chest’s loot table.

/data merge block 11 4 2 {LootTable:"wasd.rupee:basic"}

“wasd.rupee:basic” –can drop green, blue, and yellow rupees, weighted toward green.
“wasd.rupee:rare” —can drop blue, yellow, and red rupees, weighted toward blue.
“wasd.rupee:epic” —can drop red, purple, and gold rupees, slightly weighted toward red.


If you have any questions or about this, please ask in the held-desk channel of the discord. I will do my best to answer the question. Please note that this help is limited, however, and I will not provide direct command help, as that is reserved for Patrons. You can always donate via PayPal or Patreon if you do require more extensive help. Just make sure to include a note in a PayPal donation of your Discord ID.