Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages sent in entity right click event default to the clicked entity instead of the player #430

Closed
zmolahah opened this issue Mar 11, 2017 · 5 comments

Comments

@zmolahah
Copy link

zmolahah commented Mar 11, 2017

I've been looking for issues like this thinking someone must be experiencing the same issue, I've seen issues similar but not having the same problem as me

What Happens:
If I click on any entity (mobs, item frames, armour stands, etc...) with this code-

right click on entity:
	send "%clicked entity%"

nothing happens. No message or errors in console

What I've Tried:

  • Changing Spigot Version (currently using 1.11.2)
  • Changing bensku build, tried - dev25, dev24b, dev24
  • Changing code to-
right click:
	send "%clicked entity%"

this will say return none when right clicking blocks but nothing at all when right clicking an entity, no errors in console

  • removing all plugins other than skript and testing the code

I've seen issues like #290 but for me all entity right click events aren't triggering so I don't even get the chance to cancel

@TheBentoBox
Copy link
Member

Are you sure it's not triggering if that's the only code you wrote? It may be trying to send the message to the clicked entity. e.g. In the following scenario:

on damage of zombie:
    attacker is a player
    send "Hit zombie!"

The player won't see the message (I assume because Skript tries to send to the victim by default, or it silently fails). You have to do send "Hit zombie!" to the attacker to get the player to see that message.

Have you tried changing your send line to send "%clicked entity%" to the player, so that it specifically tries to send it to the player? I'm using a number of right click events on my public server with dev25 and they work fine and have always worked fine.

@zmolahah
Copy link
Author

zmolahah commented Mar 11, 2017

Yup,

right click on entity:
	send "%clicked entity%" to player

works... I never knew the right click on entity works like the damage event... when I've used that same code on older versions of Skript it worked - and also on block right clicks it sends to the player fine... a much more minor bug now that I've figured that out - thanks.

@bensku
Copy link
Member

bensku commented Mar 15, 2017

Very interesting that entity right click defaults to clicked entity. Makes no sense...

@TheBentoBox TheBentoBox changed the title Entity right click events not triggering Messages sent in entity right click event default to the clicked entity instead of the player Mar 16, 2017
@TheLimeGlass
Copy link
Contributor

As @TheBentoBox said.

Reason behind why this happens:
If there are two possible entity types. Such as attacker/victim or clicked entity/player You need to define to Skript which entity you want to send a message to.

So you have to use the correct Entity.

In

right click on entity:
	send "%clicked entity%"

The message is being sent to the clicked entity.

This is an event-value that is declared/setup like this. -1 takes priotity meaning past state (Which I think clicked entity is set too). You can also use former or future states to grab which enitty you want to message.

@bensku
Copy link
Member

bensku commented Apr 3, 2017

Allright, I have chosen to not change this - even if it would make more sense - to not break a lot existing scripts.

@bensku bensku closed this as completed Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants