when a player gets a skill i can run commands and when i do that im trying to add them to a scoreboard so i can keep track of what order they were bought in so that when the player dies they lose the most recent skill. having trouble figuring out how to properly set this up though. i dont really have anything concrete other than a scoreboard with 2 fake players. one is to keep track of the total, and the other is the first skill im trying to get this working with so that i have an idea of how its supposed to be set up for the rest of the skills. this is all in functions so no need to know anything about the mod im using (its origins and pufferfish skill in case youre wondering) so this is all do able in vanilla with commands and could be used for other things that arent this.
#trying to make a scoreboard where when i add to it all values go up by 1
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1744217775:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Using fake players is not multiplayer compatable
shi you right
You can probably use a storage linked the player to store a list
To do that you first need a player id system
View this guide on datapack.wiki: https://datapack.wiki/guide/nbt-and-scores/player-id-system/
actually yeah that works, function file with all the skills tied to a number 1-9 then have the player score increment by 1 when they pick a skill
then when they die see which one matches and remove the skill and decrese score by one
Indeed
😎
You can then use macros to acces a list in a storage which stores player data
macros?
With all respect, according to who?
So long as you put a $ or another character not allowed in player names in the name of your fake player, it will never have any problems.
if each player is adding to the same value how can one differentiate them
3 separate players are adding to one value that needs to be unique to each player
at least thats my understanding
Ah, in that case, you would then want to make a scoreboard that specifically holds this data. Then, you could let each player add one value to their own score on that scoreboard.
thats what im doing
You said you're using fake players.
though finding a good way to increase this scoreboard without it adding everytime the world is reloaded is proving to be difficult
That means they will have to use a score for each ability
not anymore
Or skill
im going to add more once i get this one working
this is run on player death
though like i said, having it run once and not when the serer is reloaded/loaded is proving difficult
For this, do you want all players' scoreboards to be first set to 1 when the pack is first loaded?
Just wanna make sure I'm understanding you correctly 😅
i am adding each score as they choose the skill, would it be better to do it that way?
That would work perfectly fine :)
when they die their score is reduced by one so that the next time its run they lose a different skill in the order
ooohhhhh
So the player could earn four skills in any order, and then if they die four times, they would lose the skills in the order they earned them?
that is best case but idk how to do that...
currently im hard coding it
so skill 1 is always fire resist and skill 2 is running faster during the day etc etc
Ahhh, I understand what you're doing now. Sorry about that.
That's a really kick-ass system, btw. It'll be sick when it's done.
nah helps to describe what i need for myself anyway
if i can get it to work ;-;
Since that's the case, TheBlackSwitch was 100% correct.
You would need to use data storage to keep track of this.
right now, when i reload the world it adds one to the board no mater what lol
Can I see the load.mcfunction?
I think I know why that's the case.
its not the load function i can promise that xD
this is whats adding to the board everytime the world is reloaded/loaded
and thats probably an underlying mod thingy
the file in question anyway
im thinking everytime its reloaded it the skill is readded to the player making it run the command again :/
if i could detach it from the skill unlock then that w- wait i could add a tag to a player that is then removed
add tag
add to board
remove tag
profit?
or i can reset everytime on reload
honestly if the system is going to run EVERYTIME the server/world is reloaded/loaded it might be best to just have it reset player scores to zero since it seems to want to add 1 for every skill thats been unlocked
the tags would still be added to the player and then whatever is looking for it will run anyway
You could add a condition to the scoreboard command so it only runs once.
Let me see how I did it in my datapack.
add a fake player and if the score of that player exists then dont run it
wait cant do that DX
add a tag to the player and if the player has it dont run
/execute unless entity @s[tag=fire_resist] run say hi
for example
just givev the player the tag
Just check to see if the given player has a value assigned to that scoreboard yet.
execute unless score @s venus_order matches 1.. run return fail
and it only runs once until its removed
Put this line at the top of the function.
It stops the function, and thus doesn't increase the scoreboard, if the player in question already has a value for that scoreboard.
oh this is much nicer
Or, if the advancement revoke command NEEDS to run, then just move it below the advancement revoke command.
well im going to have 9 of that same file essentially
under the folder venus im going to have 9 functions that give the player the power they bought and increase the board by 1
9 for now ;-;
RAHHH IT WORKS!