#(Doxa) Hitting entities ( Checking hit )

1 messages · Page 1 of 1 (latest)

hybrid harness
#

How would I check if an armor stand is being hit by the player

mint spadeBOT
#

(Doxa) Hitting entities ( Checking hit )

mint spadeBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

hybrid harness
#

an invisible armorstand if that changes anything btw

crude barn
#

!event entity damaged

hidden kayakBOT
# crude barn !event entity damaged
Group

Entity

Event Lines

<entity> damaged by <entity> <entity> damaged (by <cause>) <entity> damages <entity>

Switches

with:<item> to only process the event when the item used to cause damage (in the damager's hand) is a specified item.
type:<entity> to only run if the entity damaged matches the entity input.

Triggers

when an entity is damaged.

Has Player

when the damager or damaged entity is a player. Cannot be both. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Has NPC

when the damager or damaged entity is an NPC. Cannot be both.

Context

<context.entity> returns the EntityTag that was damaged.
<context.damager> returns the EntityTag damaging the other entity, if any.
<context.cause> returns an ElementTag of reason the entity was damaged - see !language damage cause for causes.
<context.damage> returns an ElementTag(Decimal) of the amount of damage dealt.
<context.final_damage> returns an ElementTag(Decimal) of the amount of damage dealt, after armor is calculated.
<context.projectile> returns a EntityTag of the projectile, if one caused the event.
<context.damage_type_map> returns a MapTag the damage dealt by a specific damage type with keys: B...
<context.was_critical> returns 'true' if the damage was a critical hit. (Warning: this value is ca...

Determine

ElementTag(Decimal) to set the amount of damage the entity receives.
"CLEAR_MODIFIERS" to zero out all damage modifiers other than "BASE", effectively making damage == final_damage.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

Examples

Examples too long to display... Check the website for more examples

crude barn
#

this is what fires when you punch/attack an armor_stand

hybrid harness
#

ah sweet

crude barn
#

but uh, i think i heard invisibility makes that not work

#

you'd want to try and see

hybrid harness
#

o yikes lol

#

ill try

#

oh wait

#

is there a way to try without activating another script

#

im running this in a while loop

#

or would i go about making a different type of script
then running that script within the while loop

echo tusk
#

wot

#

you cant run events on a while loop

hybrid harness
#

ye

#

would I make a task script

#

and run it that way

echo tusk
#

oh wait. you want to check if the armor stand is being hit WHILE the while thing is going off?

hybrid harness
#

ye

#

ive only ever used world scripts so ill try out the other ones

echo tusk
#

it wont work like how you're thinking

hybrid harness
#

how would i go about it then

echo tusk
#
  1. you should put the world script with a flagged: switch
  2. before your while command, flag the player with a specific flag used only for this
  3. after your while ends, take that flag off the player
#

so kinda like this

- flag <player> myuniqueflag
- while thing:
  - do thing
- flag <player> myuniqueflag:!
on armor_stand damaged by player flagged:myuniqueflag:
- do thing
hybrid harness
#

aaah

#

thats rlly useful thanks

echo tusk
#

np

hybrid harness
#

the event doesnt seem to be activating

#

wait i got another idea, ill try left/right click checking on the armor stand

#

might work because its invisible and doesnt take dmg

echo tusk
#

if you copy pasted my "script", i dont know if armor_stand is the correct armor stand thing

#

so that might be why

hybrid harness
#

hm ill check that as well

#

btw how do i check a specific armorstand

#

i have one saved
save:army

#

how would i implement that in the event line

crude barn
#

youll probably need to flag the entity and then check if the hit entity has the flag

hybrid harness
#

hm

#

ill give it a try as well

#

okay so I dont the damage down

#

when you save an entity does it only save for the one event script

#

or the whole world script

crude barn
#

it saves it for that queue

hybrid harness
#

with save:name

echo tusk
crude barn
#

unless you flag it

hybrid harness
#

queue?

crude barn
#

when your event fires, or you run a script, that script runs every command set up in one queue

#

when the queue ends, the saved data that isn't flagged is removed

hybrid harness
#

ah k

#
  • if <context.entity> == flag:army_stand:
    - narrate "yay"
    i know this is horribly wrong
#

dont know if thats how you implement the flag

echo tusk
#

depends on where you stored the flag

#

if its stored on the player, <player.flag[flagname]> will return it's value

#

if its on the server, <server.flag[flagname]>

hybrid harness
#

i stored it as:

  • flag <[entry[army].spawned_entity]> army_stand
    and check for it with:
    if <context.entity>.has_flag[army_stand]>:
echo tusk
#

yeah that should work,,, but you have one too many >

hybrid harness
#

ah

echo tusk
#

<context.entity>.has_flag[army_stand]>

hybrid harness
#

wait

#

can you flag entities other than the player

#

like an armorstand

#

or am i flagging this entity wrong

  • flag <[entry[army].spawned_entity]> meteorite
#

ah syntax

hybrid harness
#

i got a big problem i think

#

I cant use
on player damages armor_stand flagged:damaging_armor_stand:
because the armor stand doesnt take damage (invisible)

#

and i cant use
on player left clicks armor_stand flagged:damaging_armor_stand:
because armor stands dont take that input

hybrid harness
#

ye i got that

echo tusk
#

you can flag entities, areas, the server itself

hybrid harness
#

only problem atm is the "on"

#

i can figure out which event to execute on

echo tusk
#

huh not taking damage when invisible, i didnt know that

#

uuhhhhhhh

#

!e fake entity

hidden kayakBOT
# echo tusk !e fake entity
Required Plugins or Platforms

Paper

Group

Paper

Event Lines

player (right|left) clicks fake entity

Triggers

when a player clicks a fake entity, one that is only shown to the player and not tracked by the server.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.entity> returns the EntityTag of the entity that was clicked. Note that this entity is no...
This will return null if the player clicks a fake entity that was not spawned via !command fakespawn.
<context.hand> returns an ElementTag of the hand used to click.
<context.click_type> returns an ElementTag of the click type (left/right).

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

echo tusk
#

there's this

#

but idk if'd trigger if its invisible

#

no ideas otherwise

hybrid harness
#

ill try

#

nop

cedar daggerBOT
hybrid harness
#

ye i have no clue what to do now

#

only if there was a way to damage invisible armorstands

echo tusk
#

no clue either, we gonna have to wait until a wiser entity shows up

hybrid harness
#

I got another worry

#

i reckon ignore the left click idea

hot thistle
#

For left click, you can use the event "on animated", which fired whenever your left arm swings. For right click, you can just use "on right click". Then, you just need to do a raytrace to see if there's an invisible armor stand in front of you, about 4 blocks away (which is the reach of a player in survival, I believe)

hybrid harness
#

sounds hard ill come back to it lol

#

am i going crazy or should this be adjust everytime an event happens
define meteorite_dmg:+:1

#

everytime that run is should be 1,2,3,4,etc
right?

hot thistle
#

define is only for the queue. Once it's done, it's as though the definition no longer exists

#

If you want it to persist, you need to use a flag

hybrid harness
#

ahh

#

wait next problem

#

i want to have a flag but without it overlapping other flags

#

e.g
I want a counter for multiple blocks not 1, and they overlap with flaps