Now it seems to work. But only when the origin of the building is in a wall. When only a bit of it is in a wall, the building is green frown
Has anyone an idea how i can change this?
Here's the new code

Code:
function Gebaeude_bauen_event() {
	switch (event_type)
	{
	case EVENT_BLOCK:
		my.green = 0;
		my.red = 255;
		return;
	case EVENT_ENTITY: 
		my.green = 0;
		my.red = 255;
		return;
	}
	return;
}

function Gebaeude_bauen() {
	// local erstellen

	my = ent_createlocal("Geschuetz.mdl",vector(ich.x + 100 * cos(ich.pan), ich.y + 100 * sin(ich.pan), ich.z), Geschuetz);

	wait(1);
	c_setminmax(my);
	
	my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); 
	my.event = Gebaeude_bauen_event;
	
	set(my, TRANSLUCENT |LIGHT);
	my.alpha = 50;
	
	
	// verschieben
	while (!Taste_bestaetigen || my.red == 255) {
		
		my.x = ich.x + 100 * cos(ich.pan);
		my.y = ich.y + 100 * sin(ich.pan);
		
		my.green = 255;
		my.red = 0;
		
		
		my.floor_dist = c_trace(my.x, vector(my.x, my.y, - 2000), IGNORE_ME | IGNORE_PASSABLE) + my.min_z;
		if (my.floor_dist > 0)
			c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
		if (my.floor_dist < 0)
			c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
		
		
		if (Taste_abbrechen) {
			ptr_remove(my);
			return;
		}
		wait(1);
	}
	
	// global erstellen
	if (Index == 1) {
		my = ent_create("Geschuetz.mdl", my.x, Geschuetz);
	}
}


Last edited by Toryno; 04/15/09 11:28.

Thanks for reading, thinking, answering wink