#trying to make a scoreboard where when i add to it all values go up by 1

1 messages · Page 1 of 1 (latest)

sick leaf
#

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.

acoustic domeBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 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

ruby scaffold
#

Using fake players is not multiplayer compatable

sick leaf
#

shi you right

ruby scaffold
#

You can probably use a storage linked the player to store a list

#

To do that you first need a player id system

strange otterBOT
sick leaf
#

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

ruby scaffold
#

Indeed

sick leaf
#

😎

ruby scaffold
#

You can then use macros to acces a list in a storage which stores player data

sick leaf
#

macros?

final storm
#

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.

sick leaf
#

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

final storm
#

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.

sick leaf
#

thats what im doing

final storm
#

You said you're using fake players.

sick leaf
#

though finding a good way to increase this scoreboard without it adding everytime the world is reloaded is proving to be difficult

ruby scaffold
#

That means they will have to use a score for each ability

sick leaf
ruby scaffold
#

Or skill

sick leaf
#

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

final storm
#

Just wanna make sure I'm understanding you correctly 😅

sick leaf
#

i am adding each score as they choose the skill, would it be better to do it that way?

final storm
#

That would work perfectly fine :)

sick leaf
final storm
#

ooohhhhh

sick leaf
#

for example

#

imagine they are all different skills haha

final storm
#

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?

sick leaf
#

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

final storm
#

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.

sick leaf
#

nah helps to describe what i need for myself anyway

sick leaf
final storm
#

Since that's the case, TheBlackSwitch was 100% correct.

#

You would need to use data storage to keep track of this.

sick leaf
#

right now, when i reload the world it adds one to the board no mater what lol

final storm
#

I think I know why that's the case.

sick leaf
#

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

final storm
#

Let me see how I did it in my datapack.

sick leaf
#

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

final storm
#

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

sick leaf
#

and it only runs once until its removed

final storm
#

It stops the function, and thus doesn't increase the scoreboard, if the player in question already has a value for that scoreboard.

final storm
#

Or, if the advancement revoke command NEEDS to run, then just move it below the advancement revoke command.

sick leaf
#

well im going to have 9 of that same file essentially

sick leaf
#

9 for now ;-;

#

RAHHH IT WORKS!

sick leaf
#

now to automate the removal of said skill on death 😎

#

ok nows its complete, time to add a second skill and hope nothing breaks haha

#

ty all for the help :D