local U = require "scriptbank\\utillib" function ai_dead_init( e ) Include( "utillib.lua" ) LoadGlobalSound( "audiobank\\music\\theescape\\default.ogg", 2) LoadGlobalSound( "audiobank\\music\\theescape\\battle.ogg", 1) LoopGlobalSound( 1 ) end local done = false local timer = 0 local enemyDistance = 3000 function ai_dead_main( e ) if done then return end if g_Time > timer then timer = g_Time + 1000 local aiAllDead = true local Ent = g_Entity[ e ] for _, v in pairs( U.ClosestEntities( enemyDistance, math.huge, Ent.x, Ent.z ) ) do if ai_bot_state[ v ] ~= nil then if g_Entity[ v ].health > 0 then aiAllDead = false break end end end if aiAllDead then StopGlobalSound( 1 ) LoopGlobalSound( 2 ) done = true end end end