Background: I created an armor stand that spawn vex mobs whenever its score of 'lifetime' reaches 200 (lifetime is on a clock that resets back to 0 every time it reaches 400). The armor stand can spawn a max of 3 vex mobs before it is unable to spawn anymore. Each vex spawned has the exact same score of UUIDLeast and UUIDMost as the armor stand that spawned it (I am referring to a custom scoreboard objective named UUIDLeast/UUIDMost, not the NBT data tag).
Problem: I need to count how many vex with an equal UUIDLeast/UUIDMost score as the armor stand exist in the world. The number of vex in the world (with the same UUIDLeast/UUIDMost score as the armor stand that summoned it) should correspond to a scoreboard objective called 'constructs'. My problem is, I have no idea how I would go about doing this correctly.
My Initial Attempt:
I tried the following command, however it only accounts for new vex being spawned in. It does not take into account any vex that were killed/died.
execute as @s[scores={lifetime=200,constructs=..2}] if score @e[type=vex,tag=underworld_guardian,limit=1] UUIDLeast = @s UUIDLeast if score @e[type=vex,tag=underworld_guardian,limit=1] UUIDMost = @s UUIDMost run scoreboard players add @s constructs 1
** @s refers to the armor stand (this entire sequence of commands occurs in a function file.)
Example (For Clarity):
For example, if an armor stand summoned 3 vex (vex with the same UUIDLeast/UUIDMost score as the armor stand that spawned them), the armor stand should have a constructs score of 3. If a player kills one of the 3 vex, the constructs score on the armor stand should be 2.
Thanks for the help, however, the command did not work 100% correctly. When the first vex would spawn, the score of constructs would increase to 1, however when the second vex spawned, the score of constructs increased to 3. When the third vex spawned, the score of constructs increased to 6.
What I ended up doing was spawning each vex with a tag of 'spawned', and running the following command:
execute as @s[scores={lifetime=200,constructs=..2}] if score @e[type=vex,tag=underworld_guardian,tag=spawned,limit=1] UUIDLeast = @s UUIDLeast if score @e[type=vex,tag=underworld_guardian,tag=spawned,limit=1] UUIDMost = @s UUIDMost run scoreboard players add @s constructs 1
Immediately after the that command was run, the tag of 'spawned' was removed from the vex.
This takes care of the problem of adding to the score of constructs on the armor stand, however it does not remove 1 from 'constructs' when a vex dies. How would I go about doing this? Thanks in advance.
Thanks for the help, however, the command did not work 100% correctly. When the first vex would spawn, the score of constructs would increase to 1, however when the second vex spawned, the score of constructs increased to 3. When the third vex spawned, the score of constructs increased to 6.
What I ended up doing was spawning each vex with a tag of 'spawned', and running the following command:
execute as @s[scores={lifetime=200,constructs=..2}] if score @e[type=vex,tag=underworld_guardian,tag=spawned,limit=1] UUIDLeast = @s UUIDLeast if score @e[type=vex,tag=underworld_guardian,tag=spawned,limit=1] UUIDMost = @s UUIDMost run scoreboard players add @s constructs 1
Immediately after the that command was run, the tag of 'spawned' was removed from the vex.
This takes care of the problem of adding to the score of constructs on the armor stand, however it does not remove 1 from 'constructs' when a vex dies. How would I go about doing this? Thanks in advance.
I forgot to include a reset for the constructs objective. The command I supplied should work if you add a chain command block with a reset command so the armor stand's objective is reset before it starts counting the vex again.
So counting the vex works fine now, however I have encountered a slight new problem:
Commands:
execute as @e[type=vex,tag=underworld_guardian] if score @s UUIDLeast = @e[type=armor_stand,tag=underworld_gate,scores={lifetime=160},limit=1] UUIDLeast if score @s UUIDMost = @e[type=armor_stand,tag=underworld_gate,scores={lifetime=160},limit=1] UUIDMost run scoreboard players add @e[type=armor_stand,tag=underworld_gate,scores={lifetime=160},limit=1] constructs 1
scoreboard players set @s[scores={lifetime=200}] constructs 0 (@s refers to the armor stand as this command is ran in a function file playing from a specific type of armor stand)
These commands work and count the number of vex with the same UUIDLeast and UUIDMost objective as the armor stand, however if there is more than one armor stand with a tag of underworld_gate in the world, the command will not increment the constructs score on the armor stand with the exact same UUIDLeast/UUIDMost scores as the vex.
When there is only one armor stand in the world, this system works fine, but since the limit selector applies to the oldest entity in the world (I think), the command increments the oldest armor stand entity with the constructs score instead of the correct one.
Is there a way to change this /execute command so that it increments only the specific armor stand in question, and not an arbitrary armor stand?
Background: I created an armor stand that spawn vex mobs whenever its score of 'lifetime' reaches 200 (lifetime is on a clock that resets back to 0 every time it reaches 400). The armor stand can spawn a max of 3 vex mobs before it is unable to spawn anymore. Each vex spawned has the exact same score of UUIDLeast and UUIDMost as the armor stand that spawned it (I am referring to a custom scoreboard objective named UUIDLeast/UUIDMost, not the NBT data tag).
Problem: I need to count how many vex with an equal UUIDLeast/UUIDMost score as the armor stand exist in the world. The number of vex in the world (with the same UUIDLeast/UUIDMost score as the armor stand that summoned it) should correspond to a scoreboard objective called 'constructs'. My problem is, I have no idea how I would go about doing this correctly.
My Initial Attempt:
I tried the following command, however it only accounts for new vex being spawned in. It does not take into account any vex that were killed/died.
execute as @s[scores={lifetime=200,constructs=..2}] if score @e[type=vex,tag=underworld_guardian,limit=1] UUIDLeast = @s UUIDLeast if score @e[type=vex,tag=underworld_guardian,limit=1] UUIDMost = @s UUIDMost run scoreboard players add @s constructs 1
** @s refers to the armor stand (this entire sequence of commands occurs in a function file.)
Example (For Clarity):
For example, if an armor stand summoned 3 vex (vex with the same UUIDLeast/UUIDMost score as the armor stand that spawned them), the armor stand should have a constructs score of 3. If a player kills one of the 3 vex, the constructs score on the armor stand should be 2.
The Big Dog
Just fill in the armor stand part and tun this in a repeating command block:
this will execute from every vex with the matching scores and it will cause each of them to increment the score of the armor stand by 1.
Command block engineer // Developer // #TeamTrees
Thanks for the help, however, the command did not work 100% correctly. When the first vex would spawn, the score of constructs would increase to 1, however when the second vex spawned, the score of constructs increased to 3. When the third vex spawned, the score of constructs increased to 6.
What I ended up doing was spawning each vex with a tag of 'spawned', and running the following command:
execute as @s[scores={lifetime=200,constructs=..2}] if score @e[type=vex,tag=underworld_guardian,tag=spawned,limit=1] UUIDLeast = @s UUIDLeast if score @e[type=vex,tag=underworld_guardian,tag=spawned,limit=1] UUIDMost = @s UUIDMost run scoreboard players add @s constructs 1
Immediately after the that command was run, the tag of 'spawned' was removed from the vex.
This takes care of the problem of adding to the score of constructs on the armor stand, however it does not remove 1 from 'constructs' when a vex dies. How would I go about doing this? Thanks in advance.
The Big Dog
I forgot to include a reset for the constructs objective. The command I supplied should work if you add a chain command block with a reset command so the armor stand's objective is reset before it starts counting the vex again.
Command block engineer // Developer // #TeamTrees
So counting the vex works fine now, however I have encountered a slight new problem:
Commands:
execute as @e[type=vex,tag=underworld_guardian] if score @s UUIDLeast = @e[type=armor_stand,tag=underworld_gate,scores={lifetime=160},limit=1] UUIDLeast if score @s UUIDMost = @e[type=armor_stand,tag=underworld_gate,scores={lifetime=160},limit=1] UUIDMost run scoreboard players add @e[type=armor_stand,tag=underworld_gate,scores={lifetime=160},limit=1] constructs 1
scoreboard players set @s[scores={lifetime=200}] constructs 0 (@s refers to the armor stand as this command is ran in a function file playing from a specific type of armor stand)
These commands work and count the number of vex with the same UUIDLeast and UUIDMost objective as the armor stand, however if there is more than one armor stand with a tag of underworld_gate in the world, the command will not increment the constructs score on the armor stand with the exact same UUIDLeast/UUIDMost scores as the vex.
When there is only one armor stand in the world, this system works fine, but since the limit selector applies to the oldest entity in the world (I think), the command increments the oldest armor stand entity with the constructs score instead of the correct one.
Is there a way to change this /execute command so that it increments only the specific armor stand in question, and not an arbitrary armor stand?
The Big Dog
Then simply remove the limit argument. The command I wrote has no use if you're only going to target one armor stand.
Command block engineer // Developer // #TeamTrees