#define action1 1
#define action2 2
#define action3 3
main()
{
ENTITY* aPointer;
//specifying a pointer allows you to send it/manipulate it later in this or other functions
aPointer = spawnFunction(action1);
}
//Usually I'd specify 2 or 3 variables for the vector in
//order to place it where you want but it's really up to you.
ENTITY* spawnFunction(int action)
{
if(action == action1)
{
ent_create("default.mdl", vector(0, 50, 100), yourAction1);
}
else if (action == action2)
{
ent_create("raptor.mdl", vector(0, 50, 100), yourAction2);
}
else if (action == action3)
{
ent_create("tower.mdl", vector(0, 50, 100), yourAction3);
}
else
{
//you could write an error, or whatever here, it's good practice to use error checking
}
return my;
}
//Usually defined somewhere else, like another file
action yourAction1()
{
...
}
action yourAction2()
{
...
}
action yourAction3()
{
...
}