#Not detecting variable.attack_time from another entity

1 messages · Page 1 of 1 (latest)

little raft
#

I used this function to define v.player v.player = 0; for_each(t.player, q.get_nearby_entities(5, 'minecraft:player'), {v.player = t.player; break});, then I used v.player -> v.attack_time > 0.1 but its not working, it work with another query but not with v.attack_time, someone have a solution?

languid solar
little raft
languid solar
#

Then why ur using q.get_nearby_entities

little raft
languid solar
#

I need to know the context to help

little raft
#

its a dummy entity

languid solar
#

So it’s another entity which is testing if the nearby player is attacking

little raft
#

im trying to detect from the dummy entity when the player attack

languid solar
#

Just set “variable.attack_time” to public inside your player client

little raft
#

that would make the addon incompatible in the resource pack

languid solar
#

That’s the solution tho

little raft
#

Isn't there another way to detect when an entity attack?

languid solar
#

You could always just do it on the player side, like test if attacking and then trigger event on the nearest entity

little raft
#

then I will have to settle for the system of hitting the dummy entity directly :/

little raft
rapid peak
#

I think the last part may be wrong, but not sure how the break is playing into it. Anyways, I transferred it something I was given before...

v.player = 0; for_each(t.player, q.get_nearby_entities(5, 'minecraft:player'), {v.player = t.player->v.attack_time > 0.1});

Not sure right tho, but notice the diff in the last part...

languid solar
#

you need to set public for that variable first or else any other can't access it anyway lol

#

This is only for variables, queries will work fine without that