#trying to take damage in day time
1 messages · Page 1 of 1 (latest)
you can use a # in front of text to make it a comment (meaning that it will not register toward code and crash your function)
where would i go about coding it myself im really bad
the best way to tackle a bigger problem is to split into smaller easier to fix problems. You can split your problem into 3 parts:
- You'll need a way to check whether it is day or not. This can be easily done using a predicate. There is even a handy generator for it https://misode.github.io/predicate/
- At night, you want to double the hearts, this can be done using an attribute modifier called
max_healthwhich can be applied using the command/attribute - When it's day you want to apply damage with a slight delay in between the hits, this can be done using a scoreboard timer to time when to apply damage and the
/damagecommand to apply damage
If you need more help with the seporate parts feel free to ask. Since you've never made a datapack before I recommend first checking out our beginner's guide to get a little more familiar with datapacking
im on the website now
then it'd be best to delete all of it.. It's really bad.. and I mean REALLY bad at making datapacks... xD
you'll get through it dw even if it feels really oververwelming
first start with the beginners guide so you get more comfortable with functions, json and the overall structure of datapacks
im watching a tut on predicates
hmm ok if it works for you then that's fine
i dont get what i add after raining : true
i would imagine its a string of commands to take damage
but im really bad at coding
you don't want to do a weather check but instead do a time check
you won't code the commands directly inside the predicate, instead you'll have to make a ticking function (a function that runs every tick so 20 times a second) to check whether your predicate is true or not which would look like this execute if predicate <your_namespace>:<your_predicate> run ...
so i put the predicate in the tick function?
no you put the predicate in a .json file located at/data/<your_namespace>/predicate/
# Minecraft Datapack folder structure
# Last updated: Jul 1, 2024
.
├── pack.mcmeta
├── pack.png
└── data
└── <namespace>
├── advancement
├── enchantment
├── enchantment_provider
├── function
├── item_modifier
├── loot_table
├── predicate
├── recipe
├── structure
├── chat_type
├── damage_type
├── trim_material
├── trim_pattern
├── jukebox_song
├── painting_variant
├── wolf_variant
├── tags
| ├── banner_pattern
│ ├── block
│ ├── cat_variant
│ ├── damage_type
│ ├── entity_type
│ ├── fluid
│ ├── function
│ ├── game_event
│ ├── instrument
│ ├── item
│ ├── painting_variant
│ ├── point_of_interest_type
│ └── worldgen
├── 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
here is the overall folder structure of a datapakc
you only need the folders that will actually contain a file
the namespace is a folder with a custom lowercase name to differenciate datapacks from eachother
i downloaded a similar data pack
to compare
i still dont know what im looking at 😭
also it wont let me change my namespadew
namespace
it just loads then errors
for what minecraft version?
1.20 i think
it seems like this datapack is really outdated
i think it is
i think theres an easier way to go about it
from what i know i need something to tell the pack the time and one to execute the damage
nope this is the easiest way. The predicate is used for the datapack to tell the time and the ticking function is used to execute the damage
I'll make some steps for you to follow:
-# you'll have to wait a bit because I'm not the fastest typer xD
your very helpfu
- Make a basic datapack structure with a valid pack.mcmeta (you can look if you've done it correctly by running
/reloadand then do/datapack listto see if your datapack is loaded correclty)
Let's start by making the ticking function
2. make the following folder structure: data/minecraft/tags/function/tick.json
3. in tick.json you'll add your function (which we haven't made yet) to the minecraft tick tree and tell minecraft to run it every tick. This can be done by adding your function to the values in the tag. It will look something like this
{
"values": [
"<your_namespace>:<your_function_name_it's_best_to_call_this_tick>"
]
}```
4. now create a file in ``data/<your_namespace>/function/<your_function_name_it's_best_to_call_this_tick>.mcfunction``
5. in that file you can temporarly put a ``/say Hello World!`` command to check if you did everything correctly
6. run ``/reload`` ingame and see if you get ``Hello World`` spammed in your chat
Now we can create the predicate
7. use the website I've sent earlier to generate a file that checks whether it is day
8. create a file in data/<your_namespace>/predicate/<your_predicate_name>.json and put the output of the website in there
9. now you can add your time check condition to your say command in your tick function to test your predicate this would look something like ```ansi
[35mexecute [34mif predicate [33m<your_namespace>:<your_predicate_name> [34mrun [35msay [0mhello_world
uuugh
the bot did weird
it sould look like this: execute if predicate <your_namespace>:<your_prediacte_name> run say Hello World
ive always used the basic tick and load code
ok so that already works?
theres nothing in them atm
i made the predicate file
do i just put the day time
ok nice put a say command in there to double check that it's working correcly please (this will save a lot of time)
i have the folder in my data pack folder but will it work if its not zipped?
so what basically happens is that the time of the world gets divided by period and then the remainder is checked against values you want to have the period set to 24000 since that's the number of ticks in a minecraft day then you want to check if the value is between 0 and 12000 to check for the first half of the daylight cycle (which is when it's day)
okay period i understand not so much the value
your a phenomal teacher i have watched like 20 vids on data packs but learnt more from you then all of them 😭
"your predicate name" can that be anything i want
are you proud of me
IT WORKS
MY FIRST SUCCESFUL DATA PACK
im gonna chase this high all day
Me, having night rn:
same 😭
im so fricking happy tho
ive never been able to make a data pack work
now i have the freedom of learning stuff
look i did it myself
it took me 30 mins but
i did it myself
how do i get it to be a colour
Cool resource: https://mcstacker.net/
REALLY useful for datapacking
I would recommend learning it
(Not that difficult)
https://mcstacker.net/?cmd=tellraw to be exact
for that you need text components and the tellraw command
Oh wait
There's https://text.datapackhub.net/ if you want a cooler ui
can someone help me add the rest of the thing
im trying to make it damage me in the sun
/damage
this is as far as i got
idk what value does
if somoene can explain what value does i can try figure stuff out on my own
There's a generator for it that shows a description on hover
yea but i dont understand what value does
and what i need it to be for my data pack
Actually i dont understand it too
...
Sry
I looked at the wiki and i think i know now
{
"condition": "minecraft:time_check",
"value": {
"min": 0,
"max": 12000
},
"period": 24000
}
checks if its day
Whats the error?
got it
i had it under other code
i shouldve elaborated i dont want to take damage if im under shade and stuff like a zombie
Ohh
Then add it to the predicate
predicates
my enemy
add it to the predicate file?
this is the predicate file
ohhhhhhhhhhhhh
i get u now
im going through the minecraft zombies code
cause its like the same
it does
Nice
Ill have to leave
Have fun
thx
okay so now
i need it to damage me if these are not true
@half gyro my friend
ive made progress
very little progress
i think i did smth wrong
scoreboard players tag @e[type=minecraft:zombie,tag=burn] remove burn
scoreboard players tag @e[type=minecraft:zombie] add burn {Fire:0s,IsBaby:1b}
scoreboard players tag @e[type=minecraft:zombie] add burn {Fire:-1s,IsBaby:1b}
scoreboard players set @e[tag=loopHandle] catchFire 0
stats entity @e[tag=loopHandle] set QueryResult @s catchFire
execute @e[tag=loopHandle] ~ ~ ~ time query daytime
execute @e[tag=loopHandle,score_catchFire_min=12541] ~ ~ ~ scoreboard players tag @e[tag=burn] remove burn
scoreboard players set @e[tag=burn] catchFire 0
stats entity @e[tag=burn] set SuccessCount @s catchFire
execute @e[tag=burn] ~ ~ ~ testforblocks ~ ~1.5 ~ ~ 254 ~ -211 ~1.5 211 masked
entitydata @e[tag=burn,score_catchFire_min=1] {Fire:200s}
i found that online
Thats simply wrong
Try this thing
https://misode.github.io/predicate/?share=dSwpu6WzBq
please do not ping staff members for your help post, we are volunteers spending our free time trying to help people and we'll come help you when we have time
please just don't use AI... stats entity @e[tag=loopHandle] set QueryResult @s catchFire just doesn't / didn't exist at all
You won't learn anything if you're using AI to do everything for you. Instead use AI as a pocket teacher while not copying all the code... (tho AI can't even help with being a datapack teacher)
Using AI correctly sure is a skill but once you do you can learn to code A LOT faster
Anyways what have you done already? and where are you stuck?
it wasnt ai i found it on redit
😢
it doesn't really matter if it's wrong anyways
yea mb mb