defineProperty("generator_sound",globalProperty("giv_dataref/generator_sound"))
defineProperty("gen1_on",globalProperty("sim/cockpit2/electrical/generator_on[0]"))
defineProperty("gen2_on",globalProperty("sim/cockpit2/electrical/generator_on[1]"))
defineProperty("gen3_on",globalProperty("sim/cockpit2/electrical/APU_generator_on")) 
local criticalActionOccur = false

function update()
if (get(gen3_on) == 1 and not criticalActionOccur) then
	set(generator_sound, 1)
	criticalActionOccur = true
  end
  if get(gen3_on) == 0 then
  criticalActionOccur = false
  	set(generator_sound, 0)
  end
 
  end
