#(aviside) How would I make mobs run away from creepers about to explode?

70 messages · Page 1 of 1 (latest)

dreamy juniper
#

This was a feature in 1.8 but it was removed due to lag. The lag was caused by mobs globally checking if creepers were about to explode every second.

If I could attach some commands (redirecting nearby entities) to a creeper about to explode (as opposed to checking every second) it wouldn't be as laggy, how could I accomplish this?

Also what tags are needed to find a spawnable block behind an entity? And what command do I use to make a mob walk somewhere?

radiant lotusBOT
#

(aviside) How would I make mobs run away from creepers about to explode?

radiant lotusBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

tropic summit
#

!e entity explosion primes

storm mirageBOT
# tropic summit !e entity explosion primes
Group

Entity

Event Lines

<entity> explosion primes

Triggers

when an entity decides to explode.

Context

<context.entity> returns the EntityTag.
<context.radius> returns an ElementTag of the explosion's radius.
<context.fire> returns an ElementTag with a value of "true" if the explosion will create fire and "false" otherwise.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

tropic summit
#

!c walk

storm mirageBOT
# tropic summit !c walk
Group

entity

Syntax

walk (<entity>|...) [<location>/stop] (speed:<#.#>) (auto_range) (radius:<#.#>) (lookat:<location>)

Short Description

Causes an entity or list of entities to walk to another location.

Description

Causes an entity or list of entities to walk to another location.

Specify a destination location to walk to, or 'stop' to stop all walking.

Optionally, specify a "speed:<#.#>" argument to control the speed of the NPCs.

Optionally, specify "auto_range" to automatically set the path range for the walk instruction
(if not specified, an NPC will not be able to walk to a location outside of its existing path range, by default 25 blocks).
(Does not apply to non-NPC entities).

Note that in most cas...

graceful sleet
#

Feel free to ask if you need any more help, otherwise -

sweet flaxBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@dreamy juniper

dreamy juniper
#

Thanks for the event and command.
Is it possible to find a random spawnable block away from the explosion using tags? I want them to run away realistically

graceful sleet
#

!t find_spawnable

storm mirageBOT
# graceful sleet !t find_spawnable

Returns a list of blocks within a radius, that are safe for spawning, with the same logic as !tag LocationTag.is_spawnable.
Note: current implementation measures the center of nearby block's distance from the exact given location.
Result list is sorted by closeness (1 = closest, 2 = next closest, ... last = farthest).

Group

finding

Returns

ListTag(LocationTag)

dreamy juniper
#

Yeah, but how do I sort the list to make sure it's away from the explosion?

graceful sleet
#

Result list is sorted by closeness (1 = closest, 2 = next closest, ... last = farthest).

dreamy juniper
#

Well this script doesn't entirely work:

#

And I'm unsure why

dreamy juniper
#

It only triggers after the creeper has exploded when it needs to be before

dreamy juniper
#

Even when it does, the pathfinding is poor

shell vapor
#

Just leave it off maybe

dreamy juniper
#

I tried regular speeds too

shell vapor
#

What do you think regular speeds are

dreamy juniper
#

Leaving it off

shell vapor
#

Ah okay

#

0.4 is pretty high though

dreamy juniper
#

I agree

#

Besides that, Is there any way to make this trigger before the explosion happens? Like when it's ignited?

graceful sleet
#

I think that event triggering at the wrong time is a Spigot bug, but you might be able to use

#

!e game event

storm mirageBOT
# graceful sleet !e game event
Group

World

Event Lines

generic game event

Switches

type:<game_event_name> to only process the event when a specific game event is fired.

Triggers

when the minecraft world experiences a generic minecraft game event. This is normally used for sculk sensors.

Context

<context.location> returns the location of the event.
<context.entity> returns the entity that triggered the event, if any.
<context.game_event> returns the name of the Minecraft game event, for example "minecraft:block_ch...
<context.radius> returns the radius, in blocks, that the event is broadcast to.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

graceful sleet
#

the prime_fuse game event, and check if the entity is a creeper

dreamy juniper
#

yeah that's working!

#

My last problem is with the walk command

#

Using "find_spawnable_blocks.within" in the location tags causes their path finding to be poor

graceful sleet
#

!vague

storm mirageBOT
# graceful sleet !vague
Info: vague

Your question is too vague to be able to answer well.

If you're asking how to do something, please make sure to add some background detail. Make sure to specify your overall end goal and the general design/idea and any existing progress towards that goal, not just the single specific point.

For script-related problems, see also !info haste debug. For non-scripting server trouble, see !logs.

See also !xyproblem

dreamy juniper
#

Sometimes they will walk into the explosion

graceful sleet
#

What do you want to happen? what's happening instead? we need a bit more info to help

dreamy juniper
#

When they need to be walking the opposite direction

#

I just want to find a way to have the mobs run the opposite direction of the explosion

#

instead of finding a random block far away

graceful sleet
#

Could start the search from where the explosion is happening

#

Then it'll always be a radius around it

dreamy juniper
#

Okay, I'll try that out, thanks

graceful sleet
#

Although depending on how far away you want them to run, that might be not great for performance checking a radius too large - an alternative approach could be just getting a random point away from the creeper in the mobs direction, and do a smaller lookup from there

dreamy juniper
#

I want them to run decently far, so far using that method isn't producing the results I wanted. Groups of mobs will run in one direction sometimes

#

I'm not sure how to get a point away from the creeper in the mobs direction

graceful sleet
#

Well, you need to pick a separate location for every mob if you're only doing one lookup - although if you do a smaller lookup for each mob that in the correct direction that shouldn't be a problem

#

Well, try thinking about it/looking at the meta if you need to - what you want to do is get a block away from the creeper, in a line that crosses where the mob is, I.e. in the mob's direction

#

Do you have any initial idea of how that could be achieved?

dreamy juniper
#

Does the smaller lookup involve the raytrace tag?

#

That's my initial idea

#

I've never determined locations like this before though, not sure how else to get a block in a line that crosses the mob

graceful sleet
#

Raytracing could work, but it'd hit any block in the way which is probably not what you want

#

!t LocationTag.face

storm mirageBOT
graceful sleet
#

!t LocationTag.forward_flat

storm mirageBOT
graceful sleet
#

And maybe a

#

!t highest

storm mirageBOT
# graceful sleet !t highest
Cannot Specify Searched Tag

Multiple possible tags: <LocationTag.highest>, <ListTag.highest[(<tag>)]>, <ListTag.highest[(<tag>)].count[<#>]>.

graceful sleet
#

!t LcoationTag.highest

storm mirageBOT
#
Possible Confusion

Did you mean to search for locationtag.highest?

storm mirageBOT
graceful sleet
#

In case it ends up in a hill/some blocks

#

Although that might break if there's e.g. a sky platform, so can test both and see what works best for you