-- Global Variables walkingRouteOne = true -- True if thestranger is walking route one exitPositionReached = false playerInLock = false hangarReached = false -- Returns the distance between (x1,x2,x3) and (y1,y2,y3) function dist( x1,x2,x3, y1,y2,y3 ) return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) end function stopWalkRouteOne(timestep) walkRouteOne = false return true end function observePlayer() playerX = Player:getAbsCoorX() playerY = Player:getAbsCoorY() playerZ = Player:getAbsCoorZ() if dist( playerX,playerY,playerZ,161.76,49,358.87 ) < 60 then playerInLock = true end end routeOneProgrammed = false function walkRouteOne(timestep) if not routeOneProgrammed then io.write("Guard called \n") guard:walkTo(-154.592667, 80.000000, 231.381805) routeOneProgrammed = true end end function goToExitPosition(timestep) return false end function goToHangar(timestep) return false end function waveToSpaceship(timestep) end function tick(timestep) --io.write("Guard called \n") observePlayer() if walkingRouteOne then walkRouteOne(timestep) end if not walkingRouteOne and not exitPositionReached then exitPositionReached = goToExitPosition(timestep) end if playerInLock and exitPositionReached then hangarReached = goToHangar(timestep) end if hangarReached then waveToSpaceship(timestep) end return false end