Originally Posted By: Superku
check when the player is on the elevator (that means inside the elevator's bounding box, above it and vertically close to it)

You should/ could use the quoted approach to check when the player has to be moved. Your code is a little confusing to me to be honest, so I wrote you a basic example for an elevator that starts at the bottom and moves to a higher level when the player stands on it. It is untested but it should give you an idea of what I was talking about:

Code:
//skill1: target_z 0
action elevator()
{
	c_setminmax(my);
	set(my,POLYGON);
	if(!my.skill1) error("Elevator: Enter a target height in WED!");
	my.skill2 = my.z;
	my.skill3 = 1;
	while(!player) wait(1);
	while(1)
	{
		if(player.x > my.x+my.min_x && player.x < my.x+my.max_x
		&& player.y > my.y+my.min_y && player.y < my.y+my.max_y
		&& player.z+player.min_z > my.z+my.max_z && player.z+player.min_z < my.z+my.max_z+32) //you may have to adapt the 32 quants here
		{
			my.skill4 = maxv(my.skill4-time_step,0);
			if(!my.skill4) my.skill5 = 1; //activate elevator
		}
		else my.skill4 = 16; // one second delay
		
		if(my.skill5)
		{
			if(my.skill3 == 1)
			{
				my.skill6 = minv(my.skill1,my.z+10*time_step);
				c_move(me,nullvector,vector(0,0,my.skill6-my.z),IGNORE_MODELS | IGNORE_SPRITES | IGNORE_WORLD);
				if(my.skill6 >= my.skill1)
				{
					my.skill3 = -1;
					my.skill5 = 0;
					my.skill4 = 16;
				}
			}
			else
			{
				my.skill6 = maxv(my.skill2,my.z-10*time_step);
				c_move(me,nullvector,vector(0,0,my.skill6-my.z),IGNORE_MODELS | IGNORE_SPRITES | IGNORE_WORLD);
				if(my.skill6 <= my.skill2)
				{
					my.skill3 = 1;
					my.skill5 = 0;
					my.skill4 = 16;
				}
			}
		}
		wait(1);
	}	
}



Be aware that I don't manipulate my.z directly but use c_move because c_move updates the collision hull of the platform automatically (whereas without this instruction the hull could be updated after the player code).

Btw. try to use proc_mode = PROC_EARLY; here, too.

Last edited by Superku; 11/10/12 20:42.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends