local U = require "scriptbank\\utillib" local random = math.random local sin = math.sin local cos = math.cos local timerMin = 3000 local timerMax = 6000 local aiTimer = {} function ai_passive_init( e ) Include("utillib.lua") CharacterControlStand( e ) end function ai_passive_main( e ) local aiTime = aiTimer[ e ] if aiTime == nil then aiTimer[ e ] = g_Time + random( 0, timerMax ) return end if U.PlayerCloserThan( e, 200 ) then local Ent = g_Entity[ e ] AIEntityGoToPosition( Ent.obj, Ent.x, Ent.z ) AIEntityStop( e ) RotateToPlayer( e ) elseif g_Time > aiTime then aiTimer[ e ] = g_Time + random( timerMin, timerMax ) local angle = random( 2 * math.pi ) local range = random( 300, 500 ) local Ent = g_Entity[ e ] local tempx = Ent.x + cos( angle ) * range local tempz = Ent.z + sin( angle ) * range AIEntityGoToPosition( Ent.obj, tempx, tempz ) end end