[HELP] How Can I Un-Summon Mob After A Minute

Started by RandomDrago on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[HELP] How Can I Un-Summon Mob After A Minute

So Basically- I want to make a custom mob despawn after a minute like a summoned creature expiring etc-

I thought of giving it wither but It wouldn't look good graphically and would probably have problems with it's ai
Alternatively I thought of using nbt tags etc to detect if it's timer is enough etc but I don't know how to do that.

If anyone could help I would appreciate it 

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how about using number data…
Thu, 07/28/2022 - 15:01

how about using number data tag?

On initial entity spawn add NBT number tag for example: <timer> <1200> (one minute in ticks)

than on entity tick do something like:

if get NBT number tag > 0

   set NBT number tag to [get NBT number tag - 1]

else

   despawn entity

I hope this somehow helped

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There should be an entity…
Thu, 07/28/2022 - 15:02

There should be an entity management block that despawns the target entity. Make a procedure that does the following, and call it on the entity's update tick, or when the entity is spawned.

  • Wait 1200 ticks, (or however long you want it to stay in the world- you could also randomize this within certain parameters.)
  • Check that the entity is still alive. (Make an if-block that checks that the target entity is alive.)
  • Despawn target entity.

If you want to make it a bit more dramatic, you could make particles spawn around the entity when it's about to despawn, (just make another wait block with a shorter duration), generate an explosion upon despawning, summon lightning, etc.

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
for dramatic particles you…
Thu, 07/28/2022 - 15:06

for dramatic particles you can execute command

particle minecraft:block redstone_block ~ ~1 ~ 0.3 0.3 0.3 0.3 50

(this command spawns particles imitating blood)

 

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually, you can just do …
Fri, 07/29/2022 - 06:00

Actually, you can just do

"On Initial Entity Spawn"

Wait 1200 Ticks then do

  Despawn event/target entity

  Repeat 100 times

    Wait pick random 0 to 100 ticks then do

       Summon 5 particles on server side with range 3 blocks TYPE: PARTICLE NAME

Or something like that.

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Folks! Thank you all so much…
Fri, 07/29/2022 - 08:10

Folks! Thank you all so much- 

I've honestly been looking around for such things but never saw anyone ever post about it so I decided to ask it myself and people actually have a solution for it now-

After asking the question I also thought of sth like 

---
If source entity variable PlayerMana > 200
Summon FireElemental at SourceEntity
Check entity iterator square cube 4 subtype FireElemental
Get UUID EventTargetEntity
If data summontimer = 0
Despawn EventTargetEntity/UUID
Else 
Set data summontimer - 1
---

It's honestly brilliant what an outrageous amount of talent this community has! I personally think RandomDudeGamer's reply might be the simplest and easiest one but what do they mean by the code below? Is it like- Within 100 ticks it summons 100 particles of the type and since it's within 100 ticks it's not all at once/cluttered etc?

--

 Repeat 100 times

    Wait pick random 0 to 100 ticks then do
--

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wait 1200 ticks do despawn…
Fri, 07/29/2022 - 08:59

Wait 1200 ticks do despawn event target entity

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, the particles won't…
Sat, 07/30/2022 - 05:01

Yeah, the particles won't spawn all at once. Between 0 and 100 ticks (0~5 seconds), around 500 particles will spawn randomly when the mob is despawning. Doing too much more will kinda lag the game. Also, when doing like campfire smoke, or big particles, bring the "spawn 5 particles on server side" down to "spawn 1 particles on server side", because trust me, it lags A LOT.

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hello, I know this post is…
Tue, 08/27/2024 - 17:53

hello, I know this post is from a very long time ago but I would like to have a photo of how to do this procedure, I am new to Mcreator