#Left click event not being called in specific situation

1 messages · Page 1 of 1 (latest)

forest cradle
#

heres the situation: I use a command called /leftclick and it executes whatever. It is executeted when the player left clicks, and damages an entity
Problem: it cant execute when it is slightly far away from the targeted entity
so when its on the verge of touch an entity, it doesn't trigger

#

message link for more context: #skript-help-2 message

forest cradle
#

I'll simplify what I wrote

tranquil cloud
#

just send the first few lines then

forest cradle
#

no i'll simplify because my scripts is 90,000 lines long

tranquil cloud
#

the fuck

#

just uh send the event

forest cradle
#
function blahblah(n: text):
  broadcast "piss"
on left click:
  blahblah("die")
on damage:
  blahblah("die")
#

left clikc by itself works, but when damaging an entity, it doesnt work, so i added the damage event in and that works, BUT it doesn't work when im at the verge of damaging an entity

tranquil cloud
#

just send the revelent lines of your script in a text file and send it here

forest cradle
#

this is basically what it is

#

2 events

#

one effect

forest cradle
#

here i'll give you a diagram/screenshot

#

@tranquil cloud

tranquil cloud
#

cant u just check the target entity of the player by that point

#

yeah i believe it's a bug

#

the client is actually sending an attack packet i believe

#

but the server rejects it because they are too far away.. so no click event

#

i believe that's the behavior anyways

forest cradle
tranquil cloud
#

its a client to server bug so prob not

forest cradle
#

how come other servers are able to do this

#

and why does my client send damage packets even though im not supposed to be hitting the mob

tranquil cloud
#

its called a bug for a reason

forest cradle
tranquil cloud
#

yet they havent yet

#

I guess a quirk is a better name. I don't think you can change it without modifying the server

forest cradle
tranquil cloud
#

you could maybe use the arm swing animation packet if other people still see the arm swinging

#

does on damage do the same thing?

forest cradle
forest cradle
tranquil cloud
#

hmm.. then the arm swing packet is called entity animation on wiki vg I think

#

the specific arm swing identifier is a field within it

forest cradle
#

Do i search up "skript-reflect wiki" or..?

#

i've found this,

ARM_SWING
public static final PlayerAnimationType ARM_SWING```
#

dunno how to listen for this in skript

forest cradle
#

so if it was a client problem

tranquil cloud
#

oh really? how does it work

forest cradle
#

you'd hear the sound of an attack sound

#

but it counts as a left click on my client

tranquil cloud
#

usually sounds are server side. are you sure?

forest cradle
#

so theres somesort of hitbox restriction area left click cant get through

tranquil cloud
#

for example, punch someone while the server is lagging. i don't believe you will hear a sound

#

same reason cancelling the damage event means no sound

forest cradle
forest cradle
tranquil cloud
#

the damage sound? or the swinging sound?

forest cradle
tranquil cloud
#

hmm I think that proves my hypothesis more then... if there's only that sound because that one is clientside, but the other doesn't play because it's serverside

#

that'd mean the client is registering it but not the server (thus no sever sound)

#

I could totally be wrong and I'd be interested to learn more but it seems like that just is extra evidence for my theory

forest cradle
#

the client should be sending the left click packet

#

but its not

#

so i'm thinking theres another packet

#

either way i dont know how to listen from the left click packet

#

in skript reflect, and i've been searching for it

tranquil cloud
#

i'm saying that the client is lagging slightly behind the server. so it thinks the target player is still within reach. thus it sends a attack packet, not a left click packet. the server knows that the target player is actually out of reach. so it ignores the packet without doing any damage or calling any events

forest cradle
tranquil cloud
#

the client is the one that determines whether it's attacking or clicking, not the server

#

anyways you could try the interact packet

#

but what makes it such a big deal in this case anyways?

forest cradle
#

even if its in front of an entity

tranquil cloud
#

right, but what's your use case specifically

#

what makes it so critical in this case

forest cradle
#

because i have a huge roster of people, people are going to complain that "sometimes" their abilities dont activate, and when it doesnt, its really bad for content and combat

forest cradle
tranquil cloud
#

not really familiar with the packet addons these days so i'm not sure. i know skript-packet is pretty popular and uses pretty easy syntax which usually lines up with wiki vg pretty well

forest cradle
#

also i've made a discovery:

#

getting slightly off the hitbox, doesn't detect ANYTHING

forest cradle
#

SOLVED!!!!

#

Paper has an issue with detecting the distance of the player to a mob

#

mis matched information from server and client

#

use spigot or spigot paper

forest cradle
#

nvm

#

its not solved

#

problem is still present

#

:|

tranquil cloud
#

my friend i hate to say it but i think you are trying to solve an unsolvable problem

#

i'd love to see u prove me wrong but i think you might be searching for the impossible

#

the only fix i could think of requires editing ur server jar

forest cradle
#

but it literally should be possible.

forest cradle
forest cradle
#

i found why its happening and its such a stupid reason

#

still dont know how to solve but

#

skript calculates the damage range where left click is cancelled out while the damage event is present

#

BUT thats only for creative mode, which has a range of an extra one block

#

so both fields cancel out and you have a 1 block area around the entity where you cant do anything

#

it was a gamemode thing 🤦