So I thought of an idea of people's xp levels based on what they are it will set the border size. Now I know this has already been done before with just increasing xp levels increases the border, but instead this would be just set and stone whatever xp level you have is the border size like 5 levels would be 5 blocks. The difference here is also based on how many people you play with their xp adds on to the border also if someone had 5 xp levels and you also had 5 xp levels it would make the border 10 blocks big. Now if someone dies and loses their xp levels it would decrease the border back to whatever the new total is for xp levels. This could make some interesting gameplay and I am just curious on what commands and ways I could try implementing this into a datapack as im not very experienced in it.
#Custom World Border Increasing Idea
1 messages · Page 1 of 1 (latest)
💬 While you wait, take this time to provide more context and details.
🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Implementing this is not that hard.
Step 1: Store the lvl nbt as a score for every player
Step 2: Add the scores of all players together in a not player-bound score
Step 3: Store the sum score in a data storage
Step 4: Execute a function with the level sum data storage as parameter (the function executes the border command)
I appreciate the steps for how to do it. But as a beginner this isn't super helpful as i'm gonna need more details than this for command wise.
I have to finish something and then I can explain in more detail.
thanks!
Took a little longer than I thought
Do you already have an empty pack?
One thing I completely forgot, this method is only possible in version 1.20.2 and above
Yup
This thread has been inactive for some time, so I'm going to archive it.
If you're still using the thread, just send a message and it'll pop back on the thread list.
Are you available to help?
Sorry, completely forgot about this
As I said in the list, first you need to store everyone's level as a score.
You can do this by adding a scoreboard objective that tracks the level automatically.
You do this with this command in your load function: scoreboard objectives add <objective name> level
Next, we need a scoreboard where we add all the score values together. For that, you add another scoreboard in your load function but this time not of the type level but of the type dummy. Dummy scoreboards aren't connected to any statistics or player stats, like the other objective types. They are for custom use cases.
To add the values together, we make a new function. This function gets called after creating the scoreboards in the load function. You can call it whatever you like but only non-capital letters, numbers, and underscores are allowed.
Let's assume you called the level objective level and the dummy objective diameter.
We first set the diameter score for the fake player $border (fake players are names for scores that don't belong to an actual player) to 0, then we add the level score of every player to $borders's diameter score, then we store the value in a data storage to be usable by the macro, after that we call the function macro that executes the border command. At the end of the function, we schedule this function to run again in 1 second.
scoreboard players set $border diameter 0
scoreboard players operation $border diameter += @a level
execute store result storage <namespace>:border diameter float 1 run scoreboard players get $border diameter
function <namespace>:set_border with storage <namespace>:border
schedule function <this function> 1s
The macro function looks like this:
$worldborder set $(diameter) 1
This is how you do it @rain ivy
Would I start these commands in the load.mcfunction im assuming
oh i just read you said load function
sorry about that...
lol
Only adding the scoreboards and calling the function that does the rest
Everything further down is in its own function
it is the name of the folder that is inside the data folder.
alright
most of the time it's your packs name
But the same naming rules apply as in function names
is the function for the macro called set_border ?
Yes, in the example, I called it that.
okay so I'd just make another function with this
Yes
What are the $ for?
The $ at the start tells Minecraft that this command is a macro command. The $ before () tells the command that the name inside () is the name of the nbt tag it should use.
There are other ways but they would be much worse and outdated
but I appreciate the help you've made it really easy to understand
That's good to hear
dude i tried to move my datapack into a world to test and visual studio like deleted everything somehow
now its like a .vs folder in the datapack with nothing else
im trying to undo but it doesn't seem recoverable
what did you do? did you close without saving?
well I closed but i assumed it saved automatically and would lemme know if it didnt save so it should've saved
I may just have to redo all of it
If you reopen vscode is it still there?
no
what I did is i moved the datapack into a world
opened the datapack that was moved into the world in vscode
and then that happened
and all the files got like replaced
normally the .vs folder doesn't replace files
I can only advice you to press ctrl+S very frequently
alr
it just went to like an encrypted file of like contents idek
its fine im just restarting
oh, this high up in the hierarchy
okay im finally done rewriting!
okay so my idea is I should probably start off the datapack by giving players a default level count when they join for the first time
so then the border size isnt like 0
imo a good default level count would be like 5
so how could I add 5 levels only once for someone who joins
maybe something like add 5 levels to everyone who doesn't have like a tag and then once the 5 levels command gets executed it tags the person with like a joined tag
so it doesn't execute the command on them again
You can change the border minimum diameter by changing the number in the first command here:#1200606077058818068 message
yea ik i just figured it would make more sense for the border to actually be the level count at the start
and plus if you had more people then the border size would be bigger
You can add a tick advancement. Advancements only trigger once and then have to be manually reactivated. The tick trigger also immediately activates (if no other conditions are specified), this makes it the perfect thing for stuff like that.
Just like you have a folder called functions in your namespace for functions, for advancements you need a folder called advancements.
In there make a new file and end it with .json not .mcfunction.
To make advancements I suggest using a generator website. (nobody writes json files by hand)
Awesome website with generators for almost everything. Also contains a technical changelog for new versions, guides on how to use some features, a performance report inspector and more!
Full list of generators: Loot Tables, Predicates, Item Modifiers, Advancements, Recipes, Text Components, Damage Types, Chat Types, Trim Materials, Trim Patterns, pack.mcmetas, Dimensions, Dimension Types, Biomes, Configured Carvers, Configured Features, Placed Features, Density Functions, Noise, Noise Settings, Structures, Structure Sets, Processor Lists, Template Pools, World Presets, Flat World Presets, World Settings, Block Tags, Entity Type Tags, Fluid Tags, Game Event Tags, Item Tags, Biome Tags, Structure Tags, Blockstates, Models, Fonts, Atlases
This is how it should look like (everything in <> is just a placeholder)
Advancements can have multiple things as a reward, in this case we let it call a function as the reward.
You have to make a new function that sets the level of the player to the desired amount.
xp set @s 5 levels
Because advancements are player specific, we don't have to manually target the player, as the advancement does that for us.
That's it. It might sound like much but it's actually pretty simple.
yea thats actually perfect I didn't think of that
You can change that by setting the worldborder in the load function
also the load function doesn't call the border function with all this in it
im assuming I need to do that
so once it calls the function then it should just set the border based on the xp of the player
Sadly that does not seem to do anything
Try adding a say command at the top, to see if it executed.
Yea for some reason it didnt seem to execute
did i input this wrong in the load function
I think I see why. There is no namespace in this function call
so that would be schedule function xpborder:border 1s
yes
shouldnt of it still executed the say command i put at the top of the function tho
or does it just not execute if its incorrect
If there is even one error in the function, parsing the file fails and it gets ignored completely.
Alright even with those changes done it still seems to not do anything
oh wait i made a typo
give me a sec
alr finally it is working
🎉
First issue im encountering though is that you don't always spawn at 0,0 which is the default center for the world border so it killed me and then i lost my xp because I didn't originally spawn at 0,0
Should I try centering the world border from the world spawn
just add worldborder center ~ ~ to the load function. Commands that aren't executed at any entity positions are executed at world spawn, so this command sets the center to the worldspawn.
Keep in mind though that the players can spread some distance away from the worldspawn
Yea thats the issue, how could I run a command only once when the datapack is first loaded
you can set the center in the load function.
yea but that will set the center every time you load into the world though or does it not
yes but the worldspawn doesn't change and it also costs near 0 extra performance to do that.
it is also only once if you load the world
alright
It's the same with scoreboards. You create them every time you reload the world but because they already exist, it does nothing.
Okay
So one other issue I occured seems to be when you die. It doesn't register your xp level has changed until you collect xp
To solve this issue, we again need a new scoreboard. This time of the type deathCount.
In the tick function, check if a player's death count is 1 or more and if that's true, call a score reset function.
execute as @a[scores={death=1..}] run function <namespace>:reset_scores
The reset function is very simple.
scoreboard players reset @s death
scoreboard players reset @s level
perfect
thank you so much
Okay so the main datapack has its functionality as a challenge now
Now i'm probably gonna start adding some features to just overall make it a more fun datapack
Like sound effects for the border increasing or decreasing and maybe death sound effects
but that should also probably be customizable within a menu that pops up everytime you join the game
I don't know how difficult that is to do but I know it would be possible
sfx as of using minecraft sound effects for it
unless you use already existing ones
yea
Is this problem solved then?
if yes, please resolve the question with /resolve or the button at the top of the post's chat history.
If you have a different question, please make a new post dedicated to that question.
If your question is resolved, that's great to hear! Make sure to run /resolve or click the Resolve Question button. Otherwise, feel free to continue asking for help! :D
Yea thank you!
Your question, #1200606077058818068 (Custom World Border Increasing Idea), was resolved!
So I thought of an idea of people's xp levels based on what they are it will set the border size. Now I know this has already been done before with just increasing xp levels increases the border, but instead this would be just set and stone whatever xp level you have is the border size like 5 levels would be 5 blocks. The difference here is also based on how many people you play with their xp adds on to the border also if someone had 5 xp levels and you also had 5 xp levels it would make the border 10 blocks big. Now if someone dies and loses their xp levels it would decrease the border back to whatever the new total is for xp levels. This could make some interesting gameplay and I am just curious on what commands and ways I could try implementing this into a datapack as im not very experienced in it.
5d22h15m
This thread has been inactive for some time, so I'm going to archive it.
If you're still using the thread, just send a message and it'll pop back on the thread list.
This thread has been inactive for some time, so I'm going to archive it.
If you're still using the thread, just send a message and it'll pop back on the thread list.
This thread has been inactive for some time, so I'm going to archive it.
If you're still using the thread, just send a message and it'll pop back on the thread list.