#I'm making a datapack for a new series I'm in the works of creating

1 messages · Page 1 of 1 (latest)

lone cipher
#

I need help removing hearts, I've set it so when a player starts they get the Life1 team. With that team you get additional hearts from this command effect give @a[tag=life1] minecraft:health_boost infinite 9 true . However if you fail a task you lose 4 hearts & thats the part I'm not sure about

I've done whats in the image foolishly without actually knowing what I was doing & now I can't give myself extra hearts(I just rejoined the world & it seems to be fixed idk)

astral copperBOT
#
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

lone cipher
#

If needed I can just give them poison for a specific time

blissful hornet
#

To change the max healthy you can use /attribute @s generic.max_health base set 16 I suggest using this method for the life1 team too.

upbeat dock
#

If you set your max health below your current health, it doesn’t update visually instantly

For that I recommend damaging the player for 0 damage (or 0.00000000001)

lone cipher
#

I know the red & yellow means somethings up don't worry about that 😅

But is this how it's meant to be??

lone cipher
lone cipher
#

It has all the commands I believe is required & when I do the /function life_series:life1_init to start it nothing happens:/

west zodiacBOT
#
📂 Datapack Folderstructure
                .
                ├── pack.mcmeta
                ├── pack.png
                └── data
                    └── <namespace>
                        ├── advancements
                        ├── functions
                        ├── item_modifiers
                        ├── loot_tables
                        ├── predicates
                        ├── recipes
                        ├── structures
                        ├── chat_type
                        ├── damage_type
                        ├── tags 
                        │   ├── blocks
                        │   ├── entity_types
                        │   ├── fluids
                        │   ├── functions
                        │   ├── game_events
                        │   ├── items
                        │   ├── chat_type
                        │   └── damage_type
                        ├── dimension
                        ├── dimension_type
                        └── worldgen
                            ├── biome
                            ├── configured_carver
                            ├── configured_feature
                            ├── density_function
                            ├── noise
                            ├── noise_settings
                            ├── placed_feature
                            ├── processor_list
                            ├── structure
                            ├── structure_set
                            ├── template_pool
                            ├── world_preset
                            └── flat_level_generator_preset
                        ```
terse fractal
#

sorry for the long reply. Have you tried checking the logs?

west zodiacBOT
#
:information_source: Default Launcher Logs

The logs are where Minecraft displays errors when something goes wrong and can thus help you gain information about why something isn't working for you!
To open the logs:

  1. Enable logs in the Minecraft Launcher
  2. Start your game (or restart it if you already have an open instance)
  3. Enjoy spotting errors getting much easier!
terse fractal
#

@lone cipher ^^^

lone cipher
#

Ok thankyou

lone cipher
#

I'll turn it on after I finish my room

terse fractal
#

awesome

#

just turn on the logs, /reload your pack, then the errors should appear in red or yellow text

lone cipher
#

Ight relogging

lone cipher
#

It shows the stuff but not the /function namespace:life1_init

#

So I went to a different world with the DP & got this
Server thread - [Dave1013439: Executed 2 command(s) from function 'life_series:life1_init']

Render thread - [System] [CHAT] Executed 2 command(s) from function 'life_series:life1_init'

lone cipher
#

Ok I got it working

#

Ok wait

lone cipher
#

Wait it doesn't give me the Life2 team?

lone cipher
#

I officially have no idea how to fix this 😔

terse fractal
lone cipher
#

After I'm done working on my world for tomorrow's stream I'm gonna rework on this

soft zenith
astral copperBOT
#
Quick Look

Task_Life_SMP/data/life_series/functions/life1_init.mcfunction:

# life_series:life1_init
execute as @a run team join life1
effect give @a minecraft:health_boost infinite 9 true
effect give @a minecraft:regeneration 4 180 true

terse fractal
#

they should show up

#

are you sure that when you /reload there’s no red or yellow text?

lone cipher
lone cipher
#

also cool how'd you do that?

soft zenith
lone cipher
#

How do you do that?

soft zenith
#

/attribute @s generic.max_health base set <amount> as far as my memory goes but you can just /help attribute

lone cipher
#

Ok let me see

#

/attribute @s generic.max_health base set 60 = 3 rows of hearts including defult

#

Ok

#

Does that affect everyone or just the player?

#

nvm you can change it

#

I gotta read things before I willy nilly do something lol

soft zenith
soft zenith
#

i believe you can straight up 'add' too

#

but its harder

#

you do something like /attribute @s generic.max_health base modify or something and syntax is pretty complicated iirc

#

lets see

west zodiacBOT
#
📜 /attribute

attribute <target> <attribute> get [<scale>]

Returns the total value of the specified attribute.

attribute <target> <attribute> base get [<scale>]

Returns the base value of the specified attribute.

attribute <target> <attribute> base set <value>

Overwrites the base value of the specified attribute with the given value.

attribute <target> <attribute> modifier add <uuid> <name> <value> (add|multiply|multiply_base)

Adds an attribute modifier with the specified properties if no modifier with the same UUID already existed.

attribute <target> <attribute> modifier remove <uuid>

Removes the attribute modifier with the specified UUID.

attribute <target> <attribute> modifier value get <uuid> [<scale>]

Returns the value of the modifier with the specified UUID.

soft zenith
#

oh yea is there

#

and you can also add negative values in there

#

so you can both increase and decrease, as well as multiplying the base value like if it was 20 i could multiply it by 0.5 to get 10

lone cipher
soft zenith
#

im not 100% sure about that but i think i have seen somebody do that

lone cipher
#

So with that I'd just change all the giving & losing hearts to the
attribute system??

#

Ok thx

upbeat dock
#

Is there a limited amount of states the player can be in (Like 9 lifes, 8, 7 and so on)? Or is it dynamic (like adding and removing X hearts for Y action)?

lone cipher
#

& adding

upbeat dock
#

Should it be able to add/remove hearts infinitely? Because that would require a different system

#

If you know how often you can do it at most, it’s probably best to hardcode that

lone cipher
#

Wait what do you mean?

upbeat dock
#

If you know, the player can have 1 heart, 3 hearts, 5 hearts … up to 19 hearts at most, then it is better to hardcode that, since it's only like 10 states

lone cipher
#

Wait you can't use @a in the arribute??

upbeat dock
lone cipher
upbeat dock
upbeat dock
soft zenith
lone cipher
#

Yeahh

lone cipher
soft zenith
upbeat dock
#

Then just explain that and if it doesn’t suffice we can still rewrite everything :D

lone cipher
#

Why was I reading hardcoding as hardcoring lol

soft zenith
#

you can add and remove with attribute <target> <attribute> modifier add <uuid> <name> <value> (add|multiply|multiply_base)

soft zenith
upbeat dock
#

No dynamic system, Hardcoding go brr

lone cipher
#

xD

#

scoreboard objectives add deadthCount deathCount

/execute as @a[scores={deathCount=3..}] run team join Life4 @a

#
execute as @a[team=life1] run team join life2
execute as @a[team=life1] run team leave life1 
attribute @s generic.max_health base set 60
effect give @s[team=life2] minecraft:regeneration 4 180 true```
#

Is this the right way to have this?

#

Ok so I changed the death.mcfunction to this:

execute as @a[scores={deathCount=1..}] run function life_series:life2_init
execute as @a[scores={deathCount=2..}] run function life_series:life3_init
execute as @a[scores={deathCount=3..}] run function life_series:life4_init
execute as @a[scores={deathCount=4..}] run function life_series:life5_spectator```
#

Which in theory plays the life2_init but it doesn't?

#

This should allow it so when I die it automatically triggers the second init

lone cipher
#

If anyone knows can you @ me

terse fractal
lone cipher
#

Yeah it does

terse fractal
#

That entire command

#

with the execute if score and stuff

lone cipher
#

Yes

#

It does work

terse fractal
#

You can debug by putting a say command in the function to see whether it runs or not

lone cipher
terse fractal
#

Yeah exactly

#

So you can use the say commands to tell where they went wrong

#

oh I think I found the issue

#

in data/minecraft/tags/functions/tick.json you need to change namespace to life_series

#

and also in load.json

lone cipher
#

Oh 😅
let me try it again

lone cipher
#

Ok so I changed it to

execute as @a[scores={deathCount=1..}] run function life_series:life2_init
execute as @a[scores={deathCount=2..}] run function life_series:life3_init
execute as @a[scores={deathCount=3..}] run function life_series:life4_init
execute as @a[scores={deathCount=4..}] run function life_series:life5_spectator.mcfunction```
#

However when I do /function life_series:life1_init it gives me the hearts & regen but no team

execute as @a run team join life1
attribute @s generic.max_health base set 60
effect give @a minecraft:regeneration 4 180 true```
#

I've done this with command blocks
when I die I get the team 1/5

#

& it works on there

lone cipher
#

Would anyone know?

upbeat dock
#

I'm not quite sure what your goal is.
You want to change the health of every player each death and give them regen for a short time?

lone cipher
upbeat dock
#

The goal of the thing you need help with

lone cipher
#

& yes thats pretty much it
I need it so everytime you die you get reset to 20 hearts with 4 seconds of regen, everytime you die you get Life2

upbeat dock
#

"Every time you die […] to 20 hearts" why then the difference in death count?

#

"You get Life2" you what?

lone cipher
upbeat dock
#

30

#

But how does it change? Why do you need to reset it to 30? Do you do that every death?

lone cipher
lone cipher
#

Then when you die

#

You get 30 hearts

#

& removed from life1 to Life2

upbeat dock
#

Or 30?

lone cipher
#

30 hearts like in the hotbar where you see your hearts you have 10 by defult, in this you get the 30

upbeat dock
#

But then, you could just set that once per player when they join

#

Why do you need to set that in the dieing function?

lone cipher
#

It's not when they join

#

No thats to signify when someone dies it plays the init

upbeat dock
#

Okay, when do you want to set the player to 30 hearts?

#

Directly? On first death?

lone cipher
#

When the series starts & straight after death

upbeat dock
#

But they retain the 30 hearts on death

lone cipher
#

No

#

They reset to 30

upbeat dock
#

U mean 10?

lone cipher
#

no

#

30

upbeat dock
#

Okay, I don’t understand what you want to do with health

#

But changing teams depending on how many deaths is easy

lone cipher
#

Just when you die you get the 30 hearts

upbeat dock
#

You "get" as in they get added, or "get" as in their health is set to 30? That’s what I don’t understand and I think I got conflicting answers from you

lone cipher
#

Their health is set to 30

#

Ah apologies

upbeat dock
#

I don’t know where the difference is? Retaining the 30 hearts and resetting to 30 hearts is the same thing in this case no?

lone cipher
#

Yeah no my bad 😅

upbeat dock
#

Okay, then you want to do 2 things

  1. Set a players base health to 30 when they first spawn
  2. let the player join the correct team on death
lone cipher
#
  1. no
    2 yeah

  2. Set a players base health to 30 when they die

#

brb

upbeat dock
#

And if you then wanna do something else on death, put that in the same function

#

Though I don’t grasp what exactly that is but you'd put it there 👍

lone cipher
lone cipher
#

@upbeat dock

I believe I have a break through

Ok so I have these in a command block & it works besides the giving me a team

I've got the command block set to execute as @a[scores={deathCount=1..}] run function life_series:life2_init, which gives me the hearts & regen + I have set up a /say feature which registers the feature, for testing. Still no team tho

When I do the command /function life_series:life1_init I get the team Life1. But when I die I don't remove the Life1 team or get the Life2 team

I also used your idea of team join Life2 @s[scores={total=1}]

#

I'm gonna get some sleep it's 4:30am
I got somewhere to be at 7am I'll be back after that

lone cipher
#

Everything I do doesn't work

lone cipher
lone cipher
#

Does anyone know how to work with Loot tables?

#

This is where the loot_table it
Task_Life_SMP\data\minecraft\loot_tables\life_series\tasks.json
This is whats inside the tasks.json file

  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "item",
          "name": "minecraft:written_book",
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{title:\"Random Task\",pages:['{\"text\":\"Your Task: This works congrats #1\",\"extra\":[{\"text\":\"\\n\\nTask: This works congrats #1\"}]}']}"
            }
          ]
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "item",
          "name": "minecraft:written_book",
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{title:\"Random Task\",pages:['{\"text\":\"Your Task: This works congrats #2\",\"extra\":[{\"text\":\"\\n\\nTask: This works congrats #2\"}]}']}"
            }
          ]
        }
      ]
    }
  ]
}```

& when I do the command ``/loot spawn ~~~ loot minecraft:life_series/tasks`` it says Dropped 0 items
#

In the connect_to_event file
execute as @a[distance=..1] run function life_series:get_random_book

In the get_random_book file
# life_series:give_random_task execute positioned 49 69 97 run loot spawn ~ ~ ~ loot life_series:tasks

#

I'm trying to make a loot table to sort tasks, the Easy & medium tasks I'm gonna put together but then I need another for hard & team tasks

astral copperBOT
#
🗑️ 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.

astral copperBOT
#
🗑️ 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.

astral copperBOT
#
🗑️ 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.