#Custom World Border Increasing Idea

1 messages · Page 1 of 1 (latest)

rain ivy
#

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.

torpid meteorBOT
#
Someone will come and help soon!

💬 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

rancid coral
#

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)

rain ivy
#

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.

rancid coral
#

I have to finish something and then I can explain in more detail.

rain ivy
#

thanks!

rancid coral
#

Took a little longer than I thought

rancid coral
#

One thing I completely forgot, this method is only possible in version 1.20.2 and above

rain ivy
torpid meteorBOT
#
🗑️ Recycling Thread

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.

rain ivy
rancid coral
#

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.

rancid coral
#

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

rain ivy
#

oh i just read you said load function

#

sorry about that...

#

lol

rancid coral
#

Only adding the scoreboards and calling the function that does the rest

#

Everything further down is in its own function

rain ivy
#

got it

#

Can I ask what the namespace is?

rancid coral
#

it is the name of the folder that is inside the data folder.

rain ivy
#

alright

rancid coral
#

most of the time it's your packs name

#

But the same naming rules apply as in function names

rain ivy
#

is the function for the macro called set_border ?

rancid coral
#

Yes, in the example, I called it that.

rain ivy
rancid coral
#

Yes

rain ivy
#

What are the $ for?

rancid coral
#

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.

rain ivy
#

I see alr

#

pretty advanced for the knowledge I have rn on this

rancid coral
#

There are other ways but they would be much worse and outdated

rain ivy
#

but I appreciate the help you've made it really easy to understand

rancid coral
#

That's good to hear

rain ivy
#

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

rancid coral
#

what did you do? did you close without saving?

rain ivy
#

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

rancid coral
#

If you reopen vscode is it still there?

rain ivy
#

no

rancid coral
#

hmm

#

weird

rain ivy
#

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

rancid coral
#

normally the .vs folder doesn't replace files

#

I can only advice you to press ctrl+S very frequently

rain ivy
#

alr

rancid coral
#

also, what is that file path in the image?

#

where is your data folder?

rain ivy
#

it just went to like an encrypted file of like contents idek

#

its fine im just restarting

rain ivy
#

its all gone

rancid coral
#

oh, this high up in the hierarchy

rain ivy
#

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

rancid coral
#

You can change the border minimum diameter by changing the number in the first command here:#1200606077058818068 message

rain ivy
#

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

rancid coral
#

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)

dull summitBOT
#
**📖 Misode**

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

Link: https://misode.github.io/

rancid coral
#

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.

rain ivy
#

yea thats actually perfect I didn't think of that

rain ivy
#

Alright that works perfectly

#

the issue is the world border isn't there from the start

rancid coral
#

You can change that by setting the worldborder in the load function

rain ivy
#

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

rancid coral
#

Try adding a say command at the top, to see if it executed.

rain ivy
#

did i input this wrong in the load function

rancid coral
rain ivy
#

so that would be schedule function xpborder:border 1s

rancid coral
#

yes

rain ivy
#

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

rancid coral
#

If there is even one error in the function, parsing the file fails and it gets ignored completely.

rain ivy
#

oh wait i made a typo

#

give me a sec

#

alr finally it is working

rancid coral
#

🎉

rain ivy
#

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

rancid coral
#

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

rain ivy
#

Yea thats the issue, how could I run a command only once when the datapack is first loaded

rancid coral
#

you can set the center in the load function.

rain ivy
#

yea but that will set the center every time you load into the world though or does it not

rancid coral
#

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

rain ivy
#

alright

rancid coral
#

It's the same with scoreboards. You create them every time you reload the world but because they already exist, it does nothing.

rain ivy
#

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

rancid coral
#

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
rain ivy
#

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

rancid coral
#

It is doable

#

sfx are resource pack stuff though not datapack stuff

rain ivy
#

sfx as of using minecraft sound effects for it

rancid coral
#

unless you use already existing ones

rain ivy
#

yea

rancid coral
#

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.

torpid meteorBOT
# rain ivy yea
🎗️ Is your question resolved?

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

rain ivy
#

Yea thank you!

torpid meteorBOT
# torpid meteor
Question Closed

Your question, #1200606077058818068 (Custom World Border Increasing Idea), was resolved!

Original Message

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.

Duration open

5d22h15m

torpid meteorBOT
#
🗑️ Recycling Thread

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.

torpid meteorBOT
#
🗑️ Recycling Thread

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.

torpid meteorBOT
#
🗑️ Recycling Thread

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.