-- LUA Script - precede every function and global member with lowercase name of script + '_main' g_ballsLeft = {} local entityTimer = {} local random = math.random math.randomseed(os.time()) -- make sure random number generator is seeded random(); random(); random() function ball_drop_init(e) Hide(e) end function DropBall(e) local myTimer = entityTimer[e] myTimer.frozen = false Show(e) end function ball_drop_main(e) local myTimer = entityTimer[e] local timeNow = g_Time if myTimer == nil then local Ent = g_Entity[e] -- initialisation entityTimer[e] = {value = timeNow + 5000 + random() * 10000, frozen = true, x = Ent.x, y = Ent.y, z = Ent.z} g_ballsLeft[e] = {showing = false} return end if timeNow > myTimer.value then local bl = g_ballsLeft[e] if not bl.showing then if BD_ShowDecal ~= nil then BD_ShowDecal(e, myTimer.x, myTimer.y, myTimer.z) end bl.showing = true end end if myTimer.frozen then CollisionOff(e) ResetPosition(e, myTimer.x, myTimer.y, myTimer.z) CollisionOn(e) end end