This ring of travel set of scripts creates a "stone of recall"-type item that allows the user to use that item to teleport to a specific location in the module. After teleporting, the user can be given the choice to teleport to the party's leader, or to return to where the item had been used. Although the nomenclature suggests a ring, these scripts can be used with any item that has the "cast spell: unique power self only" item property.

Note: This script differs from some others in that the return portal is intended to be a placeable, whereas other scripts use the exit of an area.

How to Edit

To begin, make sure tag-based scripting is enabled in the module. This can be accomplished by using x2_mod_def_load in the module's OnModuleLoad event and x2_mod_def_act in the OnActivateItem event. In addition, place a waypoint where characters should appear after using the item. The below scripts assume the tag of the waypoint is ringspawnpoint; adjust this as needed.

The tag of the "ring of travel" item is the name of the following script. It does not need to be specified as an event handler.

// Tag-based script for "ring of travel".
#include "x2_inc_switches"
const string TAG_RECALL_WP = "ringspawnpoint";  // Tag of the waypoint where PCs go upon using the ring.
void main()
    // We care about only activation.
    if ( GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE )
    object oPC = GetItemActivator();
    // Record the user's location so we can return there later.
    SetLocalLocation(oPC, LV_RECALL, GetLocation(oPC));
    // Send the PC to the designated waypoint.
    AssignCommand (oPC, JumpToObject(GetWaypointByTag(TAG_RECALL_WP)));
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HOLY_AID), oPC);

Accessible from the destination waypoint should be a "recall portal", a placeable (or creature) with a conversation that will present three choices: go to the party leader, go to where the "ring of travel" was last used, or end the conversation without teleporting. For the party leader option, the "actions taken" script can be set to nw_all_feedbackg. For the return-to-where-the-item-was-used option, the following script may be used.

// Sends the PC speaker to where the "ring of travel" was last used.
void main()
    object oPC = GetPCSpeaker();
    location lTarget = GetLocalLocation(oPC, LV_RECALL);
    // Send the PC to the last place the ring was used.
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON),
    DelayCommand(0.5, AssignCommand(oPC, JumpToLocation(lTarget)));

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.