function main(self)
    self:AnimationStep()

    if self.State == 0 then
		self:SetImage("CUSTOM_SPAWNER")
		self:SetAnimation("GAME_CYCLE100")
		PlaySound("CUSTOM_SPAWNER")
        self.detector = GetObject(3206)
		self.State = 1
	end

	if self.State == 1 and self.I == 6 then
        if self.Counter > 0 and self.Counter <= self.detector.ArtifactsCount then
            CreateObject{
                X = self.X,
                Y = self.Y,
                Z = self.Z - 10,
                name = "Artifact",
                image = self.detector.Artifacts[self.Counter].Image
            }
        else
            CreateObject{x=self.X, y=self.Y, z=self.Z-10, logic="HealthPowerup", image="GAME_HEALTH_POTION3"}
        end

		self.State = 2
	end

	if self.State == 2 and self.I == 11 then
		self:Destroy()
	end

end
