#(mrhoneybun) how to make a primed tnt spawn whenever a zombie is chasing after the player

26 messages · Page 1 of 1 (latest)

proven narwhal
#

currently this is my code:

analog torrentBOT
#

(mrhoneybun) how to make a primed tnt spawn whenever a zombie is chasing after the player

analog torrentBOT
#

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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

proven narwhal
#
    type: item
    material: zombie_spawn_egg
    display name: <&c>Bomber
    lore:
    - <&7>Spawn a bomber
getbomberspawnegg:
    type: command
    name: getbomberspawnegg
    description: Gives the player a bomber spawn egg
    usage: /getbomberspawnegg
    script:
    - give bomberspawnegg
bomber:
    type: entity
    entity_type: zombie
    mechanisms:
        max_health: 100
        health: 100
        equipment:
            boots: air
            leggings: air
            chestplate: air
            helmet: TNT
        item_in_hand: FLINT_AND_STEEL
        age: baby
        custom_name: <&c>Bomber
        custom_name_visible: true

spawnbomber:
    type: world
    events:
        on player right clicks block:
            - determine passively cancelled
            - spawn bomber <context.relative>
        on bomber targets player:
            - while <context.target.is_living>:
                - spawn primed_tnt <context.entity.location>
                - ratelimit <context.entity> 5s```
#

but sometimes the zombie will spawn one or two tnts, and i want it to spawn the primed tnt consistently, so im assuming my code is wrong somewhere

vapid knoll
#

ratelimit should come before the code being ratelimited

frigid fjord
#

should also check if the context entity is spawned / exists to prevent errors when chunk gets unloaded

#

!t entity.is_living

cyan burrowBOT
# frigid fjord !t entity.is_living

Returns whether the entity type is a living-type entity (eg a cow or a player or anything else that lives, as specifically opposed to non-living entities like paintings, etc).
Not to be confused with the idea of being alive - see !tag EntityTag.is_spawned.

Group

data

Returns

ElementTag(Boolean)

frigid fjord
#

This will always return true

#

should use the tag in the description instead of that

red topaz
#

i would go with a flag on the zombie rather than relying on a ratelimit

frigid fjord
#

I'm not sure what the ratelimit is for

red topaz
#

I uhh

#

think it's putting a delay on the loop somehow?

#

not sure how it's doing that tbh

#

i.e there's no wait on the loop

frigid fjord
#

doesnt make sense at all inside the loop, it would only run once?

red topaz
#

so it should in theory be spawning infinite tnts, but that's not what it's doing

#

yeah maybe

#

anyway, it's not how this should be tackled to begin with

#

afaik, a ratelimit at the end of code won't do anything

frigid fjord
#

ratelimit the event would make sense but would still start infinite while loops every 5 seconds

frigid fjord
proven narwhal
#

!solved