Hi friends. I'm having trouble getting pathfinding to work with skQuery. I want a selected mob to pathfind to a selected destination. My code is reloading successfully with no errors, but it just doesn't work. I'll put my code down below.
on right click with stick:
if name of targeted entity is set:
message name of targeted entity to player
set {%player%.selected_sim} to name of targeted entity
on left click with stick:
cancel event
if {%player%.selected_sim} is set:
set {%player%.target_block} to location at block above targeted block
loop all entities:
if name of loop-entity is "%{%player%.selected_sim}%":
while loop-entity exists:
make loop-entity pathfind to {%player%.target_block} with speed 1
wait 1 tick
The only part of this that works is the message. As I said, the code reloads fine; but the console gave me a "Severe error: something went horribly wrong with Skript" message when I tried to use it. I've tried this on both 1.17 and 1.18 since skQuery is technically only updated for 1.17--but I have the same problem regardless. Anybody know what the problem is?
Thanks for any help!
on right click with stick:
if name of targeted entity is set:
message name of targeted entity to player
set {%player%.selected_sim} to name of targeted entity
on left click with stick:
cancel event
if {%player%.selected_sim} is set:
set {%player%.target_block} to location at block above targeted block
loop all entities:
if name of loop-entity is "%{%player%.selected_sim}%":
while loop-entity exists:
make loop-entity pathfind to {%player%.target_block} with speed 1
wait 1 tick
The only part of this that works is the message. As I said, the code reloads fine; but the console gave me a "Severe error: something went horribly wrong with Skript" message when I tried to use it. I've tried this on both 1.17 and 1.18 since skQuery is technically only updated for 1.17--but I have the same problem regardless. Anybody know what the problem is?
Thanks for any help!