#why not working?

1 messages · Page 1 of 1 (latest)

warped mural
#

/execute as @e[name="§9Blue P ortal",tag=spawned,rm=2] at @s if score @e [name="§9Blue Portal",tag=!spawned] ID = @s ID run kill @s

this was supposed to test if there is an entity without the tag spawned (so I know that it is the newer entity) and if this entity has the same ID as the new entity, it would kill itself

unique star
#

To compare two entity’s IDs:

/execute as <target1> positioned as <target2> if score @s obj = @n obj run /…```
#

Optimisation Tips

U can use positioned as and at interchangeably, just positioned as is more optimised for this application

The order of as and positioned as is also swappable, but it is most optimised in this orientation

<target1> should be ur entity without the spawned tag for maximum optimisation

#


To check if an entity without a matching ID exists, ull need to undo a condition by checking if an entity with a matching ID exists
U can use tags for this:

/tag <target1> add foo

/execute as <target2> positioned as <target1> if score @s obj = @n obj run /tag @n remove foo

/kill @e[tag=foo]```
warm glacier
#

/execute as @e[name="§9Blue P ortal",tag=spawned,rm=2] at @s if score @e [name="§9Blue Portal",tag=!spawned,c=1] ID = @s ID run kill @s

unique star
#

Just is slightly better practice bc it’s cleaner