Started by
remolinotrece
on
Topic category: Help with MCreator software
I'm creating a horror mod that when you sleep, the mob appears next to you, but I want it to only last 10 seconds and then disappear. Does anyone know how? I tried to make timers with NBT Tags but I'm quite new and I still can't understand them too much. Also with the timers that the program gives me, not only my entity disappears but also all the mobs in the world. And when the entity appears, there are certain times that its spawn is doubled or tripled. Anyone help?
I will show you how to make NBT tags which is more accurate and the 'wait' block
WAIT BLOCK:
Go make a procedure 'On Initial Entity Spawn', you will want to get the 'Wait for X seconds' block and the despawn entity block. Just search them in the search bar in the procedures and you'll find them easier. Next you will want to set how many seconds in the wait block and put the despawn block in
NBT:
Go to 'On Entity Tick Update' and get a set NBT and get NBT. Make sure both are number tags. Set them to whatever you want, but in this case to "mobDespawn". Then make it like this:
!!ASK ME FOR A PICTURE IF YOU DO NOT UNDERSTAND!!
if [get NBT 'mobDespawn' is < 1] {
set NBT 'mobDespawn' to 20 (for 1 second, 20t = 1s. 100t = 5s)
}
if [get NBT 'mobDespawn' is > 0] {
set NBT 'mobDespawn' to (get NBT 'mobDespawn' + 1)
}
Hope this helped!!
Yes I could understand everything you said. The NBT will help them avoid duplication, right? I sent you a screenshot of what you told me
https://imgur.com/FfnloRH
Perfect!! So in the
if [get NBT 'mobDespawn' is < 1] {
set NBT 'mobDespawn' to 20
ADD the block ---> despawn mob
}
One more thing, I recommend you specify the mob in that procedure, because if not, then all the mobs that spawn will despawn when the time frame hits. So if you want your world to be a peaceful one, you can keep it. If you don't know how to specify, go to the 'LOGIC' tab and scroll to the bottom until you see "Is entity sub-type of " and choose your entity there!
Or you could put that procedure and remove the global trigger (don't actually remove it I mean just set it to no additional trigger) and put that into the mob's On Entity Tick Update trigger
And with this I prevent the entity from being duplicated, right? I could have solved it another way but thanks. Although I just tried it and my entity disappears after 20 ticks but not after 900 ticks (as I had set it to the maximum spawn time)
https://imgur.com/a/Lv92sFY
Excuse my English. I already solved it another way*
Oh ok, but you have to change the NBT set number block from 20 to 900 which is 45 seconds right? Either way, since you've solved it, then have fun modding!
But when I add 900 ticks, my mob disappears instantly :/