-- LUA Script - precede every function and global member with lowercase name of script function ai_sound_test_init(e) CharacterControlLimbo(e) local AIObjNo = g_Entity[ e ].obj AISetEntityControl( AIObjNo, AI_MANUAL ) SetCharacterSoundSet( e ) end local soundPlaying = false local soundList = { "onAggro", "onDeath", "onHurt", "onHurtPlayer", } -- "onAlert", "onIdle", "onInteract" are empty for the default "soldier" sound set function ai_sound_test_main(e) PlayerDist = GetPlayerDistance(e) if PlayerDist < 200 then if not soundPlaying then local sound = soundList[ math.random( 1, #soundList ) ] PlayCharacterSound( e, sound ) soundPlaying = true PromptDuration( "Sound " .. sound, 1500 ) end else soundPlaying = false end end