-- LUA Script - precede every function and global member with lowercase name of script + '_main' local U = require "scriptbank\\utillib" local rad = math.rad function move_away_init( e ) Include( "utillib.lua" ) end function move_away_main( e ) if U.PlayerCloserThan( e, 300 ) then local aX, aY, aZ = rad( g_PlayerAngX ), rad( g_PlayerAngY ), rad( g_PlayerAngZ ) local xo, _, zo = U.Rotate3D( 0, 0, 10, aX, aY, aZ ) local Ent = g_Entity[ e ] xo, zo = xo + Ent.x, zo + Ent.z local boxx, boxz = U.RandomPos( 5, xo, zo ) boxy = GetGroundHeight( boxx, boxz ) + 1 CollisionOff( e ) PositionObject( Ent.obj, boxx, boxy, boxz ) CollisionOn( e ) end end