summaryrefslogblamecommitdiff
path: root/npc/functions/teleporter.txt
blob: 40376eee5fae2811dfe30d059d8a29cd7335bfce (plain) (tree)





















































                                                                                        
// TMW2 Script
// Authors:
//    Jesusalva
// Description:
//    Link portals to soul menhirs like the teleporters from old
//    The price is temporary. This feature got in because no ship in Nivalis Port
//    PS. Anise => “Aisen” Anagram

// TeleporterGate(TP_CURRENT)
function	script	TeleporterGate	{
    .@TP=getarg(0);

    // Validate
    .@x=array_find($@LOCMASTER_TP, .@TP);
    if (.@x < 0)
        return Exception("Invalid Teleport Point: "+.@TP);

    // Obtain current Teleport Point (.@IF)
    .@x=array_find($@LOCMASTER_MAP$, getmap());
    .@IF=$@LOCMASTER_TP[.@x];

    if (!(TELEPORTERS & .@TP)) {
        TELEPORTERS=TELEPORTERS|.@TP;
        mesn "Anise Inc.";
        mesc l("Location Registered. You are now capable to use this warp gate.");
        next;
    }
    mesc l("Where should I warp to?");
    mesc l("Cost: 1 @@", getitemlink(PileOfAsh)), 1;
    if (!countitem(PileOfAsh))
        close;
    next;
    menuint
        rif(TELEPORTERS & TP_FROST && .@IF != TP_FROST, l("Frostia")), TP_FROST,
        rif(TELEPORTERS & TP_HALIN && .@IF != TP_FROST, l("Halinarzo")), TP_HALIN,
        rif(TELEPORTERS & TP_LILIT && .@IF != TP_FROST, l("Lilit")), TP_LILIT,
        rif(TELEPORTERS & TP_TULIM && .@IF != TP_FROST, l("Tulimshar")), TP_TULIM,
        rif(TELEPORTERS & TP_HURNS && .@IF != TP_FROST, l("Hurnscald")), TP_HURNS,
        rif(TELEPORTERS & TP_NIVAL && .@IF != TP_FROST, l("Nivalis")), TP_NIVAL,
        rif(TELEPORTERS & TP_LOF   && .@IF != TP_LOF,   l("Land Of Fire")), TP_LOF,
        rif(TELEPORTERS & TP_FORT  && .@IF != TP_FORT,  l("Fortress Island")), TP_FORT,
        rif(TELEPORTERS & TP_BOSSR && .@IF != TP_BOSSR, l("Moubootaur Maze")), TP_BOOSR,
        l("None"), -1;
    mes "";
    if (@menu != -1)
        delitem PileOfAsh, 1;
    closedialog;

    // Retrieve location specifics and warp
    .@x=array_find($@LOCMASTER_TP, .@TP);
    warp $@LOCMASTER_MAP$[.@x], $@LOCMASTER_X[.@x], $@LOCMASTER_Y[.@x];
    return;
}