summaryrefslogblamecommitdiff
path: root/npc/014-2-2/valia.txt
blob: 2a66433b3ee052148fd988e365e90a1849d92cc7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12



                
                                                                                   
 





                                                

                                         
                                                          






                                                                         
















                                                                                          


                                                                                                                                       










                                         




















































                                                                                                                                                                   








                                                                                                                                                                                



                                               






                                      
         













                                                                                                          

























                                                                
                                                                   
                                                                  
          






                    
                                       














                                                                                                                                        





                                                             

























                                                                                                                   




                
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Gemini Sisters Quest - Valia Gemini. The quest can be resumed within 4 hours.

034-1	mapflag	zone	MMO
034-2	mapflag	zone	MMO
034-3	mapflag	zone	MMO
034-4	mapflag	zone	MMO

// Check if you can do this action or not (hero)
function	script	GeminiCheck	{
    .@st = getarg(0, 0);
    if (getq(General_Narrator) < 16 || @mystatus < .@st) {
        warp "Save", 0, 0;
        dispbottom l("You don't feel so well... And then, you're dead.");
        die();
        end;
    }
}

// You killed a mob
function	script	GeminiKill	{
    if (!compare(getmap(), "val")) end;
    switch ('STATUS) {
    case 1: // Quest initiated
        break;
    case 2: // Looking for a runestone
        if (killedrid == GreenSlime) {
            if (!rand2(40)) {
                getexp 8132, 657;
                dispbottom l("You found the Runestone! You gave it to the party leader.");
                'STATUS = 3;
            }
        }
        break;
    case 3: // Has runestone
        break;
    case 4: // Desert unlocked, but no clue on what to do
        break;
    // Forest -> Desert -> Bandit Cave -> Island -> Fake showdown -> Storage -> Showdown -> Chest, Lore and Exit -> Wumpus' Trap -> End
    }
    return;
}

// Janitor
function	script	GeminiFail	{
    .@id=getarg(0, 0);
    return;
}


// Valia Gemini
014-2-2,36,22,0	script	Valia	NPC_RED_WIZARD_F,{
    GeminiCheck();
    .@q = getq(HurnscaldQuest_Gemini);
    mesn;
    mesq l("Greetings, adventurer. I am Valia Gemini, owner of this abode.");
    next;
    mesn;
    mesq l("I usually don't let anyone in, but I had to make an exception for the likes of you.");
    next;
    mesn;
    mesq l("You see, I have a sister. Luvia Gemini. Very talented, but unfortunately, not enough to prevent being captured and brainwashed by Isbamuth.");
    next;
    mesn;
    mesq l("I am sure you already fought him. And survived, too, apparently. Help her, and I will reward your efforts appropriately.");
    next;
    mesn;
    mesq l("You can bring up to 3 other friends with you, but they must be on the same party as you and you must be the party leader.");
    next;
    select
        l("I'm not interested, sorry."),
        l("Why don't you go yourself?"),
        l("Alright, I will help.");
    mes "";
    switch (@menu) {
    case 1:
        close;
    case 2:
        mesn;
        mesq l("Because Isbamuth is tracking me? It would be pointless if he noticed. If you can't even understand this, maybe I overestimated you, after all...");
        close;
    }
    // You accepted the quest
    mesn;
    // ...But you lack a party
    if (getcharid(1) <= 0) {
	    mesq l("You don't have a party. You're useless to me.");
        close;
    }
    // ...But you are not the leader
    if (strcharinfo(0) != getpartyleader(getcharid(1))) {
	    mesq l("Bring me %s or make your own party if you want to help me.", getpartyleader(getcharid(1)));
        close;
    }
    // ...But the party is too large
    getpartymember(getcharid(1));
	.@count = $@partymembercount;
    if (.@count > 4) {
	    mesq l("Your party is too big. Discretion is a key if we want to succeed.");
        close;
    }
    // Alright.
    mesq l("Good. I hope you have stocked everything. The time limit is 4 hours.");

    // Only first attempt is free - all others are charged
    if (getq(HurnscaldQuest_Gemini)) {
        next;
        mesn;
        mesq l("Actually, I need help with reagents this time. Bring me a %s and a %s and I'll gladly warp you... again.", getitemlink(GemPowder), getitemlink(EverburnPowder));
        if (!countitem(GemPowder) || !countitem(EverburnPowder)) close;
        next;
    }
    mesc l("Are you and your party ready?"), 1;
    if (askyesno() != ASK_YES)
        close;

    // Not eligible for free lunch
    if (getq(HurnscaldQuest_Gemini)) {
        delitem GemPowder, 1;
        delitem EverburnPowder, 1;
    }

    // Handle first attempt
    mesn;
    mesq l("Good. Here, take this key and hide it. I will quickly brief you:");
    mes "";
    mesc l(".:: GEMINI ASSASSINS QUEST ::."), 3;
    mesc ("Recommended Level: %d+", 85);
    mes "";
    mes l("- The goal is to rescue Luvia from Isabamuth. She has been ##Bbrainwashed##b.");
    mes l("- Luvia is a powerful mage and Isbamuth is watching, so teleporting directly would be risky.");
    mes l("- Instead, the party will be teleported ##Bto a forest.##b");
    mes l("- Find a path to the island where she is hiding herself!");
    if (!getq(HurnscaldQuest_Gemini))
        mesc l("- If you fail, you'll need to pay me ingredients to try again!"), 1;
    mes "";
    mesc l("Good luck!");

    compareandsetq HurnscaldQuest_Gemini, 0, 1;

    // Create instance
    .@p=getcharid(1);
	.@inst = instance_create("Gemini "+.@p, .@p, IOT_PARTY);

    // If it worked then setup
    if (.@inst >= 0) {
        // Attach maps
        instance_attachmap("034-1", .@inst, false, "val1@"+.@p);
        instance_attachmap("034-2", .@inst, false, "val2@"+.@p);
        instance_attachmap("034-3", .@inst, false, "val3@"+.@p);
        instance_attachmap("034-4", .@inst, false, "val4@"+.@p);
        // Save the instance ID
        $@VALIA_INST[.@p]=.@inst;
        $@VALIA_MAP$[.@p]="";
    }

    // Instance lasts 4 hours - your time limit
	instance_set_timeout(14400, 14400, $@VALIA_INST[.@p]);

    // Do we need to initialize or are we just restarting?
    if (.@inst >= 0)
    	instance_init(.@inst);

    // Warp everyone and add timers
    partytimer("014-2-2", 1000, "Valia::OnCoreInit", getcharid(1));
    warpparty("val1@"+.@p, 24, 24, getcharid(1), "014-2-2", true);
    close;

// Macros
OnCoreInit:
    @mystatus = 0;
    if (!'STATUS)
        'STATUS = 1;
OnCore:
    if (!compare(getmap(), "val")) end;
    .@p = getcharid(1);
    // Always true on first interaction
    // This handles new stages for person
    if (@mystatus != 'STATUS) {
        switch ('STATUS) {
        case 1: // Quest initiated
            @mystatus = 1;
            // Spawn monsters
            areamonster("val1@"+.@p, 20, 20, 60, 60, strmobinfo(1, GreenSlime), GreenSlime, (BaseLevel/15), "Valia::OnGSlime");
            areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, LogHead), LogHead, (BaseLevel/15), "Valia::OnLHead");
            areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, ForestMushroom), ForestMushroom, (BaseLevel/12), "Valia::OnFShroom");
            areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, RedMushroom), RedMushroom, 1+(BaseLevel/30), "Valia::OnRShroom");
            break;
        case 2: // Looking for a runestone
            break;
        case 3: // Runestone was found
            getexp 8132, 657;
            break;
        case 4: // Desert unlocked, but no clue on what to do
            dispbottom l("You hear a noise from distance.");
            // Spawn monsters
            break;
        }
    }
    addtimer(5000, "Valia::OnCoreInit");
    end;

OnGSlime:
    fix_mobkill(GreenSlime);
    areamonster("val1@"+.@p, 20, 20, 60, 60, strmobinfo(1, GreenSlime), GreenSlime, 1, "Valia::OnGSlime");
    end;

OnLHead:
    fix_mobkill(LogHead);
    areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, LogHead), LogHead, 1, "Valia::OnLHead");
    end;

OnFShroom:
    fix_mobkill(ForestMushroom);
    areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, ForestMushroom), ForestMushroom, 1, "Valia::OnFShroom");
    end;

OnRShroom:
    fix_mobkill(RedMushroom);
    areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, RedMushroom), RedMushroom, 1, "Valia::OnRShroom");
    end;

OnInit:
    .distance=4;
    end;
}