#Can you detect which player you are attacking

8 messages · Page 1 of 1 (latest)

opaque ferry
#

Can you detect which player you are attacking?

austere viperBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

dim basaltBOT
#

╰( ͡° ͜ʖ ͡° )つ──☆:・゚˜”°•.˜”°• Many Help •°”˜.•°”˜*
Please provide a description of your issue with as much detail as possible. If you have an issue with a script provide the script. Explain what you can see happening and what you expect to happen. Be specific!

Tell us what is happening, we already know it "doesn't work".
Avoid using words like "it", tell us exactly what "it" is.
Don't assume anyone knows what you are talking about, be specific.

Provide screenshots or video of the issue if possible.

Provide the log.

static stratus
#

What do you actually want to do?

#

I assume all you need is event.target but I'm not sure what you're actual problem is

opaque ferry
#

I want to know if you can detect what entity you are attacking. So if i attack a player. iwant to have the name of him

jade trout
#

that depends on the context. if you are in the entity attack/hurt event, then event.target.name. but that will be a component (not normal text) and also will get entity names as well, not just player names, so depending on what exactly you are trying to do the solution might be a lot more than just that, hence why Auseawesome asked for more information

opaque ferry
# jade trout that depends on the context. if you are in the entity attack/hurt event, then ev...

i found an alternative now. Im kinda new to kubejs and idk why but my sword i made wont get the attack Damage i gave it.

ItemEvents.toolTierRegistry(event => {
  event.add('watcher', tier => {
    tier.attackDamageBonus = 1123.0
    tier.speed = 1.0
    tier.uses = 25000
    tier.enchantmentValue = 140
    tier.repairIngredient = '#forge:ingots/gold'
  })
})


// Register the custom sword item
StartupEvents.registry('item', event => {
    event.create('watcher_claymore', 'sword') // Internal ID
      .tier('watcher')
      .fireResistant(true)
      .glow(true)
      .displayName('Watcher Claymore ©') // In-game display name
      .attackDamageBaseline(5.0)
      .speedBaseline(1.0) // Attack speed
      .texture('kubejs:item/watcher_claymore') // Path to base texture
});