OK, hopefully this will explain. And its all tested too.
Action "model" takes a snapshot of the relevent deltails and stores them in the global variables.
functions "create_1" and "create_2" show two ways to store and retrieve the function as a string using engine_getscript.
functions "create_3" and "create_4" show two ways to store and retrieve the function as a void_pointer.
Its now up to you to decide which way you want to store your data.
I prefer 3&4 because its tidier in code,
but others would prefer 1&2 as strings probably make it more save-game usable.
void re_director(); //prototype function //only used by create_1 and create_3
STRING* s_view = "#30"; //used by all
STRING* s_function = "#30"; //only used by create_1 and create_2
void* v_function = NULL; //only used by create_3 and create_4
action model()
{
//store entity data
str_cpy(s_view, "modelname.MDL");
//or str_cpy(s_view, my.type);
str_cpy(s_function, "rotator"); //only used by create_1 and create_2
v_function = rotator; //only used by create_3 and create_4
}
function create_1()
{
me = ent_create(s_view, NULL, NULL);
re_director = engine_getscript(_chr(s_function));
if(re_director) { re_director(); }
}
function create_2()
{
ent_create(s_view, NULL, engine_getscript(_chr(s_function)));
}
function create_3()
{
me = ent_create(s_view, NULL, NULL);
re_director=v_function; re_director();
}
function create_4()
{
me = ent_create(s_view, NULL, v_function);
}
Any questions, just ask...