here is a code snippet which cycles through all entities of a level and applies a light map if the "_lm" files exist for the entity. i haven't tested it yet. it's just an idea...

Code:
// example 3
function file_exists(filename)
{
var filehandle;
filehandle = file_open_read(filename);
if(filehandle)
{
file_close(filehandle);
return(1);
}
else
{
return(0);
}
}

string tempstring1;
string tempstring2;
material* tempmaterial;
entity* tempentity;

function applylightmaps()
{
you = ent_next(0);
while(you != 0)
{
str_for_entfile(tempstring1, you);
str_trunc(tempstring1, 4);
str_cpy(tempstring2, tempstring1);
str_cat(tempstring1, "_lm.mdl");
str_cat(tempstring2, "_lm.dds");

if(file_exists(tempstring1) && file_exists(tempstring2))
{
you.skill100 = mtl_create(); // i guess they should be deleted again when changing the level
tempmaterial = you.skill100;
tempmaterial.effect = mtl_lightmap.effect;
tempmaterial.skin1 = bmap_create(tempstring2); // i guess they should be deleted again when changing the level
you.material = tempmaterial;

tempentity = ent_create(tempstring1, nullvector, 0);
ent_loadseconduvset(you, tempentity);
ent_remove(tempentity);
}

you = ent_next(you);
}
}



i thought some more about payment. it's kind of unfair if not everyone pays the same amount. i will just sell the plugin individually for 20€.

...
i also found out that vec_for_mesh()/vec_to_mesh() won't work anymore with a replaced mesh (but ent_vertices(), vec_for_vertex(),... still work). there is nothing i can do about it but i think it's no big issue since for a light mapped mesh modifications wouldn't make much sense anyway since the lighting got done for the unmodified mesh and wouldn't be correct anymore. if you absolutely need to modify the mesh you could do the modifications to both models before you use ent_loadseconduvset().