#(benjid) Get weapon from damage event
58 messages · Page 1 of 1 (latest)
(benjid) Get weapon from damage event
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.
Check the item in their hand if it's a held item.
Otherwise you'll need to consider a way of getting the item from a projectile launched.
!t playertag.item_in_hand
Returns the item the entity is holding, or air if none.
inventory
ItemTag
EntityTag.item_in_hand
but then they could use a bow and then quickly switch
!e entity damaged by entity
Entity
<entity> damaged by <entity> <entity> damaged (by <cause>) <entity> damages <entity>
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.
block:<block-matcher> to only run if the damage came from a block that matches the given material or location matcher.
when an entity is damaged.
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.
when the damager or damaged entity is an NPC. Cannot be both.
<context.entity> returns the EntityTag that was damaged.
<context.damager> returns the EntityTag damaging the other entity, if any.
<context.damager_block> returns the LocationTag of a block that damaged the 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...
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.
True - this adds switches in:<area> + location_flagged:<flag name>.
Examples too long to display... Check the website for more examples
Check if the projectile exists, if so then they fired it somehow.
!e projectile launch
Entity
projectile launched <entity> launched
when a projectile is launched.
<context.entity> returns the projectile.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
Entity
entity shoots bow <entity> shoots <item>
when an entity shoots something out of a bow.
when the entity that shot the bow is a player. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
when the entity that shot the bow is an NPC.
<context.entity> returns the EntityTag that shot the bow.
<context.projectile> returns a EntityTag of the projectile.
<context.bow> returns the ItemTag of the bow used to shoot.
<context.force> returns the force of the shot.
<context.item> returns an ItemTag of the shot projectile, if any.
<context.hand> returns "HAND" or "OFF_HAND" for which hand the bow was in.
ListTag(EntityTag) to change the projectile(s) being shot. (Note that in certain cases, determining an arrow may not be valid).
"KEEP_ITEM" to keep the projectile item on shooting it.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
i suppose i could check <context.projectile> to confirm it wasnt ranged?
Yes.
If the projectile doesn't exist, then grab the damagers hand item.
Interesting, there seems to be a way to get the weapon through java but I'm not experienced enough to figure that out.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/AbstractArrow.html#getWeapon()
declaration: package: org.bukkit.entity, interface: AbstractArrow
Is it possible to get the diarection a player is looking?
I want to shoot fireballs from them
i want to shoot fireballs in the diarection that the player is looking
!c shoot
entity
shoot [<entity>|...] (origin:<entity>/<location>) (destination:<location>) (height:<#.#>) (speed:<#.#>) (script:<name>) (def:<element>|...) (shooter:<entity>) (spread:<#.#>) (lead:<location>) (no_rotate)
Shoots an entity through the air, useful for things like firing arrows.
Shoots an entity through the air up to a certain height, optionally triggering a script on impact with a target.
The launch has three modes: arc, lead, and direct.
The "arc" mode calculates a launch arc to exactly hit the target location.
If you want to use this, specify the "height" argument as how high the arc should go, in blocks.
Do not specify "speed" or "lead".
You can optionally specify a custom "gravity" (hidden from syntax line intentionally) if you know what you're doing and really n...
Returns the location in front of this location based on pitch and yaw. Optionally specify a number of blocks to go forward.
math
LocationTag
This should do, depending on how far you want it to go.
Is it possible to replace certain blocks in a radius of a player?
!xy
Your question seems to be an XY Problem - you're asking about your attempted solution rather than your original problem.
Read in detail about the XY Problem here: http://xyproblem.info/
For an example of an XY Problem we've seen in Denizen, the question "how do I make an event for when a flag expires" has no answer, but the same question asked with full background detail will be something more like "I have this script: [LINK HERE], which sets a 3 minute cooldown flag on a player for when they use an ability. I want the player to be notified when the cooldown completes - how do I do this?" which we can then answer quite effectively (in this example, all that was needed was a simple wait command, no events or flag-listening or anything).
What are you trying to accomplish with all of these questions?
im making magic wands
Ah.
Yes, you can construct a cuboid of one locationtag to another.
!t location.to_cuboid
Returns a cuboid from this location to the specified location.
areas
CuboidTag
!t cuboidtag.expand
Expands the cuboid by the given amount, and returns the changed cuboid.
This will decrease the min coordinates by the given vector location, and increase the max coordinates by it.
Supplying a negative input will therefore contract the cuboid.
Note that you can also specify a single number to expand all coordinates by the same amount (equivalent to specifying a location that is that value on X, Y, and Z).
Not valid for multi-member CuboidTags.
CuboidTag
# If "my_cuboid" spans from 10,10,10 to 5,5,5 and gets expanded by 15 (15,15,15),
# then "my_expanded_cuboid" will span -10,-10,-10 (min) to 25,25,25 (max).
- note <cuboid[my_cuboid].expand[15]> as:my_expanded_cuboid
# If "my_cuboid" spans from 10,10,10 to 5,5,5 and gets expanded by 15,20,25,
# then "my_expanded_cuboid" will span -10,-15,-20 (min) to 25,30,35 (max).
- note <cuboid[my_cuboid].expand[15,20,25]> as:my_expanded_cuboid
Can expand it if necessary.
and how can i replace the blocks? I cant fine anything in the meta docs
!c modifyblock
world
modifyblock [<location>|.../<ellipsoid>/<cuboid>] [<material>|...] (no_physics/naturally:<tool>) (delayed) (<script>) (<percent chance>|...) (source:<player>) (max_delay_ms:<#>)
Modifies blocks.
Changes blocks in the world based on the criteria given.
Use 'no_physics' to place the blocks without physics taking over the modified blocks.
This is useful for block types such as portals or water. This does NOT control physics for an extended period of time.
Specify (<percent chance>|...) to give a chance of each material being placed (in any material at all).
Use 'naturally:' when setting a block to air to break it naturally, meaning that it will drop items. Specify the tool item that sho...
!t cuboidtag.blocks
Returns each block location within the area.
Optionally, specify a material matcher to only return locations with that block type.
ListTag(LocationTag)
# Spawns a debugblock to highlight every plank-type block in the area.
- debugblock <cuboid[my_cuboid].blocks[*planks]>
Modifyblock can take a list of blocks, so this tag should help.
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@humble cloud