Code:
// skill1: speed 4
// skill2: key 0
// skill3: offset_x 0
// skill4: offset_y 0
// skill5: offset_z 200
// skill6: swing 0
// skill7: angle 90
// skill8: open_manually 0
action t_door()
{	
	while (!player) {wait (1);} // wait until the player is loaded
	vec_set (my.skill61, my.x); // store the xyz initial position of the door inside skill61... 63
	my.skill64 = my.pan; // store the initial pan angle
	if (my.speed == 0)
		my.speed = 4;
	if (my.offset_z == 0)
		my.offset_z = 200;
	if (my.angle == 0)
		my.angle = 90;		
	while (1)
	{
		c_scan(my.x, my.pan, vector(360, 180, t_door_range), IGNORE_ME | SCAN_ENTS); // each door scans around it, trying to detect the player
  		if (you) // detected an entity?
		{
			if (you == player) // and that entity is the player?
			{
				if (my.open_manually) // need to press a key in order to open the doors?
				{
					if(key_pressed(key_for_str(key_open))) // the "open" key was pressed?
					{
						if (my.skill2 > 0) // this door needs a key?
						{
							if (player.skill70 == my.skill2) // the player has got the proper key? then let's open the door!
							{
								t_open_doors(); // this function opens the doors
								return;
							}
							else // the player doesn't have the needed key?
							{
								wait (1); // don't do anything
							}
						}
						else // the door doesn't need a key
						{
							t_open_doors(); // this function opens the doors
							return; // the action stops afterwards							
						}
					}
				}
				else // the door opens automatically
				{
					if (my.skill2 > 0) // this door needs a key?
					{
						if (player.skill70 == my.skill2) // the player has got the proper key? then let's open the door!
						{
							t_open_doors(); // this function opens the doors
							return; // the action stops afterwards
  						}
		  			}	
		  			else // this door doesn't need a key
	  				{
	  					t_open_doors(); // this function opens the doors
	  					return; // the action stops afterwards
  					}
  				}
  			}
		}
  		wait (1);
  	}		
}


Please explain, should the door open auto or on keypress? I not sure I can help as I never use template code.

Last edited by Malice; 09/09/15 17:49.