How to make my entity disappear 10 seconds after spawning? Help and other problems

Started by remolinotrece on

Topic category: Help with MCreator software

Last seen on 03:58, 20. Apr 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make my entity disappear 10 seconds after spawning? Help and other problems

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?

Last seen on 14:47, 22. Apr 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I will show you how to make…
Sun, 01/28/2024 - 22:47

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!!

Last seen on 03:58, 20. Apr 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes I could understand…
Mon, 01/29/2024 - 14:38

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

Last seen on 14:47, 22. Apr 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Perfect!! So in the if [get…
Tue, 01/30/2024 - 03:07

Perfect!! So in the

if [get NBT 'mobDespawn' is < 1] {

set NBT 'mobDespawn' to 20

ADD the block ---> despawn mob

}

Last seen on 14:47, 22. Apr 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
One more thing, I recommend…
Tue, 01/30/2024 - 03:09

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!

Last seen on 14:47, 22. Apr 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Or you could put that…
Tue, 01/30/2024 - 03:10

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

Last seen on 03:58, 20. Apr 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
And with this I prevent the…
Tue, 01/30/2024 - 16:48

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

Last seen on 03:58, 20. Apr 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Excuse my English. I already…
Tue, 01/30/2024 - 16:51

Excuse my English. I already solved it another way* 

Last seen on 14:47, 22. Apr 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh ok, but you have to…
Wed, 01/31/2024 - 02:53

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!

Last seen on 03:58, 20. Apr 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But when I add 900 ticks, my…
Wed, 01/31/2024 - 15:41

But when I add 900 ticks, my mob disappears instantly :/