Hey guys,
I'm having some problems writing my first script. It is a very basic chicken killer, as I'm just trying to understand the basics of script writing. I understand the logic behind it, but I got stuck when I couldn't get the getCamera().toEntity() to work. I'm pretty sure this is user error, but I can't get my head around exactly WHAT I'm doing wrong.
The code
The logger
When there a chickens on my screen, I works just fine. It is when I start the script with the camera away from any chickens, that is gets stuck in the loop.
Following what I know: "Not in combat" was printed, so we are not in combat; "Found a chicken" was not printed, instead "No chicken found" was logged, which means chicken equaled null and therefore the block of code after } else { was activated; while the script DID log "No chicken found" it DID NOT move the camera to a chicken which was reachable etc.
Is my logic flawed? What I'm I doing wrong?