Heres another little snippet for applying lightmaps:
Code:
str_for_entfile(tempstring,my);
str_lwr(tempstring);
str_cpy(lightstring,"z");
str_cat(lightstring,tempstring);
//load model with light map uv-set
e2 = ent_create(lightstring, nullvector, 0);
//generate and assign a new mesh with both uv-sets
ent_loadseconduvset(my, e2);
ent_remove(e2);
Basically you can just save your models that contains lightmaps with a "z" in front of there original names. If you put this in your action, every entity with this action will load a lightmap. If you want to have only some entities with this action load them, then you can just specify that with a flag or skill.
I wish there was a way to morph the skin2 of an entity. It would make automatic lightmap texture assigning to your non-lightmap models skin2 possible.