Game Object Animation programming

Hi … I just want to know how to programe objects animate at the start of my game and keep animating untill the player exit …Is there anyway to do this by using blueprint or c++
as an example : how to make lamps flicking when the player starts the game untill his exit
thanks.