Access to the actor list

I want to make a function to check the actors in the level but only some of them in each tick, to destroy / created based in the distance to the player.

There are any way to check the actors without using the foreach command? The engine stores in any array that can be checked ?

Perhaps doing a unique foreach at the start and filling an array, but this needs to be updated every time an actor is created or destroyed.

Yeah, I think you would have to make your own array and iterate through that if you wanted to have control over exactly which actors you’re checking.

But if you take a look at the iterators available to you at UDK | UnrealScriptIterators you might find one that narrows it down well enough.

I made my own arrays stored in the playercontroller for this very same purpose (though I just disable, not destroy/create)

Currently I disable bots too, but 300 sleeping bots takes about 1 ms per tick, and probably in the final game will be about 1000, so there are 3 ms wasted.

When the bots are sleeping, their pawn state is none, no collision, hidden (and their components and weapons too), tick disabled, ignore all events, and only the controller is runing a state with a large sleep and a check for the distance.

In my tests, the controllers have a cost insignificant, so are the pawn class what are wasting ms.

The idea is to make an actor that checks a few bots per tick, destroying them when they are far and copy their variables in an array. Then spawn them when they are near and restore the variables. The key is to do only a few checks per tick. If not, probably will be better to disable.
The actor can be used too for other items in the game, weapons, etc. And with some modifications can be used as save game method too.