// Mirrorglass
//synonym mir; { type entity;} // synonym for mirrormodel
//synonym mgls; {type entity;} // synonym for mirrorglass
entity* mir; // for mirrormodel what is shown as trick relfection
entity*
mgls; // for mirrorglass
////////////////////////////////////////////////////////
action mirrorgl // to get the position
{ // assign this to the entity
mgls=me; // that you are using for
my.oriented=on; //your mirror
my.transparent=on;
my.ambient=-50;
}
/////////////////////////////////////////////////////
// Main Mirror Script
action posm1
{
my.passable=on; // player must touch posm1
my.invisible=on; // before touching posm2
while(1)
{
if (((player.y>my.y-79)&&(player.y<my.y+79))&&((player.x>my.x-20)&&(player.x<my.x+20))) {
if (ic2==1) // the distance that the model appears
{ moveit=0; ic2=0; } // in the mirror depends on the my.y
ic1=1; // -79 & +79 were used for this room
ic2=0; // this is the distance from where you
} // place the "mirrorgl"
wait 1; // you can change these to fit your needs
} // the my.x is the alignment the models
} // face each other
/////////////////////////////////////////////////////
action posm2
{
my.passable=on;
my.invisible=on;
while(1)
{
if (((player.y>my.y-79)&&(player.y<my.y+79))&&((player.x>my.x-20)&&(player.x<my.x+20))) {
if (ic1==1) // a good way to place the posm1 & posm2
{ moveit=1; ic2=0; } // is in some sort of narrow passage way
ic2=1; // to insure that the player will trigger
ic1=0; // the mirror and when leaving the room
} // he will hit the #2 then #1 and that
wait 1; // shuts down the mirror
}
}
/////////////////////////////////////////////////
action mirror1 // if mirror is paralell to X-axis,..facing north&south
{
while(1)
{
mir=me;
if (((player!=0)&&(mgls!=0))&&(moveit!=0))
{
mi_mod.x=player.x-mgls.x; // assign mirror1 or mirror2 to
my.x=mi_mod.x+mgls.x; // the model that will be shown
mi_mod.y= player.y-mgls.y; //as a reflection
my.y=-mi_mod.y+mgls.y;
my.frame = player.frame;
my.pan = -player.pan ;
mi_mod.z =player.z-mgls.z;
my.z=mi_mod.z+mgls.z;
}
wait 1;
}
}
////////////////////////////////////////////////////
action mirror2 // if mirror is paralell to Y-axis,.facing east&west
{
while(1)
{
mir=me;
if (((player!=0)&&(mgls!=0))&&(moveit!=0))
{
mi_mod.x=player.x-mgls.x;
my.x=-mi_mod.x+mgls.x;
mi_mod.y= player.y-mgls.y;
my.y=mi_mod.y+mgls.y;
my.frame = player.frame;
my.pan = -player.pan + 180;
mi_mod.z =player.z+mgls.z;
my.z=mi_mod.z-mgls.z;
}
wait 1;
}
}
////////////////////////////////
INCLUDE <debug.wdl>;