#How do I make mobs around me execute the /damage command?

1 messages ยท Page 1 of 1 (latest)

upbeat crest
#

I want to add damage to all mobs around me, but I don't want to take damage

patent olive
#

@upbeat crest u want it with command or with script?

upbeat crest
#

@patent olive

system.runInterval(() => {
world.getPlayers().forEach((player) => {
  if (lib.scoreboard.get(player, "black_leg_spin") >= 4 && lib.scoreboard.get(player, "black_leg_spin") <= 24) {
player.runCommandAsync(`damage @e[r=2.5] ${(lib.score(player, "dmg")) + 3} entity_attack entity "${player.nameTag}"`)
}
});
}, 2);
upbeat crest
#

How to solve?

patent olive
upbeat crest
#

I don't want the player executing the command to receive the damage

patent olive
#
system.runInterval(() => {
world.getPlayers().forEach((player) => {
  if (lib.scoreboard.get(player, "black_leg_spin") >= 4 && lib.scoreboard.get(player, "black_leg_spin") <= 24) {
player.runCommandAsync(`damage @e[r=2.5,type=!player] ${(lib.score(player, "dmg")) + 3} entity_attack entity "${player.nameTag}"`)
}
});
}, 2);
#

Try it

#

This is should work but there's some things bad like he can give a damage to another players @upbeat crest

#

But you can solve it with give the player a tag with hes name and check if the player has the name if the same same don't give him a damge and if have another name give him the damage

upbeat crest
patent olive
#

Ok wait give me a min

upbeat crest
#

I don't want the player executing the command to take damage

patent olive
#

Try it @upbeat crest

system.runInterval(() => {
world.getPlayers().forEach((player) => {
    player.addTag(player.name);
  if (lib.scoreboard.get(player, "black_leg_spin") >= 4 && lib.scoreboard.get(player, "black_leg_spin") <= 24) {
player.runCommandAsync(`damage @e[r=2.5,tag=!${player.name}] ${(lib.score(player, "dmg")) + 3} entity_attack entity "${player.nameTag}"`)
}
});
}, 2);```
upbeat crest
#

I have an idea

#
  if (lib.scoreboard.get(player, "black_leg_spin") >= 4 && lib.scoreboard.get(player, "black_leg_spin") <= 24) {
player.runCommandAsync(`damage @e[r=2.5,name=!${player.name}] ${(lib.score(player, "dmg")) + 3} entity_attack entity "${player.nameTag}"`)
upbeat crest
#

I'll try

patent olive
#

Look at the first i add the tag to the player

#
player.addTag(player.name);```
#

Or u can use the name to

#
@e[name=!${player.name}]```
oblique pivot
unkempt cave
glacial halo
#

you can run commands from the entity it self and use @s
or use damage method

patent olive
oblique pivot
unkempt cave
#

no

oblique pivot
#

how

#

well more of why

#

Like I get doing that changing the it won't effect the orginal but like why dose that matter

nimble patrol
# patent olive ๐Ÿ™‚ I don't know, but I apply the ideas that come to me for the first time
applyDamage(amount: number, options?: EntityApplyDamageByProjectileOptions | EntityApplyDamageOptions): boolean

Applies a set of damage to an entity.

Parameters
amount: number

Amount of damage to apply.

options?: EntityApplyDamageByProjectileOptions | EntityApplyDamageOptions = null

Additional options about the source of damage, which may add additional effects or spur additional behaviors on this entity.

Returns boolean - Whether the entity takes any damage. This can return false if the entity is invulnerable or if the damage applied is less than or equal to 0.```
#

Microsoft docs has some info

#

This way we can use the native not just a command

oblique pivot
patent olive
umbral shard
patent olive
umbral shard