Complex sentence: Water and direct sunlight are used to activate the attractant, which emits a smell to lure the flies.
Split into simpler sentences: Water and direct sunlight are needed to activate the attractant. When the attractant gets activated it emits a smell which lures the flies.