I was wondering if this could be done...
There are some cases when I dont know on start how many "copies" of a certain item I want to have.
Sometimes I even want tons of them! But I dont want to have to declare tons of variables that I dont know if all are going to be used (or mabe even more than i declare will be needed).
I was wondering if there was any way to create a string (changing the string for each new entity) and using that for its name?
instead of having to use pre-defined names like I do now:
ENTITY* soldier1;
ENTITY* soldier2;
ENTITY* soldier3;
etc...
ENTITY* soldier100;
I just hate doing that!
And also its 100 corresponding actions to attack each different pointer (or 100 ifs in the action to decide which pointer to make = me)
example of what im asking:
int number_of_soldiers;
action Create_Soldier_Name()
{
STRING* My_ID_Number;
STRING* New_Entity_Name;
//set the number
My_ID_Number = number_of_soldiers;
//create a string with that number atttacked to it
New_Entity_Name = "Soldier" & My_ID_Number;
//Somehow use that string as the name/pointer for that entity
New_Entity_Name = me;
}
void main()
{
number_of_soldiers = 0;
while(1)
{
if(create_soldier_button == TRUE)
{
//update number of soldiers
number_of_soldiers ++;
//create a new soldier and go to action to give it its' unique name
ent_create("grunt.mdl", vector(0,0,0), Create_Soldier_Name)
}
}
}
I know that code will not work, but I hope you get what I intend to ask by that example.
Is it posible to do something similar to achieve this?
Mabe also for structs or variables or whatever?