FANDOM



Stargate teleporter Edit

Description Edit

I needed a script that could teleport the PC from location to another, similar to the way the StarGate system works. ie. The PC comes across a LandGate and notes down the combination of that gate, I chose colours determined by placing coloured shafts of light in a Menhir with a Dial placeable in the middle. Upon clicking the Dial, you start a conversation with it which allows you to key in 3 colour codes and then will teleport you to the destination if it is valid. Unlike a portal stone this allows you to teleport to any destination, provided you know it's combination designation.

Notes Edit

Step 1Edit

Create Waypoints in the module using the tag format "WP_xxx" where xxx is the desired WP combination, letters numbers, colours, whatever you like.

Step 2Edit

Create a Dial next to the WP or another placeable you want to activate the portal with. The Dial placeable is ideal. Tag doesn't matter.

Step 3Edit

Modify the Dial properties so that it is Useable and Plot (So it can't be destroyed, you don't want people doing that!)

Step 4Edit

Create a script for the Dial in OnUsed() with the command ActionStartConversation (GetLastUsedBy()) to initiate conversation. eg.

void main()
{
    ActionStartConversation (GetLastUsedBy());
}


Step 5Edit

Create a convseration file and use the SetLocalString in conversation to set the dialed values on the PC. Use ActionTaken to set the individual the values as they are keyed. I used individual scripts with names like "dial_value1_b", "dial_value3_g" etc.

void main()
{
    // DialValue1 = First Value
    // DialValue2 = Second Value
    // DialValue3 = Third Value
    // B = Blue, G = Green, R = Red or whatever else you want as a combination
    SetLocalString (GetPCSpeaker(), "DialValue1", "B");
}

Step 6Edit

Call the following script "dial_activate" at the end of the conversation, both on normal end and aborted conversation. It doesn't matter because the script checks for valud combinations anyway.

// LandGate
// By Paul Pritsis
// paul@anotherworld.com.au
// November 2002
#include "NW_I0_GENERIC"
void main()
{
    // Get DialValues based on conversation script with the Sundial.
    string DialValue = GetLocalString (GetPCSpeaker(), "DialValue1") +
                       GetLocalString (GetPCSpeaker(), "DialValue2") +
                       GetLocalString (GetPCSpeaker(), "DialValue3");
    // Set destination Waypoint Tag
    string DestWP = "WP_Dial" + DialValue;
    location DestLocation = GetLocation (GetWaypointByTag(DestWP));
    // Set Valid Portal combinations
    // R = Red, G = Green, B = Blue
    // Change Counter to match total number of combinations
    int Counter = 4;
    SetLocalString (GetPCSpeaker(), "ValidWP1", "RRR");
    SetLocalString (GetPCSpeaker(), "ValidWP2", "RRG");
    SetLocalString (GetPCSpeaker(), "ValidWP3", "RRB");
    SetLocalString (GetPCSpeaker(), "ValidWP4", "GRR");
    // Scan ValidWP values for match
    int JumpOk = 0;
    do
    {
        string ValidWPValue = GetLocalString (GetPCSpeaker(), "ValidWP" + IntToString (Counter));
        if (ValidWPValue == DialValue)
        {
            JumpOk = 1;
        }
        Counter = Counter - 1;
    }
    while (Counter > 0);
    // Valid DialValue found
    if (JumpOk == 1)
    {
        // Display Visual Effect & Wait Before Jumping
        SpeakString ("Activating Portal");
        PlaySound ("as_mg_telepin1");
        ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_HOLY_AID), GetPCSpeaker());
        AssignCommand (GetPCSpeaker(), DelayCommand (2.0, JumpToLocation (DestLocation)));
    }
    else
    {
        SpeakString ("Invalid Chevron Combination");
    }
}

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.