Script: Ring of Travel (Stone of Recall and Portal Return System)
What it does: Creates a "Stone of Recall" type item (can be any usable item, in
this case a Ring), so the user can gate back to a specific waypoint in the
module. Also a recall portal to port back to party leader, or where they last
used their ring of travel from.
**NOTE** This script was created because the other two recall portal scripts
that I've come across either a) didn't work, or b) the return portal was
attached to an OnAreaTransition (exit) of a place, not to my liking for what I
had in mind. The first one that didn't work, was calling for making an invisible
object. It also was not grabbing the location from where the person using the
stone of recall type item was porting 'from', hence making it impossible to
return to that spot, if so desired. There was also no "return to party leader"
script, so one was created with getting the faction of your party's leader.
How to: OK, there is a set of 4 scripts here, First one is to create an item and
assign "Cast spell: unique self only power" and set it to unlimited uses per
day. Get the item's TAG, and add it to the script below. Put this script in your
module properties' "OnActivateItem" script area.. script below:
void main()
{
object oActivated = GetItemActivated();
switch(1);
{
// Item 1 = TravelRing, which in this case is the Stone of Recall type item.
case 1: if(GetTag(oActivated) == "TravelRing")
{
object oObject = GetItemActivator();
object oTarget = GetItemActivator();
location lLocation = GetLocation(oObject);
{
SetLocalLocation(oTarget,"RECALL_OBJECT",lLocation);
// This will set your location right before using the ring, so you can port
back.
}
{
// travelring2 = name of second script
ExecuteScript("travelring2", oTarget);
}
}
}
}
Next, we need to create a script that the first script is calling, in this case
"travelring2". This script is not placed anywhere, but created so that when the
first script is activated when someone click's on the ring, it will return the
player to a specific waypoint in your module. At this point, lets create a
waypoint and give it a unique name and tag.. in my case, my waypoint's TAG is "ringspawnpoint",
as you can see in the script below. Then, place the newly created waypoint in
your module where you'd like your player to show up, after having used the Stone
of Recall type item (in my case, the Ring of Travel). Remember, this script is
created and saved, with the same name as the first script will call for. It is
not actually placed anywhere.
void main()
{
object oActivated = GetItemActivated();
switch(2);
{
case 1: if(GetTag(oActivated) == "TravelRing")
{
object oPC = GetItemActivator();
// waypoint1 = Tag of waypoint where the player will be taken to when they
activate the ring.
object oTarget = GetWaypointByTag ("ringspawnpoint");
AssignCommand (oPC,JumpToObject(oTarget));
ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_HOLY_AID),
oPC);
}
}
}
Finally, we need to place a recall portal somewhere in your module, where you
would like players to be able to go to, so they may use the portal to return to
their party leader, or to where they last gated from using their Ring of Travel
(I placed mine next to my waypoint, for easy access). Once you have your recall
portal placed where you want it, go to "advanced" tab of your portal properties,
and create a conversation thread for it which gives it basicly 3 choices... Port
to Party Leader, Port to where you last used your "ring of travel" (or whatever
item you're using in it's place), or Do Nothing.
Once the conversation script for the portal is created, there are two scripts
below, one for each of the two choices... that need to be placed in the "actions
taken" part of the conversation, when that particular choice has been
selected...
To port back to party leader, place this in the appropriate part of the "actions
taken" part of the recall portal's conversation:
void main()
{
object oPC = GetPCSpeaker();
object oLeader = GetFactionLeader(oPC); //Get PC's Party Leader
location lLoc = GetLocation(oLeader); //Get the location of the leader
location lLoc1 = GetLocation(oPC);
float fSec = 0.5;
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_UNSUMMON),
lLoc1, 0.0);
DelayCommand(fSec,AssignCommand (oPC,JumpToLocation(lLoc)));
}
To port back to where you last used your Ring of Travel from, place script below
in appropriate "actions taken" part of conversation choice:
#include "NW_I0_GENERIC"
void main()
{
location lLoc;
object oPC = GetPCSpeaker();
location lLoc1 = GetLocation(oPC);
float fSec = 0.5;
lLoc = GetLocalLocation(oPC,"RECALL_OBJECT");
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_UNSUMMON),
lLoc1, 0.0);
DelayCommand(fSec,AssignCommand (oPC,JumpToLocation(lLoc)));
}