/* Here's a simple script that will allow a full edge area transition. If you
walk south across the trigger in the SW corner, then you will appear in the NW
corner of the new area.
This is based on Richard Conner's Mighty Teleport Script, which needed some
tweaks to make it work with the new toolset. */
void main()
{
/*
* Full-Edge Area Transition
* -------------------------
* Based on The Mighty Teleport Script from Richard Conner
* Jonathan Warrington
*
* Usage
* -----
* This is attached to the OnClick event of a GenericTrigger
* Two properties need to be modified to your areas. First,
* the GetObjectByTag line, fill in the tag of your trigger,
* that's in the destination area. Second, make sure the
* appropriate vDest is uncommented.
*/
//Get the PC that just clicked on the transition
object oClicker = GetClickingObject();
//Get the location of the PC
location lLoc = GetLocation( oClicker );
//Get the PC's postion
vector vEnter = GetPositionFromLocation( lLoc );
//The Trigger that's in the destination area
object oTran = GetObjectByTag( "Area2Tran" );
//Get the destination area
object oDestArea = GetArea( oTran );
//Get the postition of the trigger
vector lTranVec = GetPositionFromLocation( GetLocation( oTran ) );
//Calculates the destination postition (Uncomment either
//the east / west or the north / south one.
/*East / West Transition*/
//vector vDest=Vector( lTranVec.x, vEnter.y );
/*North / South Transition*/
vector vDest=Vector( vEnter.x, lTranVec.y );
//Get the PC's facing
float fFacing = GetFacingFromLocation( lLoc );
//Create a new Location to place the PC in
location locNew = Location( oDestArea, vDest, fFacing );
//Clear all PC actions, (Stop walking) and then jump
//to the new location.
AssignCommand( oClicker, ClearAllActions() );
AssignCommand( oClicker, JumpToLocation( locNew ) );
}