I believe I borrowed my pike script from one of christopho's games, and I don't recall having any issues with it.
https://github.com/wrightmat/zbom/blob/master/data/enemies/pike_detect.lua
https://github.com/wrightmat/zbom/blob/master/data/enemies/pike_detect.lua