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

Started by RandomDrago on Thu, 07/28/2022 - 14:23

Topic category: Help with modding (Java Edition)

Last seen on 04:20, 24. Aug 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[HELP] How Can I Un-Summon Mob After A Minute
Thu, 07/28/2022 - 14:23

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 

Last seen on 11:39, 2. Oct 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 20:08, 25. Sep 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 11:39, 2. Oct 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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)

 

Last seen on 13:36, 4. Oct 2022
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 04:20, 24. Aug 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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
--

Last seen on 07:43, 2. Oct 2022
Joined Jun 2022
Points:

User statistics:

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

Wait 1200 ticks do despawn event target entity

Last seen on 13:36, 4. Oct 2022
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.