#Apply an effect within a distance of a player while exempting the player?

155 messages · Page 1 of 1 (latest)

astral havenBOT
#

(plenjy) Is there an "on goat horn use" or an "on item use" 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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

vital breach
#

I think it’s

#

!e player raises|lowers|toggles item

lofty acornBOT
# vital breach !e player raises|lowers|toggles item
Group

Player

**WARNING**

For 'lowers', the item may be tracked incorrectly. Prefer 'player lowers item' (the generic item form) for a 'lowers' event (similar for 'toggles').
Also be aware this event may misfire in some cases.
This event and its data are more accurate on Paper servers.

Event Lines

player raises|lowers|toggles <item>

Switches

reason:<reason> to only process the event if the reason matches the input.

Triggers

when a player starts or stops holding up an item, such as a shield, spyglass, or crossbow.

Has Player

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

Context

<context.state> returns an ElementTag(Boolean) of whether the player raised or lowered the item.
<context.held_for> returns a DurationTag of how long the player held the item up for (only on Paper).
<context.hand> returns an ElementTag of the hand that the player is raising or lowering (only on Paper).
<context.item> returns an ItemTag of the item that the player is raising or lowering (only on Paper).
<context.reason> returns the reason for a state change. Can be: raise, lower, swap, hold, drop, quit, death.

Has Known Location

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

karmic mesa
#

How would I go on applying an effect within... lets say a 5 block area of the player?

#

on all the entitys within that range except the caster

#

Apply an effect within a distance of a player while exempting the player?

lilac frost
#

!t find_entities

lofty acornBOT
lilac frost
#

!t listtag.exclude

lofty acornBOT
lilac frost
#

you'll exclude the player

karmic mesa
#

thanks

#

So I would do

#
  • cast slow duration:1 <LocationTag.find_entities[(<player>)].within[<5.5>].exclude[1]> hide_particles no_icon
#

?

lilac frost
#

what no

#

you'd have to provide a valid location in the place of LocationTag

#

the find_entities takes an input like find_entities[zombie]

#

same thing for the within, that goes like within[10]

#

and, the exclude

#

im not sure where you took that 1 from

#

lets think through it. if you get all entities within 5 blocks of you, let's say it returns a list like this:
(this is NOT how it would work, it's purely pseudo-code just to help you see it)
li@zombie|skeleton|another_player|you

#

1 isnt here, you cant exclude it from this list

#

while exempting the player

so, you'll want to exclude the player

karmic mesa
#

ahh okay so

#

Would ~ ~ ~ work as a loaction?

lilac frost
#

nope

#

!t entitytag.location

lofty acornBOT
lilac frost
#

<player> is a valid entitytag

#

<player.location> would be the equivalent of ~ ~ ~, it gets the exact position the player is in

karmic mesa
#

<<player.location>.find_entities[player].within[5].exclude[<context.player>]>

#

Would this work?

#

I'm pretty new to denizen so I'm sorry if I don't fully understand

lilac frost
#

well, firstly i assumed you have already read the guide, but you dont seem to grasp the idea of how tags work, so i'm going to plug the guide for you

#

!guide

lofty acornBOT
lilac frost
#

go read it my guy

karmic mesa
#

I did

#

Il read it again

lilac frost
#

!g your first tag

lofty acornBOT
lilac frost
#

this'll come in hand

karmic mesa
#

I did read that -_-

old cypress
#

Do you still need help?

karmic mesa
#

yes please

old cypress
#

!paste

lofty acornBOT
old cypress
#

Post your script so we see where you're at please

karmic mesa
#

alright

karmic mesa
old cypress
#

What text-editor do you use to edit this file?

karmic mesa
#

Vs code

lilac frost
#

and do you have the denizen extension for it?

trim goblet
#

you forgot on/after

#

your script editor will indicate this

lilac frost
trim goblet
trim goblet
#

if you don't see it, you should install the DenizenScript extension as mentioned

trim goblet
lilac frost
#

it should be giving plenty

karmic mesa
#

Not by my comupter currently, will check later

lilac frost
#

bruh!

#

!notathome

#

!info notathome

lofty acornBOT
lilac frost
#

!info nothome

lofty acornBOT
# lilac frost !info nothome
Info: nothome

We sometimes see users opening support threads or replying to them while not able able to test things.

This is often revealed in messages like "I'm not home right now and wanted to ask", or "I can't access my server but I think I remember the details", ...

This often leads to one of two problems:
• The user asks questions they could have answered themself if they were at their server. This is a problem because it wastes the limited resource of our expert helper team on simple questions that would never have been asked if it were not for the fact that the user wasn't near their server.
• A helper enters the thread to actively assist but is unable to provide any help because the user is unable to actually act on any responses. Many threads start with requests for basic followup information such as server logs or other demonstrative data from the server, that of course they can only provide when they have access to that data.

In both cases, helper time is wasted and the user don't actually get to act on any responses faster than they would have been able to had they simply waited til they were able to access their server before asking for help.

trim goblet
#

given the above, just review this when you do get home

#

you've been given everything you need to correct this when you do

karmic mesa
#

Alright

#

I think I figured out my mistake

#

Il try it

lilac frost
#

what is it like right now

karmic mesa
#

goat_slowness:
type: world
events:
after player raises goat_horn:
- cast slow duration:1 <player.location.find_entities[player].within[5].exclude[<context.player>]> hide_particles no_icon

#

VS code detected no problems

old cypress
#

!paste

lofty acornBOT
old cypress
#

Paste it on the paste site

karmic mesa
old cypress
#

Okay step 2 is, if VScode doesn't detect a problem

#

Your console will!

#

!debug

lofty acornBOT
# old cypress !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

karmic mesa
#

Alrighty

old cypress
#

Okay the event doesn't fire. Did you use a goat_horn?

karmic mesa
#

yep

#

Il try changing it to "on"

#

hmm

#

Still didn't fire

old cypress
#

It's probably not the correct event for using goat_horns

karmic mesa
#
goat_slowness:
    type: world
    events:
       on player raises goat_horn:
         - cast slow duration:1 <player.location.find_entities[player].within[5].exclude[<context.player>]> hide_particles no_icon
#

It should work

karmic mesa
old cypress
#

Yeah as I said thats probably not the correct event.

lilac frost
#

such as a shield, spyglass, or crossbow
maybe its not listed here? but i doubt it

karmic mesa
#

I don't see a reason why goat horns shouldn't be listed among that

#

Is there an "on right click" event?

old cypress
#

!e clicks block

lofty acornBOT
# old cypress !e clicks block
Group

Player

**WARNING**

this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.

Event Lines

player (right|left) clicks <block>

Switches

with:<item> to only process the event if a specified item was held.
using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
type:<material> to only run if the block clicked matches the material input.

Triggers

when a player clicks on a block or in the air.

Has Player

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

Context

<context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type <@link url https://hub.spi...
<context.hand> returns an ElementTag of the used hand.

Has Known Location

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

Cancellable

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

karmic mesa
#

That required the player to click at a block tho

old cypress
#

You can click on air

#

air is also a block

karmic mesa
#

oh

old cypress
#

You probably want a ratelimit on it, otherwise it fires when a player does not use a goat_horn but right click with it.

#

!c ratelimit usage

lofty acornBOT
# old cypress !c ratelimit usage
Group

queue

Syntax

ratelimit [<object>] [<duration>]

Short Description

Limits the rate that queues may process a script at.

Use to show a message to a player no faster than once every ten seconds.
- ratelimit <player> 10s
- narrate "Wow!"
lilac frost
#

if you use plaintext "block", it will fire no matter which block you aim it at

karmic mesa
#

So just "player right clicks block"?

old cypress
#

Well you'd want to only fire if a player uses a goat_horn.

#

This is explained here:

#

!guide first world

karmic mesa
#

ik

#

I just wanted to make sure I got the base right

#

Now I have another problem

#

It fires all good and thing and applies slowness

#

But also to the caster

old cypress
lofty acornBOT
# old cypress !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

karmic mesa
#

mhm

old cypress
#

Oh look an error!

karmic mesa
#

oh

#

Yup

old cypress
#

context.player doesn't exist.

#

!e clicks block

lofty acornBOT
# old cypress !e clicks block
Group

Player

**WARNING**

this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.

Event Lines

player (right|left) clicks <block>

Switches

with:<item> to only process the event if a specified item was held.
using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
type:<material> to only run if the block clicked matches the material input.

Triggers

when a player clicks on a block or in the air.

Has Player

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

Context

<context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type <@link url https://hub.spi...
<context.hand> returns an ElementTag of the used hand.

Has Known Location

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

Cancellable

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

karmic mesa
#

Fixed it

old cypress
#

How so?

karmic mesa
#

<player>

old cypress
#

Perfect :)

karmic mesa
#

:D Thanks a lot, not only have you helped me make a cool combat feature for my server, but you also helped me learn

old cypress
#

but you also helped me learn
That's the goal here

karmic mesa
#

You're also way more patient than the time I had to deal with the luckperms support server with storage errors a couple years back

#

God that was an awful experience

distant latchBOT
#

@karmic mesa

Thread Close Blocked

Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.