OK, it's a difficult subject to summarise here, but I'll have a bash at it...
As you mentioned in your post, the secret is to use arrays - DB's universal answer to all problems!
OK, let's say you have 24 NPC's in your game and are object numbers 1 to 24.
Assuming that you know what you are going to do with them (AI-wise), then you would normally have a Do..Loop as follows:
For N=1 To 24
Rem Move Object N wherever
Next N
OK, to do the same thing to a number of them at the same time, you would need to group them when they are created using an array. For example, you could have 6 groups of 4 in which case you would use the following:
Dim NPC_Group(24)
When you create the NPC's, you could set the array for each one to the group that it's in. Eg if NPC's 1, 2, 3 and 4 are in group 1 then say:
NPC_Group(1)=1
NPC_Group(2)=1
NPC_Group(3)=1
NPC_Group(4)=1
If 5, 6, 7 and 8 are in group 2 then use:
NPC_Group(5)=2
NPC_Group(6)=2
NPC_Group(7)=2
NPC_Group(8)=2
and so on to assign groups to all 24 NPC's.
When you move them, your loop would then look like this:
For N=1 To 24
If NPC_Group(N)=1
Rem Move Objects in group 1 wherever
Endif
If NPC_Group(N)=2
Rem Move Objects in group 2 wherever
Endif
If NPC_Group(N)=3
Rem Move Objects in group 3 wherever
Endif
Next N
This is only a simple example, but it demonstrates the method adequately.
TDK_Man