Hier mal nen schmutziges Skript:
Code:
#define LOD_MIN 800

var lod_dist[4];

function set_lod_startup()
{
	lod_dist[1] = LOD_MIN;
	lod_dist[2] = LOD_MIN * 2;
	lod_dist[3] = LOD_MIN * 3;
	lod_dist[4] = LOD_MIN * 4;
}


function register_lod(ENTITY* ent, lods)
{
	STRING* temp_str = "#32";
	STRING* Model_file = "#32";
	var i = lods;
	var myvar;
	
	if(lods <= 0)
	{
		i = 1;
	}
	if(lods > 4)
	{
		i = 4;
	}
	
	STRING* LOD_model_file[4];
	
	
	str_for_entfile(Model_file,ent);
	
	for(myvar = 0; myvar < i; myvar++)
	{
		str_for_num(temp_str,myvar);
		LOD_model_file[myvar] = str_create(Model_file);
		str_trunc(LOD_model_file[myvar] ,4);
		str_cat(LOD_model_file[myvar] ,"_lod");
		str_cat(LOD_model_file[myvar] ,temp_str);
		str_cat(LOD_model_file[myvar] ,".mdl");
	}

	while(ent != NULL)
	{
		wait(10);
		switch(ent.skill99)
		{
			case 1:
			ent.skill99 = 0;
			return(1);
			
			case 2:
			ent.skill99 = 0;
			for(myvar = 0; myvar < i; myvar++)
			{
				str_for_num(temp_str,myvar);
				LOD_model_file[myvar] = str_create(Model_file);
				str_trunc(LOD_model_file[myvar] ,4);
				str_cat(LOD_model_file[myvar] ,"_lod");
				str_cat(LOD_model_file[myvar] ,temp_str);
				str_cat(LOD_model_file[myvar] ,".mdl");
			}
			
		}
		
		if ((ent.eflags&CLIPPED)) { continue; }
		
		str_for_entfile(temp_str,ent);
		
		if(vec_dist(ent.x,camera.x) <= lod_dist[1])
		{
			if(str_cmpi(Model_file,temp_str) == 1)
			{
				continue;
			}
			ent_morph(ent,Model_file);
			continue;
		}
		
		if(vec_dist(ent.x,camera.x) <= lod_dist[2])
		{
			if(str_cmpi(LOD_model_file[0],temp_str) == 1)
			{
				continue;
			}
			ent_morph(ent,LOD_model_file[0]);
			continue;
		}
		
		if(vec_dist(ent.x,camera.x) <= lod_dist[3] && lods >= 2)
		{
			if(str_cmpi(LOD_model_file[1],temp_str) == 1)
			{
				continue;
			}
			ent_morph(ent,LOD_model_file[1]);
			continue;
		}
		if(vec_dist(ent.x,camera.x) <= lod_dist[4] && lods >= 3)
		{
			if(str_cmpi(LOD_model_file[2],temp_str) == 1)
			{
				continue;
			}
			ent_morph(ent,LOD_model_file[2]);
			continue;
		}
		if(vec_dist(ent.x,camera.x) > lod_dist[4] && lods >= 4)
		{
			if(str_cmpi(LOD_model_file[3],temp_str) == 1)
			{
				continue;
			}
			ent_morph(ent,LOD_model_file[3]);
			continue;
		}
	}
}

Einfach die Entity über die gewünschte Funktion registrieren. Die Variable gibt die Anzahl der LOD Modelle vor. Die Entitys müssen die Endung N_lod.mdl haben, wobei n eine Zahl zwischen 0 und 3 ist.
Wenn du Skill99 der Entity auf 1 setzt, wird die Entity nicht mehr gemorpht, bleibt aber in ihrem aktuellen Zustand und Skill99 = 2 erzwingt ein update der Entity.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com