Author Sticky: Post Working Scripts Here
Understark Kell-Wolf Posted: Monday, 29 July 03:29AM
Fairly simple teleportation script, all the details about how to set it up are included with the scripts... just e-mail me @ sanguinus@earthlink.net if you have problems setting it up... or AIM me at ranma4243, or MSN me at jp4tsu@hotmail.com, or ICQ me at 150948872 etc. etc. etc.

Basically the point of these scripts is to have a collection of "sending portals", which send the PC to a common destination portal, and a "smart destination portal" which returns the PC to the portal they came from.

Essentially all you need is two-three portals in different locations, 1-2 to act as senders, WITH UNIQUE TAGS!, and one to act as a returner, then just attach the corressponding scripts.

Enjoy!
Understark

Code:
//::///////////////////////////////////////////////

//:: Returning Portal - Returns PC to Send Portal

//:: returnportal.nns

//:: Copyright (c) 2001 Bioware Corp.

//:://////////////////////////////////////////////

/*

Written by Understark Kell-Wolf

The purpose of this script is to return the PC that uses this portal to the initial portal (that uses my SendPortal.nns) that they came from

This is probably best used in situations like Temples of Tyr that serve multiple towns, but I can see a lot of adaption possibility.

The req's for this script are basically two portal objects, doesn't matter what they are, that are set as "plot" and "useable", one will be placed in a town

or other place where you would typically find a portal, the other will be placed inside your destination (IE three portals, in different towns using

sendportal.nns, and one in a temple of tyr using returnportal.nns), then attach these scripts to OnUse and you are set. This script will teleport henchmen and

animal companions as well (I've tested it).

Enjoy!

*/

//:://////////////////////////////////////////////

//:: Created By: Understark Kell-Wolf

//:: Created On: 7/28/02

//:://////////////////////////////////////////////



void main()

{

  //These commands beneath here are just used to get the player and the relevant locations, basically to define variables

  object oPC = GetLastUsedBy(); //Gets the PC that activated the portal

  location lPortalLocation = GetLocation(OBJECT_SELF); //Gets the location of the portal, this could also be done with waypoints

  string sPortalCameFrom = GetLocalString(oPC, "PortalCameFrom"); //This retreives the last activated portal (the portal the PC came from)

  SendMessageToPC(oPC, sPortalCameFrom); //Debugging Command

  object oDestPortal = GetObjectByTag(sPortalCameFrom); //Gets the object that represents the destination portal

  location lDestPortal = GetLocation(oDestPortal); //Gets the location of the destination portal

  //From here down, these commands are responsible for moving the player to the beam and playing the teleport effects

  AssignCommand(oPC, ClearAllActions()); //This just clears the player's action queue

  AssignCommand(oPC, ActionMoveToLocation(lPortalLocation)); //Moves the player to the location of the sending portal

  effect eTPRing = EffectVisualEffect(20); //This defines the spiral effect

  DelayCommand(1.0,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eTPRing, lPortalLocation, 10.0)); //This delays the play of the spiral effect for 1 second

  effect eTPBeam = EffectVisualEffect(70); //This defines the beam-from-the-heavens effect

  DelayCommand(1.0,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eTPBeam, lPortalLocation, 10.0)); //This delays the play of the beam effect for 1 second

  //This is where the player gets teleported

  DelayCommand(1.75,AssignCommand(oPC, ActionJumpToLocation(lDestPortal)));

}



and

Code:
//::///////////////////////////////////////////////

//:: Sending Portal - Sends PC to Return Portal

//:: sendportal.nns

//:: Copyright (c) 2001 Bioware Corp.

//:://////////////////////////////////////////////

/*

Written by Understark Kell-Wolf

The purpose of this script is to send the PC to a portal (of your choice) that uses my returnportal.nns script... as you can tell, it's a bare-bones

teleportation script with some extras tacked on to make it fancy. You don't have to use returnportal.nns on the destination portal, but there really isn't much

point if you don't.

This is probably best used in situations like Temples of Tyr that serve multiple towns, but I can see a lot of adaption possibility.

The req's for this script are basically two portal objects, doesn't matter what they are, that are set as "plot" and "useable", one will be placed in a town

or other place where you would typically find a portal, the other will be placed inside your destination (IE three portals, in different towns using

sendportal.nns, and one in a temple of tyr using returnportal.nns), then attach these scripts to OnUse and you are set. This script will teleport henchmen and

animal companions as well (I've tested it).

Enjoy!

*/

//:://////////////////////////////////////////////

//:: Created By: Understark Kell-Wolf

//:: Created On: 7/28/02

//:://////////////////////////////////////////////

void main()

{

  //These commands beneath here are just used to get the player and the relevant locations, basically to define variables

  object oPC = GetLastUsedBy(); //Gets the PC that activated the portal

  location lPortalLocation = GetLocation(OBJECT_SELF); //Gets the location of the portal, this could also be done with waypoints

  object oDestPortal = GetObjectByTag("TyrEntranceBeam"); //Gets the object that represents the destination portal

  location lDestPortal = GetLocation(oDestPortal); //Gets the location of the destination portal

  string sPortalTag = GetTag(OBJECT_SELF); //This gets the tag of the activated portal

  //From here down, these commands are responsible for moving the player to the beam and playing the teleport effects

  SetLocalString(oPC, "PortalCameFrom", sPortalTag); //This stores the tag of the activated portal, so that it can be determined which portal the PC came from

  string sPortalCameFrom = GetLocalString(oPC, "PortalCameFrom"); //Debugging Command

  SendMessageToPC(oPC, sPortalCameFrom); //Debugging Command

  AssignCommand(oPC, ClearAllActions()); //This just clears the player's action queue

  AssignCommand(oPC, ActionMoveToLocation(lPortalLocation)); //Moves the player to the location of the sending portal

  effect eTPRing = EffectVisualEffect(20); //This defines the spiral effect

  DelayCommand(1.0,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eTPRing, lPortalLocation, 10.0)); //This delays the play of the spiral effect for 1 second

  effect eTPBeam = EffectVisualEffect(70); //This defines the beam-from-the-heavens effect

  DelayCommand(1.0,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eTPBeam, lPortalLocation, 10.0)); //This delays the play of the beam effect for 1 second

  //This is where the player gets teleported

  DelayCommand(1.75,AssignCommand(oPC, ActionJumpToLocation(lDestPortal)));

}