1

I am trying to make a freestanding crawling system that works for multiplayer in version 1.15. I was wondering if there would be a way to summon an entity to the player when that specific entity is not near the player. Here are the commands that I have so far:

/scoreboard objectives add sneak minecraft.custom:minecraft.sneak_time

/execute as @a[scores={sneak=1}] at @s run tp @e[type=minecraft:armor_stand,distance=..2] ~ ~-1 ~

/execute as @a[scores={sneak=1..}] run scoreboard players reset @a sneak

/execute as @a[scores={sneak=1}] at @s unless entity @e[tag=IsCrawl,distance=3..,limit=1] run summon armor_stand ~ ~ ~ {NoGravity:1b,Invisible:1b,NoBasePlate:1b,Tags:["IsCrawl"],Passengers:[{id:"minecraft:shulker",Silent:1b,Invulnerable:1b,CustomNameVisible:0b,DeathLootTable:"minecraft:empty",AttachFace:0b,Tags:["IsCrawl"],ActiveEffects:[{Id:14b,Amplifier:1b,Duration:1000000,ShowParticles:0b}]}]}

/execute as @a at @s if entity @e[tag=IsCrawl,distance=3..,limit=1] run kill @e[tag=IsCrawl]

I've also tried this (formatted for clarity, run unformatted):

execute as @a at @s unless entity @e[tag=IsCrawl,distance=3..,limit=1] 
run summon armor_stand ~ ~ ~ {
    NoGravity:1b,
    Invisible:1b,
    NoBasePlate:1b,
    Tags:["IsCrawl"],
    Passengers:[{
        id:"minecraft:shulker",
        Silent:1b,
        Invulnerable:1b,
        CustomNameVisible:0b,
        DeathLootTable:"minecraft:empty",
        AttachFace:0b,T
        ags:["IsCrawl"],
        ActiveEffects:[{
            Id:14b,
            Amplifier:1b,
            Duration:1000000,
            ShowParticles:0b
        }]
    }]
}

But I need one that only summons when the player has a sneak score of 1 and when the entity is not near the player.

  • You're going to have to give us a few more details. I don't fully understand the problem. – MBraedley Jul 17 at 19:50
  • I just need help with detecting for when an entity is not near the player. – Help Please Jul 17 at 20:28
  • There's an execute variant similar to execute if that inverts the result; execute unless. You're most of the way there already with your last command. – MBraedley Jul 17 at 20:38
  • I made a command like this: execute as @a at @s unless entity @e[tag=IsCrawl,distance=3..,limit=1] run summon armor_stand ~ ~ ~ {NoGravity:1b,Invisible:1b,NoBasePlate:1b,Tags:["IsCrawl"],Passengers:[{id:"minecraft:shulker",Silent:1b,Invulnerable:1b,CustomNameVisible:0b,DeathLootTable:"minecraft:empty",AttachFace:0b,Tags:["IsCrawl"],ActiveEffects:[{Id:14b,Amplifier:1b,Duration:1000000,ShowParticles:0b}]}]} – Help Please Jul 17 at 21:39
  • But I need one that only summons when the player has a sneak score of 1 and when the entity is not near the player – Help Please Jul 17 at 21:41
0

try making it so the entity sets your player a dummy score of 2 when within a certain radius and having the game subtract the dummy by 1 every tick.

if the score reaches 0, summon a new entity

| improve this answer | |
0

So in pseudocode, you want:

if(sneak = 1 & distance > 3) {
    summon();
}

Your current command would only summon if one already exists, and further away than 2 tiles. I presume you also want to summon if there are no armor stands tagged IsCrawl

Conditionals with commas apply the AND operation in minecraft. However, there is no OR function for conditionals, and NOT applies to all. So you would need to use multiple commands if you used negation due to De Morgan's Laws, which state.

 ¬A & ¬B = ¬(A | B)
 ¬(A & B) = ¬A | ¬B

I don't think there's a need for this complexity though. The operation distance >= 3 is the inverse of distance <= 2, so why not just use:

 tag=IsCrawl,distance=..2

as your conditional? If there is not 'one or more entity within the radius', then there are no entities within the radius, hence you want to summon a new one. (See: Inequality)That would lead to

@a[scores={sneak=1}] at @s unless entity @e[tag=IsCrawl,distance=..2]
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.