can I used an element like characters[2] to create an object out of it like an object from the class other character would be

OtherCharacter : characters[2]

I need to dynamically be able to create objects for the amount of characters in the vector or is their a better way of doing this.

you can do this: vector<Character> characters; The above will let you add as many Character class objects as you want to the vector.

so if I have a class telling the program how to build a character such as attributes and everything, I can just create objects of that class as many times as I need to using that code you posted?

Well, you also need to add the objects to the vector using something like characters.push_back ( my_character ); .

ok but when creating objects I do not no how to append something to the name of the object to differentiate it from the others because at one point 3 people could be logged into my game and at another 7 people could be so I have to be ready to know how to create objects dynamically if you no what I mean

>if you no what I mean
No, I don't. It seems like you don't feel your question has been answered adequately. If that's the case, post your code so we can see what you're doing now and can get a better idea of what you might be asking for.

I have no idea where to start with this concept, I will explain it deeper so maybe you can get a feel for what I am trying to ask.

Ok so I have a class called OtherCharacter and its filled with all the attributes that have to be loaded by the client when there is other characters in the game. But sometimes it is five people and sometimes its 20, so I need a way even if It is not vectors to create an object of the othercharacter class for every person on the server. I don't need the networking part of it just how to create an object dynamically almost.

I think you're confused. Just use vectors where you need more than one instance of any kind of data. When you create a character, also add that character to the list of "other characters". It doesn't seem like a terribly difficult thing to me, but then again, you're still not being very clear.

as previously mentioned, vector class doesn't care how many items you put into it, nor does it care when you do it. You can put an item into the vector at any random times. So when someone logs onto your game, fills out all the information needed for that character class, just add an instance of that class into the vector. The vector class will grow by itself as you add more objects to it.

Mabe what you want is a quick tutorial (click here)

This article has been dead for over six months. Start a new discussion instead.